diff --git a/gradle/build.gradle b/gradle/build.gradle index 3f1c7df1e..4ec958b21 100644 --- a/gradle/build.gradle +++ b/gradle/build.gradle @@ -36,43 +36,65 @@ subprojects { // TODO(weiminyu): enable more dependency checks ] + if (project.name == 'third_party') return + // 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" - if (project.name != 'third_party') { - sourceSets { - main { - java { - srcDirs = [ - project(':').javaDir, - aptGeneratedDir - ] - exclude 'com/' - } - resources { - srcDirs = [ - project(':').javaDir - ] - exclude 'com/', '**/*.java', '**/BUILD' - } + def commonlyExcludedResources = ['**/*.java', '**/BUILD'] + + sourceSets { + main { + java { + srcDirs = [ + project(':').javaDir, + aptGeneratedDir + ] } - test { - java { - srcDirs = [ - project(':').javatestsDir, - aptGeneratedTestDir - ] - } - resources { - srcDirs = [ - project(':').javatestsDir, - ] - exclude '**/*.java', '**/BUILD' - } + resources { + srcDirs = [ + project(':').javaDir + ] + exclude commonlyExcludedResources + } + } + test { + java { + srcDirs = [ + project(':').javatestsDir, + aptGeneratedTestDir + ] + } + resources { + srcDirs = [ + project(':').javatestsDir, + ] + exclude commonlyExcludedResources } } } + + if (project.name == 'core') return + + def relativePath = "google/registry/${project.name}/" + + sourceSets.each { + it.java { + include relativePath + } + it.resources { + include relativePath + } + } + project(':core').sourceSets.each { + it.java { + exclude relativePath + } + it.resources { + exclude relativePath + } + } } diff --git a/gradle/core/build.gradle b/gradle/core/build.gradle index 6fb06cba8..969ddd5dd 100644 --- a/gradle/core/build.gradle +++ b/gradle/core/build.gradle @@ -145,7 +145,6 @@ dependencies { compile 'com.google.template:soy:2018-03-14' 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' maybeRuntime 'com.jcraft:jzlib:1.1.3' maybeRuntime 'com.squareup:javapoet:1.8.0' @@ -216,11 +215,17 @@ dependencies { maybeRuntime 'org.tukaani:xz:1.5' maybeRuntime 'org.xerial.snappy:snappy-java:1.1.4-M3' compile 'org.yaml:snakeyaml:1.17' + 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' + testCompile 'org.yaml:snakeyaml:1.17' compile 'xerces:xmlParserAPIs:2.6.2' compile 'xpp3:xpp3:1.1.4c' // Known issue: nebula-lint misses inherited dependency. compile project(':third_party') + compile project(':util') // Include auto-value in compile until nebula-lint understands // annotationProcessor @@ -232,9 +237,7 @@ dependencies { annotationProcessor 'com.google.dagger:dagger-compiler:2.15' testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.15' - // Use compile to work around nebula bug. This should be testCompile. - compile 'com.google.appengine:appengine-testing:1.9.58' - + testCompile 'com.google.appengine:appengine-testing:1.9.58' testCompile 'com.google.guava:guava-testlib:25.0-jre' testCompile 'com.google.monitoring-client:contrib:1.0.4' testCompile 'com.google.truth:truth:0.42' @@ -406,6 +409,17 @@ compileJava.dependsOn soyToJava stylesheetsToJavascript.dependsOn processResources classes.dependsOn stylesheetsToJavascript +// Make testing artifacts available to be depended up on by other projects. +// TODO: factor out google.registry.testing to be a separate project. +task testJar(type: Jar) { + classifier = 'test' + from sourceSets.test.output +} + +artifacts { + testRuntime testJar +} + task fragileTest(type: Test) { // Common exclude pattern. See README in parent directory for explanation. exclude "**/*TestCase.*", "**/*TestSuite.*" diff --git a/gradle/settings.gradle b/gradle/settings.gradle index 3a9c6015f..3f02f24e4 100644 --- a/gradle/settings.gradle +++ b/gradle/settings.gradle @@ -1,5 +1,6 @@ rootProject.name = 'nomulus' -include 'third_party' include 'core' +include 'third_party' +include 'util' diff --git a/gradle/util/build.gradle b/gradle/util/build.gradle new file mode 100644 index 000000000..2151600bc --- /dev/null +++ b/gradle/util/build.gradle @@ -0,0 +1,29 @@ +dependencies { + compile 'com.google.appengine:appengine-api-1.0-sdk:1.9.48' + compile 'com.google.appengine:appengine-testing:1.9.58' + compile 'com.google.code.findbugs:jsr305:3.0.2' + compile 'com.google.dagger:dagger:2.15' + compile 'com.google.flogger:flogger:0.1' + compile 'com.google.guava:guava-jdk5:17.0' + compile 'com.google.guava:guava:25.1-jre' + compile 'com.google.re2j:re2j:1.1' + compile 'com.ibm.icu:icu4j:57.1' + compile 'javax.inject:javax.inject:1' + compile 'javax.mail:mail:1.4' + compile 'javax.xml.bind:jaxb-api:2.3.0' + compile 'joda-time:joda-time:2.9.2' + compile 'nomulus:util:1.0' + compile 'org.yaml:snakeyaml:1.17' + testCompile 'com.google.appengine:appengine-api-stubs:1.9.48' + testCompile 'com.google.guava:guava-testlib:25.0-jre' + testCompile 'com.google.truth:truth:0.42' + testCompile 'junit:junit:4.12' + testCompile 'org.hamcrest:hamcrest-all:1.3' + testCompile 'org.hamcrest:hamcrest-core:1.3' + testCompile 'org.mockito:mockito-all:1.9.5' + testCompile files("${rootDir}/../third_party/objectify/v4_1/objectify-4.1.3.jar") + testCompile project(':third_party') + testCompile project(path: ':core', configuration: 'testRuntime') + annotationProcessor 'com.google.dagger:dagger-compiler:2.15' + testAnnotationProcessor 'com.google.dagger:dagger-compiler:2.15' +}