buildscript {
dependencies {
- //classpath files("$gradlePluginsDir/gradle-macappbundle-2.3.0-patched-2.3.0.jar")
+ classpath 'org.openclover:clover:4.3.1'
}
}
repositories {
jcenter()
mavenCentral()
+ mavenLocal()
flatDir {
dirs gradlePluginsDir
}
}
mainClassName = launcherClass
+def cloverInstrDir = file("$buildDir/sources-instr")
sourceSets {
runtimeClasspath = compileClasspath
}
+ modules {
+ compileClasspath = fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"])
+
+ runtimeClasspath = compileClasspath
+ }
+
+ clover {
+ java {
+ srcDirs = [ cloverInstrDir ]
+ outputDir = file("${buildDir}/clover-classes")
+ }
+
+ resources {
+ srcDirs = sourceSets.main.resources.srcDirs
+ }
+ compileClasspath = configurations.cloverRuntime + files( sourceSets.clover.java.outputDir )
+ compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
+ compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
+ if (JAVA_VERSION.equals("1.8")) {
+ print("ADDING J11LIBS TO CLASSPATH")
+ compileClasspath += fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"])
+ }
+
+ runtimeClasspath = compileClasspath
+ }
+
test {
java {
srcDirs "$jalviewDir/$testSourceDir"
srcDirs = sourceSets.main.resources.srcDirs
}
- compileClasspath = sourceSets.main.compileClasspath
- compileClasspath += 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")) {
+ print("ADDING J11LIBS TO CLASSPATH")
+ compileClasspath += fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"])
+ }
runtimeClasspath = compileClasspath
}
+}
- modules {
- compileClasspath = fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"])
+// clover bits
+dependencies {
+ cloverCompile 'org.openclover:clover:4.3.1'
+ testCompile 'org.openclover:clover:4.3.1'
+}
+
+configurations {
+ cloverRuntime
+ cloverRuntime.extendsFrom cloverCompile
+}
+
+task cloverInstr() {
+ // 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 {
+ delete cloverInstrDir
+ def argsList = ["--initstring", "${buildDir}/clover/clover.db",
+ "-d", "${buildDir}/sources-instr"]
+ argsList.addAll(inputs.files.files.collect({ file ->
+ file.absolutePath
+ }))
+ String[] args = argsList.toArray()
+ println("About to instrument "+args.length +" files")
+ com.atlassian.clover.CloverInstr.mainImpl(args)
+ }
+}
- runtimeClasspath = compileClasspath
- }
+test.dependsOn cloverInstr
+
+task cloverReport {
+ inputs.dir "${buildDir}/clover"
+ outputs.dir "${reportsDir}/clover"
+ onlyIf {
+ file("${buildDir}/clover/clover.db").exists()
+ }
+ doFirst {
+ def argsList = ["--initstring", "${buildDir}/clover/clover.db",
+ "-o", "${reportsDir}/clover"]
+ String[] args = argsList.toArray()
+ com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
+ }
}
+// end clover bits
+
+
compileJava {
doFirst {
}
+compileTestJava {
+ dependsOn 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
}
cleanTest {
delete sourceSets.test.java.outputDir
+ delete cloverInstrDir
}
def getDate(format) {
task syncResources(type: Sync) {
from "$jalviewDir/$resourceDir"
include "**/*.*"
+ exclude "install4j"
into "$jalviewDir/$classesDir"
preserve {
include "**"
dependsOn copyHelp
}
+
//testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
test {
dependsOn prepare
- dependsOn compileJava
- useTestNG {
+
+
+ useTestNG()
+ options {
includeGroups testngGroups
+ preserveOrder true
}
+
workingDir = jalviewDir
//systemProperties 'clover.jar' System.properties.clover.jar
+ if (JAVA_VERSION.equals("1.8")) {
+ sourceCompatibility = 1.8
+ targetCompatibility = 1.8
+ } else if (JAVA_VERSION.equals("11")) {
+ sourceCompatibility = 11
+ targetCompatibility = 11
+
+ jvmArgs += [
+ '--module-path',
+ sourceSets.modules.compileClasspath.asPath,
+ '--add-modules',
+ j11modules
+ ]
+ }
+ print ("Setting target compatibility to "+targetCompatibility+"\n")
}
task buildIndices(type: JavaExec) {
inputs.dir(project.ext.getdownWebsiteDir)
outputs.dir("$jalviewDir/$install4jBuildDir")
}
+