mirror of
https://github.com/google/nomulus.git
synced 2025-08-01 23:42:12 +02:00
Refactor gradle build script
1. Updated nebula lint version to 10.3.1 2. Do not apply plugins in the root projects that are not needed. 3. Only do linting when a build is successful, so that build failure message are not flushed by linter warnings. 4. Added explicitly stated java source and target version. 5. Moved source sets set up to the root project so that it applies to all subprojects. Currently there is only "core", but we will add at least "proxy" and "util" later, both of which will use mostly the same source sets (but with additional inclusion rules to only build classes in a specific sub folder in the source tree). By putting the set up closure inside the subprojects block in the root script, it can be reused. 6. Rename maybe_runtime configuration to maybeRuntime, which is consistent with other camelCase configuration names like testCompile. 7. Added a runtime dependency of the JAXB API which is removed from Java SE as of version 11. ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=222081092
This commit is contained in:
parent
02a23c6ca6
commit
f7e95e1ff1
2 changed files with 118 additions and 110 deletions
|
@ -1,23 +1,31 @@
|
|||
plugins {
|
||||
id 'java'
|
||||
id 'nebula.lint' version '10.1.2'
|
||||
id 'nebula.lint' version '10.3.1'
|
||||
|
||||
// Config helper for annotation processors such as AutoValue and Dagger.
|
||||
// Ensures that source code is generated at an appropriate location.
|
||||
id 'net.ltgt.apt' version '0.19'
|
||||
id 'net.ltgt.apt' version '0.19' apply false
|
||||
}
|
||||
|
||||
allprojects {
|
||||
// Only do linting if the build is successful.
|
||||
gradleLint.autoLintAfterFailure = false
|
||||
|
||||
// Paths to main and test sources.
|
||||
ext.javaDir = "${rootDir}/../java"
|
||||
ext.javatestsDir = "${rootDir}/../javatests"
|
||||
|
||||
subprojects {
|
||||
repositories {
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
version = '1.0'
|
||||
|
||||
apply plugin: 'java'
|
||||
|
||||
apply plugin: 'nebula.lint'
|
||||
apply plugin: 'net.ltgt.apt'
|
||||
|
||||
version = '1.0'
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
|
||||
gradleLint.rules = [
|
||||
// Checks if Gradle wrapper is up-to-date
|
||||
'archaic-wrapper',
|
||||
|
@ -28,16 +36,43 @@ allprojects {
|
|||
// TODO(weiminyu): enable more dependency checks
|
||||
]
|
||||
|
||||
apply plugin: 'net.ltgt.apt'
|
||||
}
|
||||
// Path to code generated with annotation processors. Note that this path is
|
||||
// chosen by the 'net.ltgt.apt' plugin, and may change if IDE-specific plugins
|
||||
// are applied, e.g., 'idea' or 'eclipse'
|
||||
def aptGeneratedDir = "${project.buildDir}/generated/source/apt/main"
|
||||
def aptGeneratedTestDir = "${project.buildDir}/generated/source/apt/test"
|
||||
|
||||
project(':core') {
|
||||
dependencies {
|
||||
// Custom-built objectify jar at commit ecd5165, included in Nomulus
|
||||
// release.
|
||||
implementation files(
|
||||
"${rootDir}/../third_party/objectify/v4_1/objectify-4.1.3.jar")
|
||||
testImplementation project(':third_party')
|
||||
if (project.name != 'third_party') {
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = [
|
||||
project(':').javaDir,
|
||||
aptGeneratedDir
|
||||
]
|
||||
exclude 'com/'
|
||||
}
|
||||
resources {
|
||||
srcDirs = [
|
||||
project(':').javaDir
|
||||
]
|
||||
exclude 'com/', '**/*.java', '**/BUILD'
|
||||
}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
srcDirs = [
|
||||
project(':').javatestsDir,
|
||||
aptGeneratedTestDir
|
||||
]
|
||||
}
|
||||
resources {
|
||||
srcDirs = [
|
||||
project(':').javatestsDir,
|
||||
]
|
||||
exclude '**/*.java', '**/BUILD'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,6 @@ plugins {
|
|||
id 'java-library'
|
||||
}
|
||||
|
||||
def javaDir = "${rootDir}/../java"
|
||||
def javatestsDir = "${rootDir}/../javatests"
|
||||
|
||||
// Path to code generated with annotation processors. Note that this path is
|
||||
// chosen by the 'net.ltgt.apt' plugin, and may change if IDE-specific plugins
|
||||
// are applied, e.g., 'idea' or 'eclipse'
|
||||
def aptGeneratedDir = "${project.buildDir}/generated/source/apt/main"
|
||||
def aptGeneratedTestDir = "${project.buildDir}/generated/source/apt/test"
|
||||
|
||||
// Path to code generated by ad hoc tasks in this project. A separate path is
|
||||
// used for easy inspection.
|
||||
def generatedDir = "${project.buildDir}/generated/source/custom/main"
|
||||
|
@ -41,43 +32,18 @@ def fragileTestPatterns = [
|
|||
"google/registry/cron/TldFanoutActionTest.*"
|
||||
]
|
||||
|
||||
// Test source directories shared by all test suites.
|
||||
def testSourceDirs = [
|
||||
"${javatestsDir}",
|
||||
"${aptGeneratedTestDir}"
|
||||
]
|
||||
|
||||
// Test resource directories shared by all test suites.
|
||||
def testResourceDirs = [
|
||||
"${javatestsDir}"
|
||||
]
|
||||
|
||||
// Exclusion pattern for test source directories shared by all test suites.
|
||||
def testResourceExclude = ['**/*.java', '**/*.xsd', '**/*.xjb']
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
java {
|
||||
srcDirs = [
|
||||
"${javaDir}",
|
||||
"${aptGeneratedDir}",
|
||||
"${generatedDir}"
|
||||
]
|
||||
srcDirs += generatedDir
|
||||
}
|
||||
resources {
|
||||
srcDirs = [
|
||||
"${javaDir}"
|
||||
]
|
||||
exclude '**/*.java', '**/*.xjb'
|
||||
exclude '**/*.xjb'
|
||||
}
|
||||
}
|
||||
test {
|
||||
java {
|
||||
srcDirs testSourceDirs
|
||||
}
|
||||
resources {
|
||||
srcDirs testResourceDirs
|
||||
exclude testResourceExclude
|
||||
exclude '**/*.xjb', '**/*.xsd'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -89,7 +55,7 @@ configurations {
|
|||
// Label for all dependencies inherited from Bazel build but not used in
|
||||
// either compile or testRuntime. However, they may be needed at runtime.
|
||||
// TODO(weiminyu): identify runtime dependencies and remove the rest.
|
||||
maybe_runtime
|
||||
maybeRuntime
|
||||
}
|
||||
|
||||
// Known issues:
|
||||
|
@ -105,22 +71,28 @@ configurations {
|
|||
// See https://github.com/nebula-plugins/gradle-lint-plugin/issues/181 for
|
||||
// issue status.
|
||||
dependencies {
|
||||
// Custom-built objectify jar at commit ecd5165, included in Nomulus
|
||||
// release.
|
||||
implementation files(
|
||||
"${rootDir}/../third_party/objectify/v4_1/objectify-4.1.3.jar")
|
||||
testImplementation project(':third_party')
|
||||
|
||||
compile 'com.beust:jcommander:1.48'
|
||||
compile 'com.fasterxml.jackson.core:jackson-core:2.8.5'
|
||||
compile 'com.fasterxml.jackson.core:jackson-annotations:2.8.0'
|
||||
compile 'com.fasterxml.jackson.core:jackson-databind:2.8.5'
|
||||
compile 'com.google.api-client:google-api-client:1.22.0'
|
||||
maybe_runtime 'com.google.api-client:google-api-client-appengine:1.22.0'
|
||||
maybe_runtime 'com.google.api-client:google-api-client-jackson2:1.20.0'
|
||||
maybeRuntime 'com.google.api-client:google-api-client-appengine:1.22.0'
|
||||
maybeRuntime 'com.google.api-client:google-api-client-jackson2:1.20.0'
|
||||
compile 'com.google.monitoring-client:metrics:1.0.4'
|
||||
compile 'com.google.monitoring-client:stackdriver:1.0.4'
|
||||
maybe_runtime 'com.google.api-client:google-api-client-java6:1.20.0'
|
||||
maybe_runtime 'com.google.api-client:google-api-client-servlet:1.22.0'
|
||||
maybeRuntime 'com.google.api-client:google-api-client-java6:1.20.0'
|
||||
maybeRuntime 'com.google.api-client:google-api-client-servlet:1.22.0'
|
||||
compile 'com.google.apis:google-api-services-admin-directory:directory_v1-rev72-1.22.0'
|
||||
compile 'com.google.apis:google-api-services-bigquery:v2-rev325-1.22.0'
|
||||
maybe_runtime 'com.google.apis:google-api-services-clouddebugger:v2-rev8-1.22.0'
|
||||
maybeRuntime 'com.google.apis:google-api-services-clouddebugger:v2-rev8-1.22.0'
|
||||
compile 'com.google.apis:google-api-services-cloudkms:v1-rev12-1.22.0'
|
||||
maybe_runtime 'com.google.apis:google-api-services-cloudresourcemanager:v1-rev6-1.22.0'
|
||||
maybeRuntime 'com.google.apis:google-api-services-cloudresourcemanager:v1-rev6-1.22.0'
|
||||
compile 'com.google.apis:google-api-services-dataflow:v1b3-rev196-1.22.0'
|
||||
compile 'com.google.apis:google-api-services-dns:v2beta1-rev6-1.22.0'
|
||||
compile 'com.google.apis:google-api-services-drive:v2-rev160-1.19.1'
|
||||
|
@ -131,30 +103,30 @@ dependencies {
|
|||
// TODO(b/71631624): change appengine:appengine-api-1.0-sdk to
|
||||
// testCompileOnly after BillingEmailUtilsTest.java is fixed.
|
||||
compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.48'
|
||||
maybe_runtime 'com.google.appengine:appengine-api-labs:1.9.48'
|
||||
maybe_runtime 'com.google.appengine:appengine-api-stubs:1.9.48'
|
||||
maybeRuntime 'com.google.appengine:appengine-api-labs:1.9.48'
|
||||
maybeRuntime 'com.google.appengine:appengine-api-stubs:1.9.48'
|
||||
testCompile 'com.google.appengine:appengine-api-stubs:1.9.48'
|
||||
compile 'com.google.appengine.tools:appengine-gcs-client:0.6'
|
||||
compile 'com.google.appengine.tools:appengine-mapreduce:0.8.5'
|
||||
compile 'com.google.appengine.tools:appengine-pipeline:0.2.13'
|
||||
compile 'com.google.appengine:appengine-remote-api:1.9.48'
|
||||
maybe_runtime 'com.google.appengine:appengine-tools-sdk:1.9.48'
|
||||
maybe_runtime 'com.google.auth:google-auth-library-credentials:0.7.1'
|
||||
maybe_runtime 'com.google.auth:google-auth-library-oauth2-http:0.7.1'
|
||||
maybe_runtime 'com.google.auto:auto-common:0.8'
|
||||
maybe_runtime 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||
maybeRuntime 'com.google.appengine:appengine-tools-sdk:1.9.48'
|
||||
maybeRuntime 'com.google.auth:google-auth-library-credentials:0.7.1'
|
||||
maybeRuntime 'com.google.auth:google-auth-library-oauth2-http:0.7.1'
|
||||
maybeRuntime 'com.google.auto:auto-common:0.8'
|
||||
maybeRuntime 'com.google.auto.factory:auto-factory:1.0-beta3'
|
||||
compile 'com.google.auto.value:auto-value-annotations:1.6.2'
|
||||
maybe_runtime 'com.google.cloud.bigdataoss:gcsio:1.4.5'
|
||||
maybe_runtime 'com.google.cloud.bigdataoss:util:1.4.5'
|
||||
maybeRuntime 'com.google.cloud.bigdataoss:gcsio:1.4.5'
|
||||
maybeRuntime 'com.google.cloud.bigdataoss:util:1.4.5'
|
||||
compile 'com.google.code.findbugs:jsr305:3.0.2'
|
||||
compile 'com.google.dagger:dagger:2.15'
|
||||
maybe_runtime 'com.google.dagger:dagger-producers:2.15'
|
||||
maybeRuntime 'com.google.dagger:dagger-producers:2.15'
|
||||
compile 'com.google.errorprone:error_prone_annotations:2.3.1'
|
||||
maybe_runtime 'com.google.errorprone:javac-shaded:9-dev-r4023-3'
|
||||
maybeRuntime 'com.google.errorprone:javac-shaded:9-dev-r4023-3'
|
||||
compile 'com.google.flogger:flogger:0.1'
|
||||
runtime 'com.google.flogger:flogger-system-backend:0.1'
|
||||
maybe_runtime 'com.google.gdata:core:1.47.1'
|
||||
maybe_runtime 'com.google.googlejavaformat:google-java-format:1.4'
|
||||
maybeRuntime 'com.google.gdata:core:1.47.1'
|
||||
maybeRuntime 'com.google.googlejavaformat:google-java-format:1.4'
|
||||
compile 'com.google.guava:guava-jdk5:17.0'
|
||||
compile 'com.google.guava:guava:25.1-jre'
|
||||
gradleLint.ignore('unused-dependency') {
|
||||
|
@ -164,84 +136,85 @@ dependencies {
|
|||
compile 'com.google.http-client:google-http-client-appengine:1.22.0'
|
||||
compile 'com.google.http-client:google-http-client-jackson2:1.22.0'
|
||||
compile 'com.google.oauth-client:google-oauth-client:1.22.0'
|
||||
maybe_runtime 'com.google.oauth-client:google-oauth-client-appengine:1.22.0'
|
||||
maybeRuntime 'com.google.oauth-client:google-oauth-client-appengine:1.22.0'
|
||||
compile 'com.google.oauth-client:google-oauth-client-java6:1.22.0'
|
||||
compile 'com.google.oauth-client:google-oauth-client-jetty:1.22.0'
|
||||
maybe_runtime 'com.google.oauth-client:google-oauth-client-servlet:1.22.0'
|
||||
maybe_runtime 'com.google.protobuf:protobuf-java:2.6.0'
|
||||
maybeRuntime 'com.google.oauth-client:google-oauth-client-servlet:1.22.0'
|
||||
maybeRuntime 'com.google.protobuf:protobuf-java:2.6.0'
|
||||
compile 'com.google.re2j:re2j:1.1'
|
||||
compile 'com.google.template:soy:2018-03-14'
|
||||
maybe_runtime 'com.googlecode.charts4j:charts4j:1.3'
|
||||
maybeRuntime 'com.googlecode.charts4j:charts4j:1.3'
|
||||
compile 'com.googlecode.json-simple:json-simple:1.1.1'
|
||||
compile 'com.ibm.icu:icu4j:57.1'
|
||||
compile 'com.jcraft:jsch:0.1.53'
|
||||
maybe_runtime 'com.jcraft:jzlib:1.1.3'
|
||||
maybe_runtime 'com.squareup:javapoet:1.8.0'
|
||||
maybe_runtime 'com.squareup:javawriter:2.5.1'
|
||||
maybe_runtime 'com.sun.activation:javax.activation:1.2.0'
|
||||
maybe_runtime 'com.thoughtworks.paranamer:paranamer:2.7'
|
||||
maybe_runtime 'commons-codec:commons-codec:1.6'
|
||||
maybe_runtime 'commons-logging:commons-logging:1.1.1'
|
||||
maybeRuntime 'com.jcraft:jzlib:1.1.3'
|
||||
maybeRuntime 'com.squareup:javapoet:1.8.0'
|
||||
maybeRuntime 'com.squareup:javawriter:2.5.1'
|
||||
maybeRuntime 'com.sun.activation:javax.activation:1.2.0'
|
||||
maybeRuntime 'com.thoughtworks.paranamer:paranamer:2.7'
|
||||
maybeRuntime 'commons-codec:commons-codec:1.6'
|
||||
maybeRuntime 'commons-logging:commons-logging:1.1.1'
|
||||
compile 'dnsjava:dnsjava:2.1.7'
|
||||
compile 'io.netty:netty-buffer:4.1.28.Final'
|
||||
compile 'io.netty:netty-codec:4.1.28.Final'
|
||||
compile 'io.netty:netty-codec-http:4.1.28.Final'
|
||||
compile 'io.netty:netty-common:4.1.28.Final'
|
||||
compile 'io.netty:netty-handler:4.1.28.Final'
|
||||
maybe_runtime 'io.netty:netty-resolver:4.1.28.Final'
|
||||
maybe_runtime 'io.netty:netty-tcnative:2.0.12.Final'
|
||||
maybe_runtime 'io.netty:netty-tcnative-boringssl-static:2.0.12.Final'
|
||||
maybeRuntime 'io.netty:netty-resolver:4.1.28.Final'
|
||||
maybeRuntime 'io.netty:netty-tcnative:2.0.12.Final'
|
||||
maybeRuntime 'io.netty:netty-tcnative-boringssl-static:2.0.12.Final'
|
||||
compile 'io.netty:netty-transport:4.1.28.Final'
|
||||
maybe_runtime 'it.unimi.dsi:fastutil:6.5.16'
|
||||
maybe_runtime 'javax.annotation:jsr250-api:1.0'
|
||||
maybeRuntime 'it.unimi.dsi:fastutil:6.5.16'
|
||||
maybeRuntime 'javax.annotation:jsr250-api:1.0'
|
||||
runtime 'org.glassfish.jaxb:jaxb-runtime:2.3.0'
|
||||
testCompile 'javax.annotation:jsr250-api:1.0'
|
||||
compile 'javax.inject:javax.inject:1'
|
||||
compile 'javax.mail:mail:1.4'
|
||||
compile 'javax.servlet:servlet-api:2.5'
|
||||
compile 'javax.xml.bind:jaxb-api:2.3.0'
|
||||
maybe_runtime 'javax.xml.soap:javax.xml.soap-api:1.4.0'
|
||||
maybeRuntime 'javax.xml.soap:javax.xml.soap-api:1.4.0'
|
||||
compile 'jline:jline:1.0'
|
||||
compile 'joda-time:joda-time:2.3'
|
||||
compile 'org.apache.avro:avro:1.8.2'
|
||||
maybe_runtime 'org.apache.beam:beam-runners-direct-java:2.2.0'
|
||||
maybeRuntime 'org.apache.beam:beam-runners-direct-java:2.2.0'
|
||||
testCompile 'org.apache.beam:beam-runners-direct-java:2.2.0'
|
||||
compile 'org.apache.beam:beam-runners-google-cloud-dataflow-java:2.1.0'
|
||||
maybe_runtime 'org.apache.beam:beam-sdks-common-runner-api:2.1.0'
|
||||
maybeRuntime 'org.apache.beam:beam-sdks-common-runner-api:2.1.0'
|
||||
compile 'org.apache.beam:beam-sdks-java-core:2.2.0'
|
||||
compile 'org.apache.beam:beam-sdks-java-extensions-google-cloud-platform-core:2.1.0'
|
||||
compile 'org.apache.beam:beam-sdks-java-io-google-cloud-platform:2.2.0'
|
||||
maybe_runtime 'org.apache.commons:commons-compress:1.8.1'
|
||||
maybe_runtime 'org.apache.ftpserver:ftplet-api:1.0.6'
|
||||
maybeRuntime 'org.apache.commons:commons-compress:1.8.1'
|
||||
maybeRuntime 'org.apache.ftpserver:ftplet-api:1.0.6'
|
||||
testCompile 'org.apache.ftpserver:ftplet-api:1.0.6'
|
||||
maybe_runtime 'org.apache.ftpserver:ftpserver-core:1.0.6'
|
||||
maybeRuntime 'org.apache.ftpserver:ftpserver-core:1.0.6'
|
||||
testCompile 'org.apache.ftpserver:ftpserver-core:1.0.6'
|
||||
compile 'org.apache.httpcomponents:httpclient:4.5.2'
|
||||
compile 'org.apache.httpcomponents:httpcore:4.4.4'
|
||||
maybe_runtime 'org.apache.mina:mina-core:2.0.4'
|
||||
maybe_runtime 'org.apache.sshd:sshd-core:2.0.0'
|
||||
maybeRuntime 'org.apache.mina:mina-core:2.0.4'
|
||||
maybeRuntime 'org.apache.sshd:sshd-core:2.0.0'
|
||||
testCompile 'org.apache.sshd:sshd-core:2.0.0'
|
||||
maybe_runtime 'org.apache.sshd:sshd-scp:2.0.0'
|
||||
maybeRuntime 'org.apache.sshd:sshd-scp:2.0.0'
|
||||
testCompile 'org.apache.sshd:sshd-scp:2.0.0'
|
||||
maybe_runtime 'org.apache.sshd:sshd-sftp:2.0.0'
|
||||
maybeRuntime 'org.apache.sshd:sshd-sftp:2.0.0'
|
||||
testCompile 'org.apache.sshd:sshd-sftp:2.0.0'
|
||||
compile 'org.apache.tomcat:servlet-api:6.0.45'
|
||||
maybe_runtime 'org.apache.tomcat:tomcat-annotations-api:8.0.5'
|
||||
maybeRuntime 'org.apache.tomcat:tomcat-annotations-api:8.0.5'
|
||||
testCompile 'org.apache.tomcat:tomcat-annotations-api:8.0.5'
|
||||
compile 'org.bouncycastle:bcpg-jdk15on:1.52'
|
||||
compile 'org.bouncycastle:bcpkix-jdk15on:1.52'
|
||||
compile 'org.bouncycastle:bcprov-jdk15on:1.52'
|
||||
maybe_runtime 'org.codehaus.jackson:jackson-core-asl:1.9.13'
|
||||
maybe_runtime 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
|
||||
maybeRuntime 'org.codehaus.jackson:jackson-core-asl:1.9.13'
|
||||
maybeRuntime 'org.codehaus.jackson:jackson-mapper-asl:1.9.13'
|
||||
compile 'org.joda:joda-money:0.10.0'
|
||||
compile 'org.json:json:20160810'
|
||||
maybe_runtime 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
|
||||
maybe_runtime 'org.mortbay.jetty:jetty:6.1.26'
|
||||
maybeRuntime 'org.khronos:opengl-api:gl1.1-android-2.1_r1'
|
||||
maybeRuntime 'org.mortbay.jetty:jetty:6.1.26'
|
||||
testCompile 'org.mortbay.jetty:jetty:6.1.26'
|
||||
compile 'org.mortbay.jetty:servlet-api:2.5-20081211'
|
||||
maybe_runtime 'org.mortbay.jetty:jetty-util:6.1.26'
|
||||
maybe_runtime 'org.slf4j:slf4j-api:1.7.16'
|
||||
maybe_runtime 'org.tukaani:xz:1.5'
|
||||
maybe_runtime 'org.xerial.snappy:snappy-java:1.1.4-M3'
|
||||
maybeRuntime 'org.mortbay.jetty:jetty-util:6.1.26'
|
||||
maybeRuntime 'org.slf4j:slf4j-api:1.7.16'
|
||||
maybeRuntime 'org.tukaani:xz:1.5'
|
||||
maybeRuntime 'org.xerial.snappy:snappy-java:1.1.4-M3'
|
||||
compile 'org.yaml:snakeyaml:1.17'
|
||||
compile 'xerces:xmlParserAPIs:2.6.2'
|
||||
compile 'xpp3:xpp3:1.1.4c'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue