Skip to content

Commit 04bd398

Browse files
committed
fix: Apply test sources compiler settings via common compilerConfiguration
1 parent 79cf261 commit 04bd398

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

gradle/java_no_deps.gradle

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -84,18 +84,17 @@ class TracerJavaExtension {
8484
(it as SourceSet).java.srcDirs = ["${project.projectDir}/src/${SourceSet.MAIN_SOURCE_SET_NAME}/$name"]
8585
}
8686

87+
// TODO Make 'configureCompiler' a general utility method
88+
def configureCompilerCl = project.extensions.getByType(ExtraPropertiesExtension).get("configureCompiler") as Closure
8789
project.tasks.named(mainForJavaVersionSourceSet.compileJavaTaskName, JavaCompile) {
88-
// TODO Make 'configureCompiler' a general utility method
89-
def cl = project.extensions.getByType(ExtraPropertiesExtension).get("configureCompiler") as Closure
90-
cl.call(it, version.majorVersion.toInteger().intValue(), version)
90+
configureCompilerCl.call(it, version.majorVersion.toInteger().intValue(), version)
9191
}
9292

9393
if (sourceSetConfig.applyForTestSources.orElse(true)) {
9494
// configures all test tasks
9595
project.tasks.withType(JavaCompile).configureEach {
9696
if (it.name.toLowerCase().contains("test")) {
97-
it.sourceCompatibility = version
98-
it.targetCompatibility = version
97+
configureCompilerCl.call(it, version.majorVersion.toInteger().intValue(), version)
9998
}
10099
}
101100
}

0 commit comments

Comments
 (0)