From 8200f08da0cf24de21bb918cb51f70a494a5cf1a Mon Sep 17 00:00:00 2001 From: Tal Moran Date: Sun, 22 Nov 2015 15:31:51 +0200 Subject: [PATCH] Add configuration for test dependencies between subprojects --- build.gradle-template | 15 +++++++++++++++ bulletin-board-server/build.gradle | 3 +++ meerkat-common/build.gradle | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) diff --git a/build.gradle-template b/build.gradle-template index 14cb9dd..60ec7c9 100644 --- a/build.gradle-template +++ b/build.gradle-template @@ -57,6 +57,21 @@ dependencies { /*==== You probably don't have to edit below this line =======*/ +// Setup test configuration that can appear as a dependency in +// other subprojects +configurations { + testOutput.extendsFrom (testCompile) +} + +task testJar(type: Jar, dependsOn: testClasses) { + classifier = 'tests' + from sourceSets.test.output +} + +artifacts { + testOutput testJar +} + // The run task added by the application plugin // is also of type JavaExec. tasks.withType(JavaExec) { diff --git a/bulletin-board-server/build.gradle b/bulletin-board-server/build.gradle index 536673c..2bf9d56 100644 --- a/bulletin-board-server/build.gradle +++ b/bulletin-board-server/build.gradle @@ -55,6 +55,9 @@ dependencies { // Google protobufs compile 'com.google.protobuf:protobuf-java:3.+' + // Depend on test resources from meerkat-common + testCompile project(path: ':meerkat-common', configuration: 'testOutput') + testCompile 'junit:junit:4.+' runtime 'org.codehaus.groovy:groovy:2.4.+' diff --git a/meerkat-common/build.gradle b/meerkat-common/build.gradle index 236bd82..d464a31 100644 --- a/meerkat-common/build.gradle +++ b/meerkat-common/build.gradle @@ -58,6 +58,23 @@ dependencies { /*==== You probably don't have to edit below this line =======*/ +// Setup test configuration that can appear as a dependency in +// other subprojects +configurations { + testOutput.extendsFrom (testCompile) +} + +task testJar(type: Jar, dependsOn: testClasses) { + classifier = 'tests' + from sourceSets.test.output +} + +artifacts { + testOutput testJar +} + + + // The run task added by the application plugin // is also of type JavaExec. tasks.withType(JavaExec) {