import groovy.util.XmlParser
import groovy.xml.XmlUtil
+
buildscript {
+ repositories {
+ mavenCentral()
+ mavenLocal()
+ }
dependencies {
classpath 'org.openclover:clover:4.4.1'
}
}
+
plugins {
id 'java'
id 'application'
jcenter()
mavenCentral()
mavenLocal()
- flatDir {
- dirs gradlePluginsDir
- }
-}
-
-dependencies {
}
jalviewDirRelativePath = jalviewDir
// local build environment properties
- def localProps = "${jalviewDirAbsolutePath}/local.properties"
+ // can be "projectDir/local.properties"
+ def localProps = "${projectDir}/local.properties"
+ def propsFile = null;
if (file(localProps).exists()) {
+ propsFile = localProps
+ }
+ // or "../projectDir_local.properties"
+ def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties"
+ if (file(dirLocalProps).exists()) {
+ propsFile = dirLocalProps
+ }
+ if (propsFile != null) {
try {
def p = new Properties()
- def localPropsFIS = new FileInputStream(localProps)
+ def localPropsFIS = new FileInputStream(propsFile)
p.load(localPropsFIS)
localPropsFIS.close()
p.each {
def oldval = findProperty(key)
setProperty(key, val)
if (oldval != null) {
- println("Overriding property '${key}' ('${oldval}') with local.properties value '${val}'")
+ println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
} else {
- println("Setting unknown property '${key}' with local.properties value '${val}'")
+ println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'")
}
}
} catch (Exception e) {
// clover
cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}")
+ cloverDb = string("${buildDir}/clover/clover.db")
classesDir = string("${jalviewDir}/${classes_dir}")
if (clover.equals("true")) {
use_clover = true
getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
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"
+ }
break
case "RELEASE":
}
}
-
configurations {
cloverRuntime
cloverRuntime.extendsFrom cloverCompile
}
+
+// eclipse project and settings files creation, also used by buildship
eclipse {
project {
name = eclipse_project_name
}
-task cloverInstr() {
+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
doFirst {
delete cloverInstrDir
- def argsList = ["--initstring", "${buildDir}/clover/clover.db",
- "-d", "${buildDir}/${cloverSourcesInstrDir}"]
- argsList.addAll(inputs.files.files.collect({ file ->
- file.absolutePath
- }))
+ 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)
}
-task cloverReportHTML (type: JavaExec) {
- inputs.dir "${buildDir}/clover"
- outputs.dir "${reportsDir}/clover"
+cloverClasses.dependsOn cloverInstr
- classpath configurations.cloverRuntime
- maxHeapSize "${cloverReportJVMHeap}"
- jvmArgs += "${cloverReportJVMArgs}"
- main = "com.atlassian.clover.reporters.html.HtmlReporter"
- args "--initstring", "${buildDir}/clover/clover.db", "-o", "${reportsDir}/clover"
- "${cloverReportHTMLOptions}".split(",").each {
- args+= it.trim()
- }
-}
-task cloverReportXML (type: JavaExec) {
- inputs.dir "${buildDir}/clover"
- outputs.dir "${reportsDir}/clover"
- maxHeapSize "${cloverReportJVMHeap}"
- jvmArgs "${cloverReportJVMArgs}"
- classpath configurations.cloverRuntime
- main = "com.atlassian.clover.reporters.xml.XMLReporter"
- args "--initstring", "${buildDir}/clover/clover.db", "-o", "${reportsDir}/clover/clover.xml"
-
- "${cloverReportXMLOptions}".split(",").each {
- args+= it.trim()
- }
-}
task cloverReport {
group = "Verification"
- description = "Creates the Clover report"
- inputs.dir "${buildDir}/clover"
- outputs.dir "${reportsDir}/clover"
- onlyIf {
- file("${buildDir}/clover/clover.db").exists()
- }
- dependsOn cloverReportXML
- dependsOn cloverReportHTML
+ description = "Creates the Clover report"
+ inputs.dir "${buildDir}/clover"
+ outputs.dir "${reportsDir}/clover"
+ 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)
+ }
+}
+
+
+compileCloverJava {
+
+ doFirst {
+ sourceCompatibility = compile_source_compatibility
+ targetCompatibility = compile_target_compatibility
+ options.compilerArgs += additional_compiler_args
+ print ("Setting target compatibility to "+targetCompatibility+"\n")
+ }
+ classpath += configurations.cloverRuntime
+}
+
+
+task cleanClover {
+ doFirst {
+ delete cloverInstrDir
+ delete cloverDb
+ }
}
// end clover bits
}
-compileCloverJava {
-
- doFirst {
- sourceCompatibility = compile_source_compatibility
- targetCompatibility = compile_target_compatibility
- options.compilerArgs += additional_compiler_args
- print ("Setting target compatibility to "+targetCompatibility+"\n")
- }
- classpath += configurations.cloverRuntime
-}
-
-
clean {
doFirst {
delete sourceSets.main.java.outputDir
cleanTest {
+ dependsOn cleanClover
doFirst {
delete sourceSets.test.java.outputDir
- delete cloverInstrDir
}
}
useTestNG() {
includeGroups testngGroups
+ excludeGroups testngExcludedGroups
preserveOrder true
useDefaultListeners=true
}
+ maxHeapSize = "1024m"
+
workingDir = jalviewDir
//systemProperties 'clover.jar' System.properties.clover.jar
sourceCompatibility = compile_source_compatibility
'GETDOWN_INSTALL_DIR': getdown_install_dir,
'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
'BUILD_DIR': install4jBuildDir,
+ 'UNIX_DESKTOP_ADDITIONS': install4j_unix_desktop_additions,
]
destination = "${jalviewDir}/${install4jBuildDir}"