1 import org.apache.tools.ant.filters.ReplaceTokens
2 //import org.apache.tools.ant.filters.ReplaceRegexp
3 import org.gradle.internal.os.OperatingSystem
7 classpath 'org.openclover:clover:4.3.1'
8 classpath 'org.apache.commons:commons-compress:1.18'
16 id 'com.github.johnrengelman.shadow' version '4.0.3'
17 id 'com.install4j.gradle' version '7.0.9'
29 mainClassName = launcherClass
30 def cloverInstrDir = file("$buildDir/$cloverSourcesInstrDir")
31 def classes = "$jalviewDir/$classesDir"
33 if (clover.equals("true")) {
35 classes = "$buildDir/$cloverClassesDir"
38 classes = "$jalviewDir/$classesDir"
41 // configure classpath/args for j8/j11 compilation
43 def jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
46 def compile_source_compatibility
47 def compile_target_compatibility
50 // where the getdown channel will be built.
51 // TODO: consider allowing this expression to be overrriden by -P arg
52 getdownWebsiteDir = jalviewDir + '/' + getdown_website_dir + '/' + JAVA_VERSION + '/'
53 getdownAppDir = getdownWebsiteDir + '/' + getdown_app_dir
54 getdownJ11libDir = getdownWebsiteDir + '/' + getdown_j11lib_dir
55 getdownResourceDir = getdownWebsiteDir + '/' + getdown_resource_dir
56 getdownLauncher = jalviewDir + '/' + getdown_launcher
57 getdownFilesDir = jalviewDir + '/' + getdown_files_dir + '/' + JAVA_VERSION + '/'
58 getdownLib1 = jalviewDir + '/' + getdown_lib1
59 def getdownChannel = getdown_channel_name
60 if (getdown_channel_name.equals("COMMIT")) {
61 getdownChannel = getGitHash()
63 getdown_app_base = getdown_channel_base+"/"+getdownChannel+"/"+JAVA_VERSION+"/"
64 modules_compileClasspath = fileTree(dir: "$jalviewDir/$j11modDir", include: ["*.jar"])
65 modules_runtimeClasspath = modules_compileClasspath
68 def JAVA_INTEGER_VERSION
69 def additional_compiler_args = []
70 // these are getdown.txt properties defined dependent on the JAVA_VERSION
71 def getdown_alt_java_min_version
72 // this property is assigned below and expanded to multiple lines in the getdown task
73 def getdown_alt_multi_java_location
74 if (JAVA_VERSION.equals("1.8")) {
75 JAVA_INTEGER_VERSION = "8"
78 compile_source_compatibility = 1.8
79 compile_target_compatibility = 1.8
80 getdown_alt_java_min_version = getdown_alt_java8_min_version
81 getdown_alt_multi_java_location = getdown_alt_java8_txt_multi_java_location
82 } else if (JAVA_VERSION.equals("11")) {
83 JAVA_INTEGER_VERSION = "11"
85 libDistDir = j11libDir
86 compile_source_compatibility = 11
87 compile_target_compatibility = 11
88 getdown_alt_java_min_version = getdown_alt_java11_min_version
89 getdown_alt_multi_java_location = getdown_alt_java11_txt_multi_java_location
90 additional_compiler_args += [
91 '--module-path', ext.modules_compileClasspath.asPath,
92 '--add-modules', j11modules
95 throw new GradleException("JAVA_VERSION=$JAVA_VERSION not currently supported by Jalview")
102 srcDirs "$jalviewDir/$sourceDir"
103 outputDir = file("$classes")
107 srcDirs "$jalviewDir/$resourceDir"
108 srcDirs "$jalviewDir/$libDistDir"
111 jar.destinationDir = file("$jalviewDir/$packageDir")
113 compileClasspath = files(sourceSets.main.java.outputDir)
114 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
116 runtimeClasspath = compileClasspath
120 srcDirs = [ cloverInstrDir ]
121 outputDir = file("${buildDir}/${cloverClassesDir}")
125 srcDirs = sourceSets.main.resources.srcDirs
127 compileClasspath = configurations.cloverRuntime + files( sourceSets.clover.java.outputDir )
128 compileClasspath += files(sourceSets.main.java.outputDir)
129 compileClasspath += sourceSets.main.compileClasspath
130 compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
131 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
133 runtimeClasspath = compileClasspath
138 srcDirs "$jalviewDir/$testSourceDir"
139 outputDir = file("$jalviewDir/$testOutputDir")
143 srcDirs = sourceSets.main.resources.srcDirs
146 compileClasspath = files( sourceSets.test.java.outputDir )
149 compileClasspath += sourceSets.clover.compileClasspath
151 compileClasspath += files(sourceSets.main.java.outputDir)
153 compileClasspath += sourceSets.main.compileClasspath
154 compileClasspath += files( sourceSets.main.resources.srcDirs)
155 compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
156 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
158 runtimeClasspath = compileClasspath
165 cloverCompile 'org.openclover:clover:4.3.1'
166 testCompile 'org.openclover:clover:4.3.1'
172 cloverRuntime.extendsFrom cloverCompile
177 name = "Jalview with gradle build"
179 natures 'org.eclipse.jdt.core.javanature',
180 'org.eclipse.jdt.groovy.core.groovyNature',
181 'org.eclipse.buildship.core.gradleprojectnature'
183 buildCommand 'org.eclipse.jdt.core.javabuilder'
184 buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
188 //defaultOutputDir = sourceSets.main.java.outputDir
190 configurations.each{ if (it.isCanBeResolved()) {
194 containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
196 minusConfigurations += removeThese
197 plusConfigurations = [ ]
201 def removeTheseToo = []
202 HashMap<String, Boolean> addedSrcPath = new HashMap<>();
203 cp.entries.each { entry ->
204 if (entry.kind == 'src') {
205 if (addedSrcPath.getAt(entry.path) || !(entry.path == "src" || entry.path == "test")) {
206 removeTheseToo += entry
208 addedSrcPath.putAt(entry.path, true)
212 cp.entries.removeAll(removeTheseToo)
216 def node = it.asNode()
217 def srcTestAttributes
218 node.children().each{ cpe ->
219 def attributes = cpe.attributes()
220 if (attributes.get("kind") == "src" && attributes.get("path") == "test") {
221 srcTestAttributes = cpe.find { a -> a.name() == "attributes" }
225 def addTestAttribute = true
226 srcTestAttributes.each{a ->
227 if (a.name() == "attribute" && a.attributes().getAt("name") == "test") {
228 addTestAttribute = false
231 if (addTestAttribute) {
232 srcTestAttributes.append(new Node(null, "attribute", [name:"test", value:"true"]))
235 node.appendNode('classpathentry', [kind:"output", path:"bin/main"])
236 node.appendNode('classpathentry', [kind:"lib", path:helpParentDir])
237 node.appendNode('classpathentry', [kind:"lib", path:resourceDir])
238 HashMap<String, Boolean> addedLibPath = new HashMap<>();
239 def allPaths = sourceSets.test.compileClasspath + sourceSets.main.compileClasspath
240 sourceSets.main.compileClasspath.each{
241 //if ((it.isDirectory() || ! it.exists()) && ! (it.equals(sourceSets.main.java.outputDir))) {
242 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
243 if (it.isDirectory() || ! it.exists()) {
244 // don't add dirs to classpath
245 //println("Not adding directory "+it)
248 def itPath = it.toString()
249 if (itPath.startsWith(jalviewDirAbsolutePath+"/")) {
250 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
252 if (addedLibPath.get(itPath)) {
253 //println("Not adding duplicate entry "+itPath)
255 //println("Adding entry "+itPath)
256 node.appendNode('classpathentry', [kind:"lib", path:itPath])
257 addedLibPath.put(itPath, true)
260 sourceSets.test.compileClasspath.each{
261 //if ((it.isDirectory() || ! it.exists()) && ! (it.equals(sourceSets.main.java.outputDir))) {
262 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
263 if (it.isDirectory() || ! it.exists()) {
264 // don't add dirs to classpath
265 //println("Not adding directory "+it)
268 def itPath = it.toString()
269 if (itPath.startsWith(jalviewDirAbsolutePath+"/")) {
270 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
272 if (addedLibPath.get(itPath)) {
273 //println("Not adding duplicate entry "+itPath)
275 //println("Adding entry "+itPath)
276 node.appendNode('classpathentry', [kind:"lib", path:itPath])
277 .appendNode('attributes')
278 .appendNode('attribute', [name:"test", value:"true"])
279 addedLibPath.put(itPath, true)
288 // for the IDE, use java 11 compatibility
289 sourceCompatibility = 11
290 targetCompatibility = 11
291 javaRuntimeName = "JavaSE-11"
294 withProperties { props ->
295 def jalview_prefs = new Properties()
296 def ins = new FileInputStream(eclipse_extra_jdt_prefs_file)
297 jalview_prefs.load(ins)
299 jalview_prefs.forEach { t, v ->
300 if (props.getAt(t) == null) {
311 // only instrument source, we build test classes as normal
312 inputs.files files (sourceSets.main.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
313 outputs.dir cloverInstrDir
316 delete cloverInstrDir
317 def argsList = ["--initstring", "${buildDir}/clover/clover.db",
318 "-d", "${buildDir}/${cloverSourcesInstrDir}"]
319 argsList.addAll(inputs.files.files.collect({ file ->
322 String[] args = argsList.toArray()
323 println("About to instrument "+args.length +" files")
324 com.atlassian.clover.CloverInstr.mainImpl(args)
330 group = "Verification"
331 description = "Createst the Clover report"
332 inputs.dir "${buildDir}/clover"
333 outputs.dir "${reportsDir}/clover"
335 file("${buildDir}/clover/clover.db").exists()
338 def argsList = ["--initstring", "${buildDir}/clover/clover.db",
339 "-o", "${reportsDir}/clover"]
340 String[] args = argsList.toArray()
341 com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
343 // and generate ${reportsDir}/clover/clover.xml
344 args = ["--initstring", "${buildDir}/clover/clover.db",
345 "-o", "${reportsDir}/clover/clover.xml"].toArray()
346 com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
356 sourceCompatibility = compile_source_compatibility
357 targetCompatibility = compile_target_compatibility
358 options.compilerArgs = additional_compiler_args
359 print ("Setting target compatibility to "+targetCompatibility+"\n")
366 dependsOn compileCloverJava
367 classpath += configurations.cloverRuntime
369 classpath += sourceSets.main.runtimeClasspath
372 sourceCompatibility = compile_source_compatibility
373 targetCompatibility = compile_target_compatibility
374 options.compilerArgs = additional_compiler_args
375 print ("Setting target compatibility to "+targetCompatibility+"\n")
383 sourceCompatibility = compile_source_compatibility
384 targetCompatibility = compile_target_compatibility
385 options.compilerArgs += additional_compiler_args
386 print ("Setting target compatibility to "+targetCompatibility+"\n")
388 classpath += configurations.cloverRuntime
392 delete sourceSets.main.java.outputDir
396 delete sourceSets.test.java.outputDir
397 delete cloverInstrDir
400 def getDate(format) {
401 def date = new Date()
402 //return date.format("dd MMMM yyyy")
403 return date.format(format)
407 def stdout = new ByteArrayOutputStream()
409 commandLine "git", "rev-parse", "--short", "HEAD"
410 standardOutput = stdout
411 workingDir = jalviewDir
413 return stdout.toString().trim()
417 def stdout = new ByteArrayOutputStream()
419 commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
420 standardOutput = stdout
421 workingDir = jalviewDir
423 return stdout.toString().trim()
426 task createBuildProperties(type: WriteProperties) {
427 inputs.dir("$jalviewDir/$sourceDir")
428 inputs.dir("$jalviewDir/$resourceDir")
429 outputFile "$classes/$buildPropertiesFile"
430 /* taking time/date specific comment out to allow better incremental builds */
431 //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
432 comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
433 property "BUILD_DATE", getDate("dd MMMM yyyy")
434 property "VERSION", JALVIEW_VERSION
435 property "INSTALLATION", INSTALLATION+" git-commit:"+getGitHash()+" ["+getGitBranch()+"]"
436 outputs.file(outputFile)
437 outputs.dir("$classes")
440 task syncDocs(type: Sync) {
441 def syncDir = "$classes/$docDir"
442 from fileTree("$jalviewDir/$docDir")
447 def helpFile = "$classes/$helpDir/help.jhm"
449 task copyHelp(type: Copy) {
450 def inputDir = "$jalviewDir/$helpParentDir/$helpDir"
451 def outputDir = "$classes/$helpDir"
456 filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION])
466 outputs.files(helpFile)
467 outputs.dir(outputDir)
470 task syncLib(type: Sync) {
471 def syncDir = "$classes/$libDistDir"
472 from fileTree("$jalviewDir/$libDistDir")
476 task syncResources(type: Sync) {
477 from "$jalviewDir/$resourceDir"
487 dependsOn syncResources
493 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
496 dependsOn compileJava
498 dependsOn cloverInstr
501 print("Running tests " + (use_clover?"WITH":"WITHOUT") + " clover [clover="+use_clover+"]\n")
504 includeGroups testngGroups
506 useDefaultListeners=true
509 workingDir = jalviewDir
510 //systemProperties 'clover.jar' System.properties.clover.jar
511 sourceCompatibility = compile_source_compatibility
512 targetCompatibility = compile_target_compatibility
513 jvmArgs += additional_compiler_args
514 print ("Setting target compatibility to "+targetCompatibility+"\n")
517 task buildIndices(type: JavaExec) {
519 classpath = sourceSets.main.compileClasspath
520 main = "com.sun.java.help.search.Indexer"
521 workingDir = "$classes/$helpDir"
524 inputs.dir("$workingDir/$argDir")
526 outputs.dir("$classes/doc")
527 outputs.dir("$classes/help")
528 outputs.file("$workingDir/JavaHelpSearch/DOCS")
529 outputs.file("$workingDir/JavaHelpSearch/DOCS.TAB")
530 outputs.file("$workingDir/JavaHelpSearch/OFFSETS")
531 outputs.file("$workingDir/JavaHelpSearch/POSITIONS")
532 outputs.file("$workingDir/JavaHelpSearch/SCHEMA")
533 outputs.file("$workingDir/JavaHelpSearch/TMAP")
536 task compileLinkCheck(type: JavaCompile) {
538 classpath = files("$jalviewDir/$utilsDir")
539 destinationDir = file("$jalviewDir/$utilsDir")
540 source = fileTree(dir: "$jalviewDir/$utilsDir", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
542 outputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.class")
543 outputs.file("$jalviewDir/$utilsDir/BufferedLineReader.class")
546 def helplinkscheckeroutputfile = file("$jalviewDir/$utilsDir/HelpLinksChecker.out")
547 task linkCheck(type: JavaExec) {
548 dependsOn prepare, compileLinkCheck
549 classpath = files("$jalviewDir/$utilsDir")
550 main = "HelpLinksChecker"
551 workingDir = jalviewDir
552 def help = "$classes/$helpDir"
553 args = [ "$classes/$helpDir", "-nointernet" ]
554 //args = [ "$classesDir/$helpDir", "-nointernet" ]
557 helplinkscheckeroutputfile.createNewFile()
558 standardOutput new FileOutputStream(helplinkscheckeroutputfile, false)
561 outputs.file(helplinkscheckeroutputfile)
564 task cleanPackageDir(type: Delete) {
565 delete fileTree("$jalviewDir/$packageDir").include("*.jar")
570 dependsOn buildIndices
571 dependsOn createBuildProperties
574 attributes "Main-Class": mainClass,
575 "Permissions": "all-permissions",
576 "Application-Name": "Jalview Desktop",
577 "Codebase": application_codebase
580 destinationDir = file("$jalviewDir/$packageDir")
581 archiveName = rootProject.name+".jar"
589 inputs.dir("$classes")
590 outputs.file("$jalviewDir/$packageDir/$archiveName")
593 task copyJars(type: Copy) {
594 from fileTree("$classes").include("**/*.jar").include("*.jar").files
595 into "$jalviewDir/$packageDir"
598 // doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
599 task syncJars(type: Sync) {
600 from fileTree("$jalviewDir/$libDistDir").include("**/*.jar").include("*.jar").files
601 into "$jalviewDir/$packageDir"
603 include jar.archiveName
609 description = "Put all required libraries in dist"
610 // order of "cleanPackageDir", "copyJars", "jar" important!
611 jar.mustRunAfter cleanPackageDir
612 syncJars.mustRunAfter cleanPackageDir
613 dependsOn cleanPackageDir
616 outputs.dir("$jalviewDir/$packageDir")
620 dependsOn cleanPackageDir
627 from ("$jalviewDir/$libDistDir") {
630 mainClassName = shadowJarMainClass
632 classifier = "all-"+JAVA_VERSION
636 task getdownWebsite() {
637 group = "distribution"
638 description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
640 def getdownWebsiteResourceFilenames = []
641 def getdownTextString = ""
642 def getdownResourceDir = project.ext.getdownResourceDir
643 def getdownAppDir = project.ext.getdownAppDir
644 def getdownResourceFilenames = []
646 // go through properties looking for getdown_txt_...
647 def props = project.properties.sort { it.key }
648 props.put("getdown_txt_java_min_version", getdown_alt_java_min_version)
649 props.put("getdown_txt_multi_java_location", getdown_alt_multi_java_location)
651 props.put("getdown_txt_appbase", getdown_app_base)
652 props.each{ prop, val ->
653 if (prop.startsWith("getdown_txt_") && val != null) {
654 if (prop.startsWith("getdown_txt_multi_")) {
655 def key = prop.substring(18)
656 val.split(",").each{ v ->
657 def line = key + " = " + v + "\n"
658 getdownTextString += line
661 // file values rationalised
662 if (val.indexOf('/') > -1) {
664 if (val.indexOf('/') == 0) {
667 } else if (val.indexOf('/') > 0) {
668 // relative path (relative to jalviewDir)
669 r = file( jalviewDir + '/' + val )
672 val = getdown_resource_dir + '/' + r.getName()
673 getdownWebsiteResourceFilenames += val
674 getdownResourceFilenames += r.getPath()
677 def line = prop.substring(12) + " = " + val + "\n"
678 getdownTextString += line
683 getdownWebsiteResourceFilenames.each{ filename ->
684 getdownTextString += "resource = "+filename+"\n"
686 getdownResourceFilenames.each{ filename ->
689 into project.ext.getdownResourceDir
694 makeDist.outputs.files.each{ f ->
695 if (f.isDirectory()) {
696 def files = fileTree(dir: f, include: ["*"]).getFiles()
698 } else if (f.exists()) {
702 codeFiles.sort().each{f ->
703 def line = "code = " + getdown_app_dir + '/' + f.getName() + "\n"
704 getdownTextString += line
707 into project.ext.getdownAppDir
711 // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
713 if (JAVA_VERSION.equals("11")) {
714 def j11libFiles = fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"]).getFiles()
715 j11libFiles.sort().each{f ->
716 def line = "code = " + getdown_j11lib_dir + '/' + f.getName() + "\n"
717 getdownTextString += line
720 into project.ext.getdownJ11libDir
726 // getdown-launcher.jar should not be in main application class path so the main application can move it when updated. Listed as a resource so it gets updated.
727 //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
728 getdownTextString += "resource = " + file(getdownLauncher).getName() + "\n"
729 getdownTextString += "class = " + mainClass + "\n"
731 def getdown_txt = file(project.ext.getdownWebsiteDir + "/getdown.txt")
732 getdown_txt.write(getdownTextString)
736 into project.ext.getdownFilesDir
741 into project.ext.getdownFilesDir
746 into project.ext.getdownWebsiteDir
751 into project.ext.getdownFilesDir + '/' + packageDir
755 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.background_image')
756 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.error_background')
757 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.progress_image')
758 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.icon')
759 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.mac_dock_icon')
760 into project.ext.getdownFilesDir + '/' + getdown_resource_dir
764 inputs.dir(jalviewDir + '/' + packageDir)
765 outputs.dir(project.ext.getdownWebsiteDir)
766 outputs.dir(project.ext.getdownFilesDir)
769 task getdownDigest(type: JavaExec) {
770 group = "distribution"
771 description = "Digest the getdown website folder"
772 dependsOn getdownWebsite
773 classpath = files(jalviewDir + '/' + getdown_core)
774 classpath file(jalviewDir + '/' + getdown_lib1)
775 main = "com.threerings.getdown.tools.Digester"
776 args project.ext.getdownWebsiteDir
777 inputs.dir(project.ext.getdownWebsiteDir)
778 outputs.file(project.ext.getdownWebsiteDir + '/' + "digest2.txt")
782 group = "distribution"
783 description = "Create the minimal and full getdown app folder for installers and website and create digest file"
784 dependsOn getdownDigest
788 delete project.ext.getdownWebsiteDir
789 delete project.ext.getdownFilesDir
793 def install4jHomeDir = "/opt/install4j"
794 def hostname = "hostname".execute().text.trim()
795 if (hostname.equals("jv-bamboo")) {
796 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
797 } else if (OperatingSystem.current().isMacOsX()) {
798 install4jHomeDir = '/Applications/install4j.app/Contents/Resources/app'
799 if (! file(install4jHomeDir).exists()) {
800 install4jHomeDir = System.getProperty("user.home")+install4jHomeDir
802 } else if (OperatingSystem.current().isLinux()) {
803 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
805 installDir = file(install4jHomeDir)
806 mediaTypes = Arrays.asList(install4jMediaTypes.split(","))
814 def install4jDir = "$jalviewDir/$install4jResourceDir"
815 def install4jConfFile = "jalview-installers-java"+JAVA_VERSION+".install4j"
816 install4jConf = "$install4jDir/$install4jConfFile"
818 task copyInstall4jTemplate(type: Copy) {
819 macosJavaVMDir = System.env.HOME+"/buildtools/jre/openjdk-java_vm/getdown/macos-jre"+JAVA_VERSION+"/jre"
820 macosJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/macos-jre"+JAVA_VERSION+".tar.gz"
821 windowsJavaVMDir = System.env.HOME+"/buildtools/jre/openjdk-java_vm/getdown/windows-jre"+JAVA_VERSION+"/jre"
822 windowsJavaVMTgz = System.env.HOME+"/buildtools/jre/openjdk-java_vm/install4j/tgz/windows-jre"+JAVA_VERSION+".tar.gz"
823 from (install4jDir) {
824 include install4jTemplate
825 rename (install4jTemplate, install4jConfFile)
826 filter(ReplaceTokens, beginToken: '', endToken: '', tokens: ['9999999999': JAVA_VERSION])
827 filter(ReplaceTokens, beginToken: '$$', endToken: '$$',
829 'JAVA_VERSION': JAVA_VERSION,
830 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
831 'VERSION': JALVIEW_VERSION,
832 'MACOS_JAVA_VM_DIR': macosJavaVMDir,
833 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
834 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
835 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
836 'INSTALL4JINFOPLISTFILEASSOCIATIONS': install4jInfoPlistFileAssociations
839 if (OSX_KEYPASS=="") {
840 filter(ReplaceTokens, beginToken: 'codeSigning macEnabled="', endToken: '"', tokens: ['true':'codeSigning macEnabled="false"'])
841 filter(ReplaceTokens, beginToken: 'runPostProcessor="true" ',endToken: 'Processor', tokens: ['post':'runPostProcessor="false" postProcessor'])
845 outputs.files(install4jConf)
848 def installerFileAssociationsXml = file("$install4jDir/$install4jInstallerFileAssociations").text
852 match: '<action name="EXTENSIONS_REPLACED_BY_GRADLE".*?</action>',
853 //match: '<action.*?EXTENSIONS_REPLACED_BY_GRADLE.*?</action>',
854 replace: installerFileAssociationsXml,
860 task installers(type: com.install4j.gradle.Install4jTask) {
861 group = "distribution"
862 description = "Create the install4j installers"
864 dependsOn copyInstall4jTemplate
865 projectFile = file(install4jConf)
866 println("Using projectFile "+projectFile)
867 variables = [majorVersion: version.substring(2, 11), build: 001, OSX_KEYSTORE: OSX_KEYSTORE, JSIGN_SH: JSIGN_SH]
868 destination = "$jalviewDir/$install4jBuildDir/$JAVA_VERSION"
872 macKeystorePassword=OSX_KEYPASS
876 inputs.dir(project.ext.getdownWebsiteDir)
877 inputs.file(install4jConf)
878 inputs.dir(macosJavaVMDir)
879 inputs.dir(windowsJavaVMDir)
880 outputs.dir("$jalviewDir/$install4jBuildDir/$JAVA_VERSION")