X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=8dcbc41d6916bd6c68d8c2680864ac6140414ff8;hb=refs%2Fheads%2Fbug%2FJAL-3561_translatefileformats;hp=36b75fddded7ec6a4dc2750c88c8fac684a1ea69;hpb=56f4324f197ac20954ce304d103ff26f1dda58e2;p=jalview.git diff --git a/build.gradle b/build.gradle index 36b75fd..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.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 @@ -410,12 +411,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 +552,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,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 @@ -620,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 @@ -640,9 +667,9 @@ clean { cleanTest { + dependsOn cleanClover doFirst { delete sourceSets.test.java.outputDir - delete cloverInstrDir } } @@ -822,6 +849,8 @@ test { useDefaultListeners=true } + maxHeapSize = "1024m" + workingDir = jalviewDir //systemProperties 'clover.jar' System.properties.clover.jar sourceCompatibility = compile_source_compatibility