From 6dcb8028ff88bbad2b032435b8e49ae1caeca3b6 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 12 Apr 2019 17:35:32 +0100 Subject: [PATCH] =?utf8?q?JAL-3130=20instrument=20main=20and=20compile=20sep?= =?utf8?q?arately=20to=20test=20classes=20so=20Clover=20doesn=E2=80=99t=20mi?= =?utf8?q?sclassify=20them?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- build.gradle | 53 +++++++++++++++++++++++++++++------------------------ 1 file changed, 29 insertions(+), 24 deletions(-) diff --git a/build.gradle b/build.gradle index c6f86d6..ed8a9ab 100644 --- a/build.gradle +++ b/build.gradle @@ -61,7 +61,7 @@ sourceSets { clover { java { srcDirs = [ cloverInstrDir ] - outputDir = file("$jalviewDir/$testOutputDir") + outputDir = file("${buildDir}/clover-classes") } resources { @@ -80,7 +80,7 @@ sourceSets { test { java { - srcDirs = [ cloverInstrDir ] + srcDirs "$jalviewDir/$testSourceDir" outputDir = file("$jalviewDir/$testOutputDir") } @@ -89,7 +89,10 @@ sourceSets { } - compileClasspath += configurations.cloverRuntime + files( sourceSets.test.java.outputDir ) + compileClasspath = configurations.cloverRuntime + compileClasspath += files( sourceSets.test.java.outputDir ) + compileClasspath += files( sourceSets.clover.java.outputDir ) + compileClasspath += files( sourceSets.main.resources.srcDirs) compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"]) compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"]) if (JAVA_VERSION.equals("1.8")) { @@ -113,7 +116,8 @@ configurations { } task cloverInstr() { - inputs.files files (sourceSets.main.allJava, fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"])) + // only instrument source, we build test classes as normal + inputs.files files (sourceSets.main.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"])) outputs.dir cloverInstrDir doFirst { @@ -130,6 +134,7 @@ task cloverInstr() { } test.dependsOn cloverInstr + task cloverReport { inputs.dir "${buildDir}/clover" @@ -169,7 +174,7 @@ compileJava { } compileTestJava { - + dependsOn compileCloverJava doFirst { if (JAVA_VERSION.equals("1.8")) { sourceCompatibility = 1.8 @@ -189,25 +194,25 @@ compileTestJava { } -//compileCloverJava { -// -// doFirst { -// if (JAVA_VERSION.equals("1.8")) { -// sourceCompatibility = 1.8 -// targetCompatibility = 1.8 -// } else if (JAVA_VERSION.equals("11")) { -// sourceCompatibility = 11 -// targetCompatibility = 11 -// -// options.compilerArgs += [ -// '--module-path', sourceSets.modules.compileClasspath.asPath, -// '--add-modules', j11modules -// ] -// } -// print ("Setting target compatibility to "+targetCompatibility+"\n") -// } -// classpath += configurations.cloverRuntime -//} +compileCloverJava { + + doFirst { + if (JAVA_VERSION.equals("1.8")) { + sourceCompatibility = 1.8 + targetCompatibility = 1.8 + } else if (JAVA_VERSION.equals("11")) { + sourceCompatibility = 11 + targetCompatibility = 11 + + options.compilerArgs += [ + '--module-path', sourceSets.modules.compileClasspath.asPath, + '--add-modules', j11modules + ] + } + print ("Setting target compatibility to "+targetCompatibility+"\n") + } + classpath += configurations.cloverRuntime +} clean { delete sourceSets.main.java.outputDir -- 1.7.10.2