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 def getdownChannel = getdown_channel_name
59 if (getdown_channel_name.equals("COMMIT")) {
60 getdownChannel = getGitHash()
62 getdown_app_base = getdown_channel_base+"/"+getdownChannel+"/"+JAVA_VERSION+"/"
63 modules_compileClasspath = fileTree(dir: "$jalviewDir/$j11modDir", include: ["*.jar"])
64 modules_runtimeClasspath = modules_compileClasspath
67 def JAVA_INTEGER_VERSION
68 def additional_compiler_args = []
69 // these are getdown.txt properties defined dependent on the JAVA_VERSION
70 def getdown_alt_java_min_version
71 // this property is assigned below and expanded to multiple lines in the getdown task
72 def getdown_alt_multi_java_location
73 if (JAVA_VERSION.equals("1.8")) {
74 JAVA_INTEGER_VERSION = "8"
77 compile_source_compatibility = 1.8
78 compile_target_compatibility = 1.8
79 getdown_alt_java_min_version = getdown_alt_java8_min_version
80 getdown_alt_multi_java_location = getdown_alt_java8_txt_multi_java_location
81 } else if (JAVA_VERSION.equals("11")) {
82 JAVA_INTEGER_VERSION = "11"
84 libDistDir = j11libDir
85 compile_source_compatibility = 11
86 compile_target_compatibility = 11
87 getdown_alt_java_min_version = getdown_alt_java11_min_version
88 getdown_alt_multi_java_location = getdown_alt_java11_txt_multi_java_location
89 additional_compiler_args += [
90 '--module-path', ext.modules_compileClasspath.asPath,
91 '--add-modules', j11modules
94 throw new GradleException("JAVA_VERSION=$JAVA_VERSION not currently supported by Jalview")
101 srcDirs "$jalviewDir/$sourceDir"
102 outputDir = file("$classes")
106 srcDirs "$jalviewDir/$resourceDir"
107 srcDirs "$jalviewDir/$libDistDir"
110 jar.destinationDir = file("$jalviewDir/$packageDir")
112 compileClasspath = files(sourceSets.main.java.outputDir)
113 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
115 runtimeClasspath = compileClasspath
119 srcDirs = [ cloverInstrDir ]
120 outputDir = file("${buildDir}/${cloverClassesDir}")
124 srcDirs = sourceSets.main.resources.srcDirs
126 compileClasspath = configurations.cloverRuntime + files( sourceSets.clover.java.outputDir )
127 compileClasspath += files(sourceSets.main.java.outputDir)
128 compileClasspath += sourceSets.main.compileClasspath
129 compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
130 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
132 runtimeClasspath = compileClasspath
137 srcDirs "$jalviewDir/$testSourceDir"
138 outputDir = file("$jalviewDir/$testOutputDir")
142 srcDirs = sourceSets.main.resources.srcDirs
145 compileClasspath = files( sourceSets.test.java.outputDir )
148 compileClasspath += sourceSets.clover.compileClasspath
150 compileClasspath += files(sourceSets.main.java.outputDir)
152 compileClasspath += sourceSets.main.compileClasspath
153 compileClasspath += files( sourceSets.main.resources.srcDirs)
154 compileClasspath += fileTree(dir: "$jalviewDir/$utilsDir", include: ["**/*.jar"])
155 compileClasspath += fileTree(dir: "$jalviewDir/$libDir", include: ["*.jar"])
157 runtimeClasspath = compileClasspath
164 cloverCompile 'org.openclover:clover:4.3.1'
165 testCompile 'org.openclover:clover:4.3.1'
171 cloverRuntime.extendsFrom cloverCompile
176 name = "Jalview with gradle build"
178 natures 'org.eclipse.jdt.core.javanature',
179 'org.eclipse.jdt.groovy.core.groovyNature',
180 'org.eclipse.buildship.core.gradleprojectnature'
182 buildCommand 'org.eclipse.jdt.core.javabuilder'
183 buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
187 //defaultOutputDir = sourceSets.main.java.outputDir
189 configurations.each{ if (it.isCanBeResolved()) {
193 containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
195 minusConfigurations += removeThese
196 plusConfigurations = [ ]
200 def removeTheseToo = []
201 HashMap<String, Boolean> addedSrcPath = new HashMap<>();
202 cp.entries.each { entry ->
203 if (entry.kind == 'src') {
204 if (addedSrcPath.getAt(entry.path) || !(entry.path == "src" || entry.path == "test")) {
205 removeTheseToo += entry
207 addedSrcPath.putAt(entry.path, true)
211 cp.entries.removeAll(removeTheseToo)
215 def node = it.asNode()
216 def srcTestAttributes
217 node.children().each{ cpe ->
218 def attributes = cpe.attributes()
219 if (attributes.get("kind") == "src" && attributes.get("path") == "test") {
220 srcTestAttributes = cpe.find { a -> a.name() == "attributes" }
224 def addTestAttribute = true
225 srcTestAttributes.each{a ->
226 if (a.name() == "attribute" && a.attributes().getAt("name") == "test") {
227 addTestAttribute = false
230 if (addTestAttribute) {
231 srcTestAttributes.append(new Node(null, "attribute", [name:"test", value:"true"]))
234 node.appendNode('classpathentry', [kind:"output", path:"bin/main"])
235 node.appendNode('classpathentry', [kind:"lib", path:helpParentDir])
236 node.appendNode('classpathentry', [kind:"lib", path:resourceDir])
237 HashMap<String, Boolean> addedLibPath = new HashMap<>();
238 def allPaths = sourceSets.test.compileClasspath + sourceSets.main.compileClasspath
239 sourceSets.main.compileClasspath.each{
240 //if ((it.isDirectory() || ! it.exists()) && ! (it.equals(sourceSets.main.java.outputDir))) {
241 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
242 if (it.isDirectory() || ! it.exists()) {
243 // don't add dirs to classpath
244 //println("Not adding directory "+it)
247 def itPath = it.toString()
248 if (itPath.startsWith(jalviewDirAbsolutePath+"/")) {
249 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
251 if (addedLibPath.get(itPath)) {
252 //println("Not adding duplicate entry "+itPath)
254 //println("Adding entry "+itPath)
255 node.appendNode('classpathentry', [kind:"lib", path:itPath])
256 addedLibPath.put(itPath, true)
259 sourceSets.test.compileClasspath.each{
260 //if ((it.isDirectory() || ! it.exists()) && ! (it.equals(sourceSets.main.java.outputDir))) {
261 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
262 if (it.isDirectory() || ! it.exists()) {
263 // don't add dirs to classpath
264 //println("Not adding directory "+it)
267 def itPath = it.toString()
268 if (itPath.startsWith(jalviewDirAbsolutePath+"/")) {
269 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
271 if (addedLibPath.get(itPath)) {
272 //println("Not adding duplicate entry "+itPath)
274 //println("Adding entry "+itPath)
275 node.appendNode('classpathentry', [kind:"lib", path:itPath])
276 .appendNode('attributes')
277 .appendNode('attribute', [name:"test", value:"true"])
278 addedLibPath.put(itPath, true)
287 // for the IDE, use java 11 compatibility
288 sourceCompatibility = 11
289 targetCompatibility = 11
290 javaRuntimeName = "JavaSE-11"
293 withProperties { props ->
294 def jalview_prefs = new Properties()
295 def ins = new FileInputStream(eclipse_extra_jdt_prefs_file)
296 jalview_prefs.load(ins)
298 jalview_prefs.forEach { t, v ->
299 if (props.getAt(t) == null) {
310 // only instrument source, we build test classes as normal
311 inputs.files files (sourceSets.main.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
312 outputs.dir cloverInstrDir
315 delete cloverInstrDir
316 def argsList = ["--initstring", "${buildDir}/clover/clover.db",
317 "-d", "${buildDir}/${cloverSourcesInstrDir}"]
318 argsList.addAll(inputs.files.files.collect({ file ->
321 String[] args = argsList.toArray()
322 println("About to instrument "+args.length +" files")
323 com.atlassian.clover.CloverInstr.mainImpl(args)
329 group = "Verification"
330 description = "Createst the Clover report"
331 inputs.dir "${buildDir}/clover"
332 outputs.dir "${reportsDir}/clover"
334 file("${buildDir}/clover/clover.db").exists()
337 def argsList = ["--initstring", "${buildDir}/clover/clover.db",
338 "-o", "${reportsDir}/clover"]
339 String[] args = argsList.toArray()
340 com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
342 // and generate ${reportsDir}/clover/clover.xml
343 args = ["--initstring", "${buildDir}/clover/clover.db",
344 "-o", "${reportsDir}/clover/clover.xml"].toArray()
345 com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
355 sourceCompatibility = compile_source_compatibility
356 targetCompatibility = compile_target_compatibility
357 options.compilerArgs = additional_compiler_args
358 print ("Setting target compatibility to "+targetCompatibility+"\n")
365 dependsOn compileCloverJava
366 classpath += configurations.cloverRuntime
368 classpath += sourceSets.main.runtimeClasspath
371 sourceCompatibility = compile_source_compatibility
372 targetCompatibility = compile_target_compatibility
373 options.compilerArgs = additional_compiler_args
374 print ("Setting target compatibility to "+targetCompatibility+"\n")
382 sourceCompatibility = compile_source_compatibility
383 targetCompatibility = compile_target_compatibility
384 options.compilerArgs += additional_compiler_args
385 print ("Setting target compatibility to "+targetCompatibility+"\n")
387 classpath += configurations.cloverRuntime
391 delete sourceSets.main.java.outputDir
395 delete sourceSets.test.java.outputDir
396 delete cloverInstrDir
399 def getDate(format) {
400 def date = new Date()
401 //return date.format("dd MMMM yyyy")
402 return date.format(format)
406 def stdout = new ByteArrayOutputStream()
408 commandLine "git", "rev-parse", "--short", "HEAD"
409 standardOutput = stdout
410 workingDir = jalviewDir
412 return stdout.toString().trim()
416 def stdout = new ByteArrayOutputStream()
418 commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
419 standardOutput = stdout
420 workingDir = jalviewDir
422 return stdout.toString().trim()
425 task createBuildProperties(type: WriteProperties) {
426 inputs.dir("$jalviewDir/$sourceDir")
427 inputs.dir("$jalviewDir/$resourceDir")
428 outputFile "$classes/$buildPropertiesFile"
429 /* taking time/date specific comment out to allow better incremental builds */
430 //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
431 comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
432 property "BUILD_DATE", getDate("dd MMMM yyyy")
433 property "VERSION", JALVIEW_VERSION
434 property "INSTALLATION", INSTALLATION+" git-commit:"+getGitHash()+" ["+getGitBranch()+"]"
435 outputs.file(outputFile)
436 outputs.dir("$classes")
439 task syncDocs(type: Sync) {
440 def syncDir = "$classes/$docDir"
441 from fileTree("$jalviewDir/$docDir")
446 def helpFile = "$classes/$helpDir/help.jhm"
448 task copyHelp(type: Copy) {
449 def inputDir = "$jalviewDir/$helpParentDir/$helpDir"
450 def outputDir = "$classes/$helpDir"
455 filter(ReplaceTokens, beginToken: '$$', endToken: '$$', tokens: ['Version-Rel': JALVIEW_VERSION])
465 outputs.files(helpFile)
466 outputs.dir(outputDir)
469 task syncLib(type: Sync) {
470 def syncDir = "$classes/$libDistDir"
471 from fileTree("$jalviewDir/$libDistDir")
475 task syncResources(type: Sync) {
476 from "$jalviewDir/$resourceDir"
486 dependsOn syncResources
492 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
495 dependsOn compileJava
497 dependsOn cloverInstr
500 print("Running tests " + (use_clover?"WITH":"WITHOUT") + " clover [clover="+use_clover+"]\n")
503 includeGroups testngGroups
505 useDefaultListeners=true
508 workingDir = jalviewDir
509 //systemProperties 'clover.jar' System.properties.clover.jar
510 sourceCompatibility = compile_source_compatibility
511 targetCompatibility = compile_target_compatibility
512 jvmArgs += additional_compiler_args
513 print ("Setting target compatibility to "+targetCompatibility+"\n")
516 task buildIndices(type: JavaExec) {
518 classpath = sourceSets.main.compileClasspath
519 main = "com.sun.java.help.search.Indexer"
520 workingDir = "$classes/$helpDir"
523 inputs.dir("$workingDir/$argDir")
525 outputs.dir("$classes/doc")
526 outputs.dir("$classes/help")
527 outputs.file("$workingDir/JavaHelpSearch/DOCS")
528 outputs.file("$workingDir/JavaHelpSearch/DOCS.TAB")
529 outputs.file("$workingDir/JavaHelpSearch/OFFSETS")
530 outputs.file("$workingDir/JavaHelpSearch/POSITIONS")
531 outputs.file("$workingDir/JavaHelpSearch/SCHEMA")
532 outputs.file("$workingDir/JavaHelpSearch/TMAP")
535 task compileLinkCheck(type: JavaCompile) {
537 classpath = files("$jalviewDir/$utilsDir")
538 destinationDir = file("$jalviewDir/$utilsDir")
539 source = fileTree(dir: "$jalviewDir/$utilsDir", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
541 inputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.java")
542 inputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.java")
543 outputs.file("$jalviewDir/$utilsDir/HelpLinksChecker.class")
544 outputs.file("$jalviewDir/$utilsDir/BufferedLineReader.class")
547 def helplinkscheckeroutputfile = file("$jalviewDir/$utilsDir/HelpLinksChecker.out")
548 task linkCheck(type: JavaExec) {
549 dependsOn prepare, compileLinkCheck
550 classpath = files("$jalviewDir/$utilsDir")
551 main = "HelpLinksChecker"
552 workingDir = jalviewDir
553 def help = "$classes/$helpDir"
554 args = [ "$classes/$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 if (getdown_local == "true") {
652 getdown_app_base = file(getdownWebsiteDir).toURI().toString()
654 props.put("getdown_txt_appbase", getdown_app_base)
655 props.each{ prop, val ->
656 if (prop.startsWith("getdown_txt_") && val != null) {
657 if (prop.startsWith("getdown_txt_multi_")) {
658 def key = prop.substring(18)
659 val.split(",").each{ v ->
660 def line = key + " = " + v + "\n"
661 getdownTextString += line
664 // file values rationalised
665 if (val.indexOf('/') > -1) {
667 if (val.indexOf('/') == 0) {
670 } else if (val.indexOf('/') > 0) {
671 // relative path (relative to jalviewDir)
672 r = file( jalviewDir + '/' + val )
675 val = getdown_resource_dir + '/' + r.getName()
676 getdownWebsiteResourceFilenames += val
677 getdownResourceFilenames += r.getPath()
680 def line = prop.substring(12) + " = " + val + "\n"
681 getdownTextString += line
686 getdownWebsiteResourceFilenames.each{ filename ->
687 getdownTextString += "resource = "+filename+"\n"
689 getdownResourceFilenames.each{ filename ->
692 into project.ext.getdownResourceDir
697 makeDist.outputs.files.each{ f ->
698 if (f.isDirectory()) {
699 def files = fileTree(dir: f, include: ["*"]).getFiles()
701 } else if (f.exists()) {
705 codeFiles.sort().each{f ->
706 def line = "code = " + getdown_app_dir + '/' + f.getName() + "\n"
707 getdownTextString += line
710 into project.ext.getdownAppDir
714 // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
716 if (JAVA_VERSION.equals("11")) {
717 def j11libFiles = fileTree(dir: "$jalviewDir/$j11libDir", include: ["*.jar"]).getFiles()
718 j11libFiles.sort().each{f ->
719 def line = "code = " + getdown_j11lib_dir + '/' + f.getName() + "\n"
720 getdownTextString += line
723 into project.ext.getdownJ11libDir
729 // 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.
730 //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
731 getdownTextString += "resource = " + file(getdownLauncher).getName() + "\n"
732 getdownTextString += "class = " + mainClass + "\n"
734 def getdown_txt = file(project.ext.getdownWebsiteDir + "/getdown.txt")
735 getdown_txt.write(getdownTextString)
739 into project.ext.getdownFilesDir
744 into project.ext.getdownFilesDir
749 into project.ext.getdownWebsiteDir
753 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.background_image')
754 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.error_background')
755 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.progress_image')
756 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.icon')
757 from jalviewDir + '/' + project.getProperty('getdown_txt_ui.mac_dock_icon')
758 into project.ext.getdownFilesDir + '/' + getdown_resource_dir
762 inputs.dir(jalviewDir + '/' + packageDir)
763 outputs.dir(project.ext.getdownWebsiteDir)
764 outputs.dir(project.ext.getdownFilesDir)
767 task getdownDigest(type: JavaExec) {
768 group = "distribution"
769 description = "Digest the getdown website folder"
770 dependsOn getdownWebsite
771 classpath = files(jalviewDir + '/' + getdown_core, jalviewDir+'/'+getdown_launcher)
772 main = "com.threerings.getdown.tools.Digester"
773 args project.ext.getdownWebsiteDir
774 inputs.dir(project.ext.getdownWebsiteDir)
775 outputs.file(project.ext.getdownWebsiteDir + '/' + "digest2.txt")
779 group = "distribution"
780 description = "Create the minimal and full getdown app folder for installers and website and create digest file"
781 dependsOn getdownDigest
785 delete project.ext.getdownWebsiteDir
786 delete project.ext.getdownFilesDir
790 def install4jHomeDir = "/opt/install4j"
791 def hostname = "hostname".execute().text.trim()
792 if (hostname.equals("jv-bamboo")) {
793 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
794 } else if (OperatingSystem.current().isMacOsX()) {
795 install4jHomeDir = '/Applications/install4j.app/Contents/Resources/app'
796 if (! file(install4jHomeDir).exists()) {
797 install4jHomeDir = System.getProperty("user.home")+install4jHomeDir
799 } else if (OperatingSystem.current().isLinux()) {
800 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
802 installDir = file(install4jHomeDir)
803 mediaTypes = Arrays.asList(install4jMediaTypes.split(","))
804 if (install4jFaster.equals("true")) {
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,
837 'COPYRIGHT_MESSAGE': install4jCopyrightMessage,
838 'MACOS_BUNDLE_ID': install4jMacOSBundleId
841 if (OSX_KEYPASS=="") {
842 filter(ReplaceTokens, beginToken: 'codeSigning macEnabled="', endToken: '"', tokens: ['true':'codeSigning macEnabled="false"'])
843 filter(ReplaceTokens, beginToken: 'runPostProcessor="true" ',endToken: 'Processor', tokens: ['post':'runPostProcessor="false" postProcessor'])
847 outputs.files(install4jConf)
850 // include file associations in installer
851 def installerFileAssociationsXml = file("$install4jDir/$install4jInstallerFileAssociations").text
855 match: '<action name="EXTENSIONS_REPLACED_BY_GRADLE".*?</action>',
856 replace: installerFileAssociationsXml,
860 // include uninstaller applescript app files in dmg
861 def installerDMGUninstallerXml = file("$install4jDir/$install4jDMGUninstallerAppFiles").text
865 match: '<file name="UNINSTALL_OLD_JALVIEW_APP_REPLACED_IN_GRADLE" file=.*?>',
866 replace: installerDMGUninstallerXml,
873 task installers(type: com.install4j.gradle.Install4jTask) {
874 group = "distribution"
875 description = "Create the install4j installers"
877 dependsOn copyInstall4jTemplate
878 projectFile = file(install4jConf)
879 println("Using projectFile "+projectFile)
880 variables = [majorVersion: version.substring(2, 11), build: 001, OSX_KEYSTORE: OSX_KEYSTORE, JSIGN_SH: JSIGN_SH]
881 destination = "$jalviewDir/$install4jBuildDir/$JAVA_VERSION"
885 macKeystorePassword=OSX_KEYPASS
889 inputs.dir(project.ext.getdownWebsiteDir)
890 inputs.file(install4jConf)
891 inputs.dir(macosJavaVMDir)
892 inputs.dir(windowsJavaVMDir)
893 outputs.dir("$jalviewDir/$install4jBuildDir/$JAVA_VERSION")