From 8429135370c572b6ec9104b316808b43c5e5a157 Mon Sep 17 00:00:00 2001 From: Chris Beams Date: Mon, 29 Nov 2010 00:52:22 -0700 Subject: [PATCH] Eliminate all unintentional output during build Redirect all stdout for the test task to LogLevel.INFO, effectively suppressing it from the default LogLevel of LIFECYCLE. Gradle actually does this redirection during testing anyway, but for non-main threads that exit after the test task has completed, their output makes its way to the console. This is why, prior to this commit verbose 'intentional test failure' stack traces could be seen polluting the console. Also tuned the Xlint flags to javac on a project-by-project basis. Only those projects that have spurious path warnings get '-path'; only those projects with spurious deprecation warnings get '-deprecation', and so on. This way, there's no blanket policy applied too liberally to all projects; if path or deprecation errors crop up in a different module, folks should see them rather than having them automatically suppressed. --- build.gradle | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 42ade5cd4f..0a3d7bf814 100644 --- a/build.gradle +++ b/build.gradle @@ -143,14 +143,20 @@ configure(javaprojects) { testCompile "org.springframework:spring-test:$springVersion" } - // enable all compiler warnings (GRADLE-1077); eliminate path warnings - [compileJava, compileTestJava]*.options*.compilerArgs = ['-Xlint:all,-path'] + // enable all compiler warnings; individual projects may customize further + xLintArg = '-Xlint:all' + [compileJava, compileTestJava]*.options*.compilerArgs = [xLintArg] // generate .classpath files without GRADLE_CACHE variable (GRADLE-1079) eclipseClasspath.variables = [:] // Tie pom generation into the standard build lifecycle (INT-1609) assemble.dependsOn generatePom + + test { + // suppress all console output during testing unless running `gradle -i` + logging.captureStandardOutput(LogLevel.INFO) + } } @@ -271,6 +277,9 @@ project('spring-integration-jdbc') { testCompile "org.aspectj:aspectjrt:$aspectjVersion" testCompile "org.aspectj:aspectjweaver:$aspectjVersion" } + + // suppress derby localization jar path warnings during test compilation + compileTestJava.options.compilerArgs = ["${xLintArg},-path"] } project('spring-integration-jms') { @@ -306,6 +315,9 @@ project('spring-integration-mail') { compile("javax.activation:activation:$javaxActivationVersion") { optional = true } testCompile project(":spring-integration-test") } + + // suppress javax.activation path warnings + [compileJava,compileTestJava]*.options*.compilerArgs = ["${xLintArg},-path"] } project('spring-integration-rmi') { @@ -315,8 +327,12 @@ project('spring-integration-rmi') { compile "org.springframework:spring-aop:$springVersion" compile "org.springframework:spring-context:$springVersion" } + + // suppress deprecation warnings (@SuppressWarnings("deprecation") is not enough for javac) + compileJava.options.compilerArgs = ["${xLintArg},-deprecation"] } + project('spring-integration-security') { description = 'Spring Integration Security Support' dependencies { @@ -389,6 +405,9 @@ project('spring-integration-ws') { compile("javax.activation:activation:$javaxActivationVersion") { optional = true } testCompile project(":spring-integration-test") } + + // suppress saaj path warnings + [compileJava,compileTestJava]*.options*.compilerArgs = ["${xLintArg},-path"] } project('spring-integration-xml') { @@ -415,6 +434,9 @@ project('spring-integration-xmpp') { testCompile project(":spring-integration-test") testCompile project(":spring-integration-stream") } + + // suppress smack path warnings + [compileJava,compileTestJava]*.options*.compilerArgs = ["${xLintArg},-path"] } // -----------------------------------------------------------------------------