diff --git a/build.gradle b/build.gradle index 97c38c54..9402f4c1 100644 --- a/build.gradle +++ b/build.gradle @@ -1,54 +1,88 @@ plugins { - id 'java' - id 'org.graalvm.buildtools.native' version '0.9.20' + id 'java' + id 'org.graalvm.buildtools.native' version '0.9.20' + id("com.diffplug.spotless") version "6.17.0" + id("nebula.lint") version "18.0.3" } repositories { - mavenCentral() - gradlePluginPortal() + mavenCentral() + gradlePluginPortal() } allprojects { - version = "1.0.0-SNAPSHOT" - group = 'it.pagopa' + version = "1.0.0-SNAPSHOT" + group = 'it.pagopa' + apply plugin: 'com.diffplug.spotless' + apply plugin: 'nebula.lint' + gradleLint.rules = ['all-dependency'] } tasks.withType(AbstractArchiveTask).configureEach { - preserveFileTimestamps = false - reproducibleFileOrder = true + preserveFileTimestamps = false + reproducibleFileOrder = true } -subprojects { +tasks.withType(JavaCompile) { + options.compilerArgs.add('-Xlint:all') +} - apply plugin: 'java' - apply plugin: 'maven-publish' - apply plugin: 'org.graalvm.buildtools.native' +spotless { + // optional: limit format enforcement to just the files changed by this feature branch + ratchetFrom 'origin/main' - java { - withSourcesJar() - withJavadocJar() - } + format 'misc', { + // define the files to apply `misc` to + target '*.gradle', '*.md', '.gitignore' - publishing { - publications { - maven(MavenPublication) { - groupId project.group - artifactId project.name - version project.version - from components.java - } - } - } + // define the steps to apply to those files + trimTrailingWhitespace() + indentWithTabs() // or spaces. Takes an integer argument if you don't like 4 + endWithNewline() + } + java { + // don't need to set target, it is inferred from java + // apply a specific flavor of google-java-format + googleJavaFormat('1.11.0').aosp().reflowLongStrings() + // fix formatting of type annotations + formatAnnotations() + // make sure every file has the following copyright header. + // optionally, Spotless can set copyright years by digging + // through git history (see "license" section below) + licenseHeader '/* (C)$YEAR */' + } } -graalvmNative { - binaries { - main { - sharedLibrary=true - } - } -} +subprojects { + + apply plugin: 'java' + apply plugin: 'maven-publish' + apply plugin: 'org.graalvm.buildtools.native' + java { + withSourcesJar() + withJavadocJar() + } + publishing { + publications { + maven(MavenPublication) { + groupId project.group + artifactId project.name + version project.version + from components.java + } + } + } + +} + +graalvmNative { + binaries { + main { + sharedLibrary=true + } + } +} diff --git a/settings.gradle b/settings.gradle index 2faad5f6..231c70d5 100644 --- a/settings.gradle +++ b/settings.gradle @@ -8,11 +8,11 @@ */ pluginManagement { - repositories { - mavenCentral() - gradlePluginPortal() - } + repositories { + mavenCentral() + gradlePluginPortal() + } } rootProject.name = 'eng-lollipop-consumer-java-sdk' -include 'core', 'assertion-rest-client-native', 'http-verifier', 'identity-service-rest-client-native', 'redis-storage' \ No newline at end of file +include 'core', 'assertion-rest-client-native', 'http-verifier', 'identity-service-rest-client-native', 'redis-storage'