mavenCentral()
mavenLocal()
}
- dependencies {
- classpath 'org.openclover:clover:4.4.1'
- }
}
bareTestSourceDir = string(test_source_dir)
testSourceDir = string("${jalviewDir}/${bareTestSourceDir}")
+ classesDir = string("${jalviewDir}/${classes_dir}")
+
// clover
- cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}")
+ useClover = clover.equals("true")
+ cloverInstrDir = file("${buildDir}/clover/${clover_sources_instr_dir}")
+ cloverClassesDir = file("${buildDir}/clover/${clover_classes_dir}")
+ cloverReportDir = file("${buildDir}/clover/${clover_report_dir}")
cloverDb = string("${buildDir}/clover/clover.db")
- classesDir = string("${jalviewDir}/${classes_dir}")
- if (clover.equals("true")) {
- use_clover = true
- classesDir = string("${buildDir}/${cloverClassesDir}")
- } else {
- use_clover = false
- classesDir = string("${jalviewDir}/${classes_dir}")
- }
- classes = classesDir
+ resourceClassesDir = useClover ? cloverClassesDir : classesDir
getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
buildDist = true
getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
jvlChannelName += "_${getdownChannelName}"
// automatically add the test group Not-bamboo for exclusion
- if ("".equals(testngExcludedGroups)) {
- testngExcludedGroups = "Not-bamboo"
+ if ("".equals(testng_excluded_groups)) {
+ testng_excluded_groups = "Not-bamboo"
}
install4jExtraScheme = "jalviewb"
break
- buildingHTML = string("${jalviewDir}/${docDir}/building.html")
- helpFile = string("${classesDir}/${help_dir}/help.jhm")
+ buildingHTML = string("${jalviewDir}/${doc_dir}/building.html")
+ helpFile = string("${resourceClassesDir}/${help_dir}/help.jhm")
helpParentDir = string("${jalviewDir}/${help_parent_dir}")
helpSourceDir = string("${helpParentDir}/${help_dir}")
jar.destinationDir = file("${jalviewDir}/${packageDir}")
compileClasspath = files(sourceSets.main.java.outputDir)
- //compileClasspath += files(sourceSets.main.resources.srcDirs)
compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
runtimeClasspath = compileClasspath
clover {
java {
- srcDirs = [ cloverInstrDir ]
- outputDir = file("${buildDir}/${cloverClassesDir}")
+ srcDirs cloverInstrDir
+ outputDir = cloverClassesDir
}
resources {
srcDirs = sourceSets.main.resources.srcDirs
}
- compileClasspath = configurations.cloverRuntime + files( sourceSets.clover.java.outputDir )
- compileClasspath += files(sourceSets.main.java.outputDir)
- compileClasspath += sourceSets.main.compileClasspath
- compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}", include: ["**/*.jar"])
+
+ compileClasspath = files( sourceSets.clover.java.outputDir )
compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
+ compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
runtimeClasspath = compileClasspath
}
test {
java {
srcDirs testSourceDir
- outputDir = file("${jalviewDir}/${testOutputDir}")
+ outputDir = file("${jalviewDir}/${test_output_dir}")
}
resources {
- srcDirs = sourceSets.main.resources.srcDirs
+ srcDirs = useClover ? sourceSets.clover.resources.srcDirs : sourceSets.main.resources.srcDirs
}
compileClasspath = files( sourceSets.test.java.outputDir )
-
- if (use_clover) {
- compileClasspath = sourceSets.clover.compileClasspath
- } else {
- compileClasspath += files(sourceSets.main.java.outputDir)
- }
-
- compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
- compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}/testnglibs", include: ["**/*.jar"])
- compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}/testlibs", include: ["**/*.jar"])
+ compileClasspath += useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath
+ compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"])
runtimeClasspath = compileClasspath
}
}
-// clover bits
-dependencies {
- if (use_clover) {
- cloverCompile 'org.openclover:clover:4.4.1'
- testCompile 'org.openclover:clover:4.4.1'
- }
-}
-
-configurations {
- cloverRuntime
- cloverRuntime.extendsFrom cloverCompile
-}
-
-
// eclipse project and settings files creation, also used by buildship
eclipse {
project {
}
-task cloverInstr {
- // only instrument source, we build test classes as normal
- inputs.files files (sourceSets.main.allJava,sourceSets.test.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
- outputs.dir cloverInstrDir
+// clover bits
+
+
+task cloverInstr(type: JavaExec) {
+ group = "Verification"
+ description = "Create clover instrumented source files"
+
+ inputs.files(sourceSets.main.allJava)
+ outputs.dir(cloverInstrDir)
+
+ //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
+ classpath = sourceSets.clover.compileClasspath
+ main = "com.atlassian.clover.CloverInstr"
+
+ def argsList = [
+ "--encoding",
+ "UTF-8",
+ "--initstring",
+ cloverDb,
+ "--destdir",
+ cloverInstrDir.getPath(),
+ ]
+ def srcFiles = sourceSets.main.allJava.files
+ argsList.addAll(
+ srcFiles.collect(
+ { file -> file.absolutePath }
+ )
+ )
+ args argsList.toArray()
doFirst {
delete cloverInstrDir
- def argsList = [
- "--initstring",
- cloverDb,
- "-d",
- cloverInstrDir.getPath(),
- ]
- 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)
+ delete cloverDb
+ println("Clover: About to instrument "+srcFiles.size() +" files")
}
}
cloverClasses.dependsOn cloverInstr
-task cloverReport {
+task cloverXmlReport(type: JavaExec) {
group = "Verification"
- description = "Creates the Clover report"
- inputs.dir "${buildDir}/clover"
- outputs.dir "${reportsDir}/clover"
+ description = "Creates clover XML report"
+
+ inputs.dir cloverClassesDir
+ outputs.dir cloverReportDir
onlyIf {
file(cloverDb).exists()
}
- doFirst {
- def argsList = [
- "--initstring",
- cloverDb,
- "-o",
- "${reportsDir}/clover"
- ]
- String[] args = argsList.toArray()
- com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
-
- // and generate ${reportsDir}/clover/clover.xml
- args = [
- "--initstring",
- cloverDb,
- "-o",
- "${reportsDir}/clover/clover.xml"
- ].toArray()
- com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
+
+ classpath = sourceSets.clover.runtimeClasspath
+ main = "com.atlassian.clover.reporters.xml.XMLReporter"
+
+ def argsList = [
+ "--alwaysreport",
+ "--initstring",
+ cloverDb,
+ "--outfile",
+ "${cloverReportDir}/clover.xml"
+ ]
+
+ args argsList.toArray()
+}
+
+
+task cloverHtmlReport(type: JavaExec) {
+ group = "Verification"
+ description = "Creates clover HTML report"
+
+ inputs.dir cloverClassesDir
+ outputs.dir cloverReportDir
+ onlyIf {
+ file(cloverDb).exists()
}
+
+ classpath = sourceSets.clover.runtimeClasspath
+ main = "com.atlassian.clover.reporters.html.HtmlReporter"
+
+ def argsList = [
+ "--alwaysreport",
+ "--initstring",
+ cloverDb,
+ "--outputdir",
+ "${cloverReportDir}/clover"
+ ]
+
+ args argsList.toArray()
+}
+
+
+task cloverReport {
+ group = "Verification"
+ description = "Creates clover reports"
+
+ dependsOn cloverXmlReport
+ dependsOn cloverHtmlReport
}
task cleanClover {
doFirst {
- delete cloverInstrDir
- delete cloverDb
+ delete "${buildDir/clover}"
}
}
// end clover bits
compileTestJava {
- if (use_clover) {
- dependsOn compileCloverJava
- classpath += configurations.cloverRuntime
- } else {
- classpath += sourceSets.main.runtimeClasspath
- }
doFirst {
sourceCompatibility = compile_source_compatibility
targetCompatibility = compile_target_compatibility
task convertBuildingMD(type: Exec) {
dependsOn cleanBuildingHTML
- def buildingMD = "${jalviewDir}/${docDir}/building.md"
- def css = "${jalviewDir}/${docDir}/github.css"
+ def buildingMD = "${jalviewDir}/${doc_dir}/building.md"
+ def css = "${jalviewDir}/${doc_dir}/github.css"
def pandoc = null
pandoc_exec.split(",").each {
task syncDocs(type: Sync) {
dependsOn convertBuildingMD
- def syncDir = "${classesDir}/${docDir}"
- from fileTree("${jalviewDir}/${docDir}")
+ def syncDir = "${resourceClassesDir}/${doc_dir}"
+ from fileTree("${jalviewDir}/${doc_dir}")
into syncDir
}
task copyHelp(type: Copy) {
def inputDir = helpSourceDir
- def outputDir = "${classesDir}/${help_dir}"
+ def outputDir = "${resourceClassesDir}/${help_dir}"
from(inputDir) {
exclude '**/*.gif'
exclude '**/*.jpg'
task syncLib(type: Sync) {
- def syncDir = "${classesDir}/${libDistDir}"
+ def syncDir = "${resourceClassesDir}/${libDistDir}"
from fileTree("${jalviewDir}/${libDistDir}")
into syncDir
}
task syncResources(type: Sync) {
from resourceDir
include "**/*.*"
- into "${classesDir}"
+ into "${resourceClassesDir}"
preserve {
include "**"
}
//testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
test {
dependsOn prepare
- dependsOn compileJava
- if (use_clover) {
- dependsOn cloverInstr
- }
- if (use_clover) {
- print("Running tests " + (use_clover?"WITH":"WITHOUT") + " clover [clover="+use_clover+"]\n")
+ if (useClover) {
+ dependsOn cloverClasses
+ } else {
+ dependsOn compileJava
}
useTestNG() {
- includeGroups testngGroups
- excludeGroups testngExcludedGroups
+ includeGroups testng_groups
+ excludeGroups testng_excluded_groups
preserveOrder true
useDefaultListeners=true
}
targetCompatibility = compile_target_compatibility
jvmArgs += additional_compiler_args
+ doFirst {
+ if (useClover) {
+ print("Running tests " + (useClover?"WITH":"WITHOUT") + " clover [clover="+useClover+"]\n")
+ }
+ }
}
task compileLinkCheck(type: JavaCompile) {
options.fork = true
- classpath = files("${jalviewDir}/${utilsDir}")
- destinationDir = file("${jalviewDir}/${utilsDir}")
- source = fileTree(dir: "${jalviewDir}/${utilsDir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
-
- inputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.java")
- inputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.java")
- outputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.class")
- outputs.file("${jalviewDir}/${utilsDir}/BufferedLineReader.class")
+ classpath = files("${jalviewDir}/${utils_dir}")
+ destinationDir = file("${jalviewDir}/${utils_dir}")
+ source = fileTree(dir: "${jalviewDir}/${utils_dir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
+
+ inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
+ inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
+ outputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.class")
+ outputs.file("${jalviewDir}/${utils_dir}/BufferedLineReader.class")
}
task linkCheck(type: JavaExec) {
dependsOn prepare, compileLinkCheck
- def helpLinksCheckerOutFile = file("${jalviewDir}/${utilsDir}/HelpLinksChecker.out")
- classpath = files("${jalviewDir}/${utilsDir}")
+ def helpLinksCheckerOutFile = file("${jalviewDir}/${utils_dir}/HelpLinksChecker.out")
+ classpath = files("${jalviewDir}/${utils_dir}")
main = "HelpLinksChecker"
workingDir = jalviewDir
args = [ "${classesDir}/${help_dir}", "-nointernet" ]
// import the pubhtmlhelp target
ant.properties.basedir = "${jalviewDir}"
ant.properties.helpBuildDir = "${jalviewDirAbsolutePath}/${classes_dir}/${help_dir}"
-ant.importBuild "${utilsDir}/publishHelp.xml"
+ant.importBuild "${utils_dir}/publishHelp.xml"
task cleanPackageDir(type: Delete) {
dependsOn createBuildProperties
manifest {
- attributes "Main-Class": mainClass,
+ attributes "Main-Class": main_class,
"Permissions": "all-permissions",
"Application-Name": "Jalview Desktop",
"Codebase": application_codebase
manifest {
attributes 'Implementation-Version': JALVIEW_VERSION
}
- mainClassName = shadowJarMainClass
+ mainClassName = shadow_jar_main_class
mergeServiceFiles()
classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
minimize()