From d52f883453ead747a1247e8089c58d68799f4c1d Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 3 Jan 2013 22:45:20 -0800 Subject: [PATCH 1/2] Add test dependencies sources for testCompile Update the TestSourceSetDependenciesPlugin to consider testCompile configurations. --- .../build/gradle/TestSourceSetDependenciesPlugin.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy b/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy index 363c66c00f..6cb6421273 100644 --- a/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy +++ b/buildSrc/src/main/groovy/org/springframework/build/gradle/TestSourceSetDependenciesPlugin.groovy @@ -43,7 +43,7 @@ class TestSourceSetDependenciesPlugin implements Plugin { private void collectProjectDependencies(Set projectDependencies, Project project) { - for(def configurationName in ["compile", "optional", "provided"]) { + for(def configurationName in ["compile", "optional", "provided", "testCompile"]) { Configuration configuration = project.getConfigurations().findByName(configurationName) if(configuration) { configuration.dependencies.findAll { it instanceof ProjectDependency }.each { From 16a3a8bda82f0c1ecba55f741d872c0e630b1e6e Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Thu, 3 Jan 2013 22:47:11 -0800 Subject: [PATCH 2/2] Polish test sourceSet dependencies Remove all direct sourceSets.test.output dependencies and instead rely on the 'test-source-set-dependencies' plugin. This commit also updates the api JavaDoc task to ensure that dependencies are not resolved too early. --- build.gradle | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 071fdc3d61..c1ddba9033 100644 --- a/build.gradle +++ b/build.gradle @@ -603,7 +603,6 @@ project("spring-webmvc") { testCompile("commons-io:commons-io:1.3") testCompile("org.hibernate:hibernate-validator:4.3.0.Final") testCompile("org.apache.httpcomponents:httpclient:4.2") - testCompile(project(":spring-web").sourceSets.test.output) } // pick up DispatcherServlet.properties in src/main @@ -615,6 +614,7 @@ project("spring-webmvc-tiles3") { merge.into = project(":spring-webmvc") dependencies { compile(project(":spring-context")) + compile(project(":spring-web")) provided("javax.el:el-api:1.0") provided("javax.servlet:jstl:1.2") provided("javax.servlet.jsp:jsp-api:2.1") @@ -633,7 +633,6 @@ project("spring-webmvc-tiles3") { exclude group: "org.slf4j", module: "jcl-over-slf4j" } provided("javax.servlet:javax.servlet-api:3.0.1") - compile(project(":spring-web").sourceSets*.output) // mock request & response testCompile("org.slf4j:slf4j-jcl:${slf4jVersion}") } } @@ -777,7 +776,6 @@ configure(rootProject) { dependencies { // for integration tests testCompile(project(":spring-core")) - testCompile(project(":spring-core").sourceSets.test.output) testCompile(project(":spring-beans")) testCompile(project(":spring-aop")) testCompile(project(":spring-expression")) @@ -813,18 +811,20 @@ configure(rootProject) { project.sourceSets.main.allJava } - classpath = files( - // ensure servlet 3.x and Hibernate 4.x have precedence on the Javadoc - // classpath over their respective 2.5 and 3.x variants - project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" }, - rootProject.sourceSets.test.compileClasspath.files.find { it =~ "hibernate-core" }, - // ensure the javadoc process can resolve types compiled from .aj sources - project(":spring-aspects").sourceSets.main.output - ) - classpath += files(subprojects.collect { it.sourceSets.main.compileClasspath }) - maxMemory = "1024m" destinationDir = new File(buildDir, "api") + + doFirst { + classpath = files( + // ensure servlet 3.x and Hibernate 4.x have precedence on the Javadoc + // classpath over their respective 2.5 and 3.x variants + project(":spring-webmvc").sourceSets.main.compileClasspath.files.find { it =~ "servlet-api" }, + rootProject.sourceSets.test.compileClasspath.files.find { it =~ "hibernate-core" }, + // ensure the javadoc process can resolve types compiled from .aj sources + project(":spring-aspects").sourceSets.main.output + ) + classpath += files(subprojects.collect { it.sourceSets.main.compileClasspath }) + } } task docsZip(type: Zip) {