X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=58d27644e414bbc7829f6bd8e5e1e0d653e1e71e;hb=93aa4558431fabba858943e9b2e8f871381a691c;hp=368319567fbc106d487a19e980e9df6968ce5a68;hpb=3fe5792cc63d53a5ace952bd68d3bb673c97f588;p=jalview.git diff --git a/build.gradle b/build.gradle index 3683195..58d2764 100644 --- a/build.gradle +++ b/build.gradle @@ -7,12 +7,18 @@ import groovy.transform.ExternalizeMethods 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' @@ -26,12 +32,6 @@ repositories { jcenter() mavenCentral() mavenLocal() - flatDir { - dirs gradlePluginsDir - } -} - -dependencies { } @@ -46,11 +46,21 @@ ext { 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 { @@ -58,9 +68,9 @@ ext { 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) { @@ -104,6 +114,7 @@ ext { // clover cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}") + cloverDb = string("${buildDir}/clover/clover.db") classesDir = string("${jalviewDir}/${classes_dir}") if (clover.equals("true")) { use_clover = true @@ -135,6 +146,10 @@ ext { 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": @@ -410,12 +425,13 @@ dependencies { } } - configurations { cloverRuntime cloverRuntime.extendsFrom cloverCompile } + +// eclipse project and settings files creation, also used by buildship eclipse { project { name = eclipse_project_name @@ -550,18 +566,24 @@ eclipse { } -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) @@ -569,43 +591,56 @@ task cloverInstr() { } -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 @@ -638,18 +673,6 @@ compileTestJava { } -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 @@ -658,9 +681,9 @@ clean { cleanTest { + dependsOn cleanClover doFirst { delete sourceSets.test.java.outputDir - delete cloverInstrDir } } @@ -836,10 +859,13 @@ test { useTestNG() { includeGroups testngGroups + excludeGroups testngExcludedGroups preserveOrder true useDefaultListeners=true } + maxHeapSize = "1024m" + workingDir = jalviewDir //systemProperties 'clover.jar' System.properties.clover.jar sourceCompatibility = compile_source_compatibility @@ -1363,6 +1389,7 @@ task installers(type: com.install4j.gradle.Install4jTask) { '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}"