X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=8dcbc41d6916bd6c68d8c2680864ac6140414ff8;hb=refs%2Fheads%2Fbug%2FJAL-3561_translatefileformats;hp=05fddc0563413be03c336b14a37ebb7bbed56933;hpb=f6131ae7c9734cfcba48a29a9e34da12e54a8532;p=jalview.git diff --git a/build.gradle b/build.gradle index 05fddc0..8dcbc41 100644 --- a/build.gradle +++ b/build.gradle @@ -7,18 +7,24 @@ import groovy.transform.ExternalizeMethods import groovy.util.XmlParser import groovy.xml.XmlUtil + buildscript { + repositories { + mavenCentral() + mavenLocal() + } dependencies { - classpath 'org.openclover:clover:4.3.1' + classpath 'org.openclover:clover:4.4.1' } } + plugins { id 'java' id 'application' id 'eclipse' id 'com.github.johnrengelman.shadow' version '4.0.3' - id 'com.install4j.gradle' version '8.0.2' + id 'com.install4j.gradle' version '8.0.4' id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree } @@ -26,12 +32,6 @@ repositories { jcenter() mavenCentral() mavenLocal() - flatDir { - dirs gradlePluginsDir - } -} - -dependencies { } @@ -104,6 +104,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 @@ -126,6 +127,7 @@ ext { getdownAppDistDir = getdown_app_dir_alt buildProperties = string("${classesDir}/${build_properties_file}") reportRsyncCmd = false + jvlChannelName = CHANNEL.toLowerCase() switch (CHANNEL) { case "BUILD": @@ -133,6 +135,7 @@ ext { getdown_channel_base = bamboo_channelbase getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}") getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}") + jvlChannelName += "_${getdownChannelName}" break case "RELEASE": @@ -208,6 +211,8 @@ ext { getdownAppBase = string(getProperty("getdown_appbase_override")) println("Overriding getdown appbase with '${getdownAppBase}'") } + // sanitise file name for jalview launcher file for this channel + jvlChannelName = jvlChannelName.replaceAll(/[^\w\-]/,"_") getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}") //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}" @@ -384,7 +389,7 @@ sourceSets { compileClasspath = files( sourceSets.test.java.outputDir ) if (use_clover) { - compileClasspath += sourceSets.clover.compileClasspath + compileClasspath = sourceSets.clover.compileClasspath } else { compileClasspath += files(sourceSets.main.java.outputDir) } @@ -401,17 +406,18 @@ sourceSets { // clover bits dependencies { if (use_clover) { - cloverCompile 'org.openclover:clover:4.3.1' - testCompile 'org.openclover:clover:4.3.1' + 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 { name = eclipse_project_name @@ -546,18 +552,24 @@ eclipse { } -task cloverInstr() { +task cloverInstr { // only instrument source, we build test classes as normal - inputs.files files (sourceSets.main.allJava) // , fileTree(dir: testSourceDir, include: ["**/*.java"])) + 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) @@ -565,26 +577,57 @@ task cloverInstr() { } +cloverClasses.dependsOn cloverInstr + + task cloverReport { group = "Verification" - description = "Createst the Clover report" - inputs.dir "${buildDir}/clover" - outputs.dir "${reportsDir}/clover" - onlyIf { - file("${buildDir}/clover/clover.db").exists() - } + description = "Creates the Clover report" + inputs.dir "${buildDir}/clover" + outputs.dir "${reportsDir}/clover" + onlyIf { + file(cloverDb).exists() + } doFirst { - def argsList = ["--initstring", "${buildDir}/clover/clover.db", - "-o", "${reportsDir}/clover"] + 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", "${buildDir}/clover/clover.db", - "-o", "${reportsDir}/clover/clover.xml"].toArray() + 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 @@ -616,18 +659,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 @@ -636,9 +667,9 @@ clean { cleanTest { + dependsOn cleanClover doFirst { delete sourceSets.test.java.outputDir - delete cloverInstrDir } } @@ -818,6 +849,8 @@ test { useDefaultListeners=true } + maxHeapSize = "1024m" + workingDir = jalviewDir //systemProperties 'clover.jar' System.properties.clover.jar sourceCompatibility = compile_source_compatibility @@ -1096,9 +1129,9 @@ task getdownWebsite() { def getdown_txt = file("${getdownWebsiteDir}/getdown.txt") getdown_txt.write(getdownTextString) - def getdownLaunchJvl = ( (getdownChannelName != null && getdownChannelName.length() > 0)?"${getdownChannelName}_":"" ) + getdown_launch_jvl - def launch_jvl = file("${getdownWebsiteDir}/${getdown_launch_jvl}") - launch_jvl.write("appbase="+props.get("getdown_txt_appbase")) + def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl" + def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}") + launchJvl.write("appbase="+props.get("getdown_txt_appbase")) copy { from getdownLauncher @@ -1133,7 +1166,7 @@ task getdownWebsite() { copy { from getdown_txt - from launch_jvl + from launchJvl from getdownLauncher from "${getdownWebsiteDir}/${getdown_build_properties}" if (file(getdownLauncher).getName() != getdown_launcher) { @@ -1156,6 +1189,22 @@ task getdownWebsite() { } +// a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir +task getdownDigestDir(type: JavaExec) { + def digestDirPropertyName = "DIGESTDIR" + description = "Digest a local dir (-P${digestDirPropertyName}=...) for getdown" + doFirst { + classpath = files(getdownLauncher) + def digestDir = findProperty(digestDirPropertyName) + if (digestDir == null) { + throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest") + } + args digestDir + } + main = "com.threerings.getdown.tools.Digester" +} + + task getdownDigest(type: JavaExec) { group = "distribution" description = "Digest the getdown website folder" @@ -1367,33 +1416,47 @@ task sourceDist(type: Tar) { into project.name - def EXCLUDE_FILES=["build/*","bin/*","test-output/","test-reports","tests","clover*/*" - ,".*" - ,"benchmarking/*" - ,"**/.*" - ,"*.class" - ,"**/*.class","${j11modDir}/**/*.jar","appletlib","**/*locales" - ,"*locales/**", - ,"utils/InstallAnywhere"] - def PROCESS_FILES=[ "AUTHORS", - "CITATION", - "FEATURETODO", - "JAVA-11-README", - "FEATURETODO", - "LICENSE", - "**/README", - "RELEASE", - "THIRDPARTYLIBS","TESTNG", - "build.gradle", - "gradle.properties", - "**/*.java", - "**/*.html", - "**/*.xml", - "**/*.gradle", - "**/*.groovy", - "**/*.properties", - "**/*.perl", - "**/*.sh"] + def EXCLUDE_FILES=[ + "build/*", + "bin/*", + "test-output/", + "test-reports", + "tests", + "clover*/*", + ".*", + "benchmarking/*", + "**/.*", + "*.class", + "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales", + "*locales/**", + "utils/InstallAnywhere", + "**/*.log", + ] + def PROCESS_FILES=[ + "AUTHORS", + "CITATION", + "FEATURETODO", + "JAVA-11-README", + "FEATURETODO", + "LICENSE", + "**/README", + "RELEASE", + "THIRDPARTYLIBS", + "TESTNG", + "build.gradle", + "gradle.properties", + "**/*.java", + "**/*.html", + "**/*.xml", + "**/*.gradle", + "**/*.groovy", + "**/*.properties", + "**/*.perl", + "**/*.sh", + ] + def INCLUDE_FILES=[ + ".settings/org.eclipse.jdt.core.jalview.prefs", + ] from(jalviewDir) { exclude (EXCLUDE_FILES) @@ -1419,14 +1482,17 @@ task sourceDist(type: Tar) { exclude (getdown_website_dir) // exluding these as not using jars as modules yet - exclude ("${j11modDir}/**/*.jar") - } - // from (jalviewDir) { - // // explicit includes for stuff that seemed to not get included - // include(fileTree("test/**/*.")) - // exclude(EXCLUDE_FILES) - // exclude(PROCESS_FILES) - // } + exclude ("$j11modDir/**/*.jar") + } + from(jalviewDir) { + include(INCLUDE_FILES) + } +// from (jalviewDir) { +// // explicit includes for stuff that seemed to not get included +// include(fileTree("test/**/*.")) +// exclude(EXCLUDE_FILES) +// exclude(PROCESS_FILES) +// } }