1 import org.apache.tools.ant.filters.ReplaceTokens
2 import org.gradle.internal.os.OperatingSystem
3 import org.gradle.plugins.ide.eclipse.model.Output
4 import org.gradle.plugins.ide.eclipse.model.Library
5 import java.security.MessageDigest
6 import groovy.transform.ExternalizeMethods
7 import groovy.util.XmlParser
8 import groovy.xml.XmlUtil
17 classpath 'org.openclover:clover:4.4.1'
26 id 'com.github.johnrengelman.shadow' version '4.0.3'
27 id 'com.install4j.gradle' version '8.0.4'
28 id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
38 // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use
39 def string(Object o) {
40 return o == null ? "" : o.toString()
45 jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
46 jalviewDirRelativePath = jalviewDir
48 // local build environment properties
49 // can be "projectDir/local.properties"
50 def localProps = "${projectDir}/local.properties"
52 if (file(localProps).exists()) {
53 propsFile = localProps
55 // or "../projectDir_local.properties"
56 def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties"
57 if (file(dirLocalProps).exists()) {
58 propsFile = dirLocalProps
60 if (propsFile != null) {
62 def p = new Properties()
63 def localPropsFIS = new FileInputStream(propsFile)
68 def oldval = findProperty(key)
71 println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
73 println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'")
76 } catch (Exception e) {
77 System.out.println("Exception reading local.properties")
82 // Import releaseProps from the RELEASE file
83 // or a file specified via JALVIEW_RELEASE_FILE if defined
84 // Expect jalview.version and target release branch in jalview.release
85 def releaseProps = new Properties();
86 def releasePropFile = findProperty("JALVIEW_RELEASE_FILE");
87 def defaultReleasePropFile = "${jalviewDirAbsolutePath}/RELEASE";
89 (new File(releasePropFile!=null ? releasePropFile : defaultReleasePropFile)).withInputStream {
92 } catch (Exception fileLoadError) {
93 throw new Error("Couldn't load release properties file "+(releasePropFile==null ? defaultReleasePropFile : "from custom location: releasePropFile"),fileLoadError);
96 // Set JALVIEW_VERSION if it is not already set
97 if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) {
98 JALVIEW_VERSION = releaseProps.get("jalview.version")
101 // this property set when running Eclipse headlessly
102 j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
103 // this property set by Eclipse
104 eclipseApplicationProperty = string("eclipse.application")
105 // CHECK IF RUNNING FROM WITHIN ECLIPSE
106 def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty]
107 IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.")
108 // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET
109 if (System.properties[j2sHeadlessBuildProperty].equals("true")) {
110 println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'")
114 println("WITHIN ECLIPSE IDE")
116 println("HEADLESS BUILD")
119 System.properties.sort { it.key }.each {
120 key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
123 if (false && IN_ECLIPSE) {
124 jalviewDir = jalviewDirAbsolutePath
129 bareSourceDir = string(source_dir)
130 sourceDir = string("${jalviewDir}/${bareSourceDir}")
131 resourceDir = string("${jalviewDir}/${resource_dir}")
132 bareTestSourceDir = string(test_source_dir)
133 testSourceDir = string("${jalviewDir}/${bareTestSourceDir}")
136 cloverInstrDir = file("${buildDir}/${cloverSourcesInstrDir}")
137 cloverDb = string("${buildDir}/clover/clover.db")
138 classesDir = string("${jalviewDir}/${classes_dir}")
139 if (clover.equals("true")) {
141 classesDir = string("${buildDir}/${cloverClassesDir}")
144 classesDir = string("${jalviewDir}/${classes_dir}")
149 getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
152 // the following values might be overridden by the CHANNEL switch
153 getdownChannelName = CHANNEL.toLowerCase()
154 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
155 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
156 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
157 getdownAppDistDir = getdown_app_dir_alt
158 buildProperties = string("${classesDir}/${build_properties_file}")
159 reportRsyncCommand = false
160 jvlChannelName = CHANNEL.toLowerCase()
161 install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
162 install4jDSStore = "DS_Store-NON-RELEASE"
163 install4jDMGBackgroundImage = "jalview_dmg_background-NON-RELEASE.png"
164 install4jInstallerName = "${jalview_name} Non-Release Installer"
165 install4jExecutableName = jalview_name.replaceAll("[^\\w]+", "_").toLowerCase()
166 install4jExtraScheme = "jalviewx"
170 // TODO: get bamboo build artifact URL for getdown artifacts
171 getdown_channel_base = bamboo_channelbase
172 getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
173 getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
174 jvlChannelName += "_${getdownChannelName}"
175 // automatically add the test group Not-bamboo for exclusion
176 if ("".equals(testngExcludedGroups)) {
177 testngExcludedGroups = "Not-bamboo"
179 install4jExtraScheme = "jalviewb"
183 getdownAppDistDir = getdown_app_dir_release
184 reportRsyncCommand = true
186 install4jDSStore = "DS_Store"
187 install4jDMGBackgroundImage = "jalview_dmg_background.png"
188 install4jInstallerName = "${jalview_name} Installer"
192 getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
193 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
194 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
195 if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
196 throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
198 packageDir = string("${ARCHIVEDIR}/${packageDir}")
199 buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
202 reportRsyncCommand = true
203 install4jExtraScheme = "jalviewa"
207 getdownChannelName = string("archive/${JALVIEW_VERSION}")
208 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
209 getdownAppBase = file(getdownWebsiteDir).toURI().toString()
210 if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
211 throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
213 packageDir = string("${ARCHIVEDIR}/${packageDir}")
214 buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
217 reportRsyncCommand = true
218 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
219 install4jSuffix = "Archive"
220 install4jExtraScheme = "jalviewa"
224 reportRsyncCommand = true
226 // DEVELOP-RELEASE is usually associated with a Jalview release series so set the version
227 JALVIEW_VERSION=JALVIEW_VERSION+"-develop"
229 install4jSuffix = "Develop"
230 install4jDSStore = "DS_Store-DEVELOP"
231 install4jDMGBackgroundImage = "jalview_dmg_background-DEVELOP.png"
232 install4jExtraScheme = "jalviewd"
233 install4jInstallerName = "${jalview_name} Develop Installer"
237 reportRsyncCommand = true
239 // TEST-RELEASE is usually associated with a Jalview release series so set the version
240 JALVIEW_VERSION=JALVIEW_VERSION+"-test"
242 install4jSuffix = "Test"
243 install4jDSStore = "DS_Store-TEST-RELEASE"
244 install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png"
245 install4jExtraScheme = "jalviewt"
246 install4jInstallerName = "${jalview_name} Test Installer"
249 case ~/^SCRATCH(|-[-\w]*)$/:
250 getdownChannelName = CHANNEL
251 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
252 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
253 reportRsyncCommand = true
254 install4jSuffix = "Scratch"
258 if (!file("${LOCALDIR}").exists()) {
259 throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
261 getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
262 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
264 JALVIEW_VERSION = "TEST"
265 install4jSuffix = "Test-Local"
266 install4jDSStore = "DS_Store-TEST-RELEASE"
267 install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png"
268 install4jExtraScheme = "jalviewt"
269 install4jInstallerName = "${jalview_name} Test Installer"
273 getdownAppBase = file(getdownWebsiteDir).toURI().toString()
274 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
275 install4jExtraScheme = "jalviewl"
278 default: // something wrong specified
279 throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
283 // override getdownAppBase if requested
284 if (findProperty("getdown_appbase_override") != null) {
285 getdownAppBase = string(getProperty("getdown_appbase_override"))
286 println("Overriding getdown appbase with '${getdownAppBase}'")
288 // sanitise file name for jalview launcher file for this channel
289 jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_")
290 // install4j application and folder names
291 if (install4jSuffix == "") {
292 install4jApplicationName = "${jalview_name}"
293 install4jBundleId = "${install4j_bundle_id}"
294 install4jWinApplicationId = install4j_release_win_application_id
296 install4jApplicationName = "${jalview_name} ${install4jSuffix}"
297 install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
298 // add int hash of install4jSuffix to the last part of the application_id
299 def id = install4j_release_win_application_id
300 def idsplitreverse = id.split("-").reverse()
301 idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
302 install4jWinApplicationId = idsplitreverse.reverse().join("-")
304 // sanitise folder and id names
305 // install4jApplicationFolder = e.g. "Jalview Build"
306 install4jApplicationFolder = install4jApplicationName
307 .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
308 .replaceAll("_+", "_") // collapse __
309 install4jInternalId = install4jApplicationName
311 .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
312 .replaceAll("_+", "") // collapse __
313 //.replaceAll("_*-_*", "-") // collapse _-_
314 install4jUnixApplicationFolder = install4jApplicationName
316 .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
317 .replaceAll("_+", "_") // collapse __
318 .replaceAll("_*-_*", "-") // collapse _-_
321 getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
322 //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
323 getdownResourceDir = string("${getdownWebsiteDir}/${getdown_resource_dir}")
324 getdownInstallDir = string("${getdownWebsiteDir}/${getdown_install_dir}")
325 getdownFilesDir = string("${jalviewDir}/${getdown_files_dir}/${JAVA_VERSION}/")
326 getdownFilesInstallDir = string("${getdownFilesDir}/${getdown_install_dir}")
327 /* compile without modules -- using classpath libraries
328 modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
329 modules_runtimeClasspath = modules_compileClasspath
332 gitBranch = string("")
334 println("Using a ${CHANNEL} profile.")
336 additional_compiler_args = []
337 // configure classpath/args for j8/j11 compilation
338 if (JAVA_VERSION.equals("1.8")) {
339 JAVA_INTEGER_VERSION = string("8")
342 libDistDir = j8libDir
343 compile_source_compatibility = 1.8
344 compile_target_compatibility = 1.8
345 // these are getdown.txt properties defined dependent on the JAVA_VERSION
346 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
347 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
348 // this property is assigned below and expanded to multiple lines in the getdown task
349 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
350 // this property is for the Java library used in eclipse
351 eclipseJavaRuntimeName = string("JavaSE-1.8")
352 } else if (JAVA_VERSION.equals("11")) {
353 JAVA_INTEGER_VERSION = string("11")
355 libDistDir = j11libDir
356 compile_source_compatibility = 11
357 compile_target_compatibility = 11
358 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
359 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
360 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
361 eclipseJavaRuntimeName = string("JavaSE-11")
362 /* compile without modules -- using classpath libraries
363 additional_compiler_args += [
364 '--module-path', modules_compileClasspath.asPath,
365 '--add-modules', j11modules
368 } else if (JAVA_VERSION.equals("12") || JAVA_VERSION.equals("13")) {
369 JAVA_INTEGER_VERSION = JAVA_VERSION
371 libDistDir = j11libDir
372 compile_source_compatibility = JAVA_VERSION
373 compile_target_compatibility = JAVA_VERSION
374 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
375 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
376 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
377 eclipseJavaRuntimeName = string("JavaSE-11")
378 /* compile without modules -- using classpath libraries
379 additional_compiler_args += [
380 '--module-path', modules_compileClasspath.asPath,
381 '--add-modules', j11modules
385 throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
390 JAVA_MIN_VERSION = JAVA_VERSION
391 JAVA_MAX_VERSION = JAVA_VERSION
392 def jreInstallsDir = string(jre_installs_dir)
393 if (jreInstallsDir.startsWith("~/")) {
394 jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1)
396 macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre")
397 macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-mac-x64.tar.gz")
398 windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre")
399 windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-windows-x64.tar.gz")
400 linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre")
401 linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-linux-x64.tar.gz")
402 install4jDir = string("${jalviewDir}/${install4j_utils_dir}")
403 install4jConfFileName = string("jalview-install4j-conf.install4j")
404 install4jConfFile = file("${install4jDir}/${install4jConfFileName}")
405 install4jHomeDir = install4j_home_dir
406 if (install4jHomeDir.startsWith("~/")) {
407 install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
412 buildingHTML = string("${jalviewDir}/${docDir}/building.html")
413 helpFile = string("${classesDir}/${help_dir}/help.jhm")
414 helpParentDir = string("${jalviewDir}/${help_parent_dir}")
415 helpSourceDir = string("${helpParentDir}/${help_dir}")
418 relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
419 jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs")
420 jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}")
422 jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir)
424 jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js")
426 jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib")
427 jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs")
428 jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core")
429 jalviewjsJalviewCoreHtmlFile = string("")
430 jalviewjsJalviewCoreName = string(jalviewjs_core_name)
431 jalviewjsCoreClasslists = []
432 jalviewjsJalviewTemplateName = string(jalviewjs_name)
433 jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
434 jalviewjsJ2sProps = null
436 eclipseWorkspace = null
437 eclipseBinary = string("")
438 eclipseVersion = string("")
448 outputDir = file(classesDir)
453 srcDirs += helpParentDir
456 jar.destinationDir = file("${jalviewDir}/${packageDir}")
458 compileClasspath = files(sourceSets.main.java.outputDir)
459 //compileClasspath += files(sourceSets.main.resources.srcDirs)
460 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
462 runtimeClasspath = compileClasspath
467 srcDirs = [ cloverInstrDir ]
468 outputDir = file("${buildDir}/${cloverClassesDir}")
472 srcDirs = sourceSets.main.resources.srcDirs
474 compileClasspath = configurations.cloverRuntime + files( sourceSets.clover.java.outputDir )
475 compileClasspath += files(sourceSets.main.java.outputDir)
476 compileClasspath += sourceSets.main.compileClasspath
477 compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}", include: ["**/*.jar"])
478 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
480 runtimeClasspath = compileClasspath
485 srcDirs testSourceDir
486 outputDir = file("${jalviewDir}/${testOutputDir}")
490 srcDirs = sourceSets.main.resources.srcDirs
493 compileClasspath = files( sourceSets.test.java.outputDir )
496 compileClasspath = sourceSets.clover.compileClasspath
498 compileClasspath += files(sourceSets.main.java.outputDir)
501 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
502 compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}/testnglibs", include: ["**/*.jar"])
503 compileClasspath += fileTree(dir: "${jalviewDir}/${utilsDir}/testlibs", include: ["**/*.jar"])
505 runtimeClasspath = compileClasspath
512 cloverCompile 'org.openclover:clover:4.4.1'
514 testCompile 'org.openclover:clover:4.4.1'
520 cloverRuntime.extendsFrom cloverCompile
524 // eclipse project and settings files creation, also used by buildship
527 name = eclipse_project_name
529 natures 'org.eclipse.jdt.core.javanature',
530 'org.eclipse.jdt.groovy.core.groovyNature',
531 'org.eclipse.buildship.core.gradleprojectnature'
533 buildCommand 'org.eclipse.jdt.core.javabuilder'
534 buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
538 //defaultOutputDir = sourceSets.main.java.outputDir
541 if (it.isCanBeResolved()) {
546 minusConfigurations += removeThese
547 plusConfigurations = [ ]
551 def removeTheseToo = []
552 HashMap<String, Boolean> alreadyAddedSrcPath = new HashMap<>();
553 cp.entries.each { entry ->
554 // This conditional removes all src classpathentries that a) have already been added or b) aren't "src" or "test".
555 // e.g. this removes the resources dir being copied into bin/main, bin/test AND bin/clover
556 // we add the resources and help/help dirs in as libs afterwards (see below)
557 if (entry.kind == 'src') {
558 if (alreadyAddedSrcPath.getAt(entry.path) || !(entry.path == bareSourceDir || entry.path == bareTestSourceDir)) {
559 removeTheseToo += entry
561 alreadyAddedSrcPath.putAt(entry.path, true)
566 cp.entries.removeAll(removeTheseToo)
568 //cp.entries += new Output("${eclipse_bin_dir}/main")
569 if (file(helpParentDir).isDirectory()) {
570 cp.entries += new Library(fileReference(helpParentDir))
572 if (file(resourceDir).isDirectory()) {
573 cp.entries += new Library(fileReference(resourceDir))
576 HashMap<String, Boolean> alreadyAddedLibPath = new HashMap<>();
578 sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
579 //don't want to add outputDir as eclipse is using its own output dir in bin/main
580 if (it.isDirectory() || ! it.exists()) {
581 // don't add dirs to classpath, especially if they don't exist
582 return false // groovy "continue" in .any closure
584 def itPath = it.toString()
585 if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
586 // make relative path
587 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
589 if (alreadyAddedLibPath.get(itPath)) {
590 //println("Not adding duplicate entry "+itPath)
592 //println("Adding entry "+itPath)
593 cp.entries += new Library(fileReference(itPath))
594 alreadyAddedLibPath.put(itPath, true)
598 sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
599 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
600 if (it.isDirectory() || ! it.exists()) {
601 // don't add dirs to classpath
602 return false // groovy "continue" in .any closure
605 def itPath = it.toString()
606 if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
607 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
609 if (alreadyAddedLibPath.get(itPath)) {
612 def lib = new Library(fileReference(itPath))
613 lib.entryAttributes["test"] = "true"
615 alreadyAddedLibPath.put(itPath, true)
623 containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
628 // for the IDE, use java 11 compatibility
629 sourceCompatibility = compile_source_compatibility
630 targetCompatibility = compile_target_compatibility
631 javaRuntimeName = eclipseJavaRuntimeName
633 // add in jalview project specific properties/preferences into eclipse core preferences
635 withProperties { props ->
636 def jalview_prefs = new Properties()
637 def ins = new FileInputStream("${jalviewDirAbsolutePath}/${eclipse_extra_jdt_prefs_file}")
638 jalview_prefs.load(ins)
640 jalview_prefs.forEach { t, v ->
641 if (props.getAt(t) == null) {
651 // Don't want these to be activated if in headless build
652 synchronizationTasks "eclipseSynchronizationTask"
653 autoBuildTasks "eclipseAutoBuildTask"
660 // only instrument source, we build test classes as normal
661 inputs.files files (sourceSets.main.allJava,sourceSets.test.allJava) // , fileTree(dir:"$jalviewDir/$testSourceDir", include: ["**/*.java"]))
662 outputs.dir cloverInstrDir
665 //delete cloverInstrDir
670 cloverInstrDir.getPath(),
673 inputs.files.files.collect(
674 { file -> file.absolutePath }
677 String[] args = argsList.toArray()
678 println("About to instrument "+args.length +" files")
679 com.atlassian.clover.CloverInstr.mainImpl(args)
684 cloverClasses.dependsOn cloverInstr
688 group = "Verification"
689 description = "Creates the Clover report"
690 inputs.dir "${buildDir}/clover"
691 outputs.dir "${reportsDir}/clover"
693 file(cloverDb).exists()
700 "${reportsDir}/clover"
702 String[] args = argsList.toArray()
703 com.atlassian.clover.reporters.html.HtmlReporter.runReport(args)
705 // and generate ${reportsDir}/clover/clover.xml
710 "${reportsDir}/clover/clover.xml"
712 com.atlassian.clover.reporters.xml.XMLReporter.runReport(args)
720 sourceCompatibility = compile_source_compatibility
721 targetCompatibility = compile_target_compatibility
722 options.compilerArgs += additional_compiler_args
723 print ("Setting target compatibility to "+targetCompatibility+"\n")
725 classpath += configurations.cloverRuntime
731 delete cloverInstrDir
741 sourceCompatibility = compile_source_compatibility
742 targetCompatibility = compile_target_compatibility
743 options.compilerArgs = additional_compiler_args
744 print ("Setting target compatibility to "+targetCompatibility+"\n")
752 dependsOn compileCloverJava
753 classpath += configurations.cloverRuntime
755 classpath += sourceSets.main.runtimeClasspath
758 sourceCompatibility = compile_source_compatibility
759 targetCompatibility = compile_target_compatibility
760 options.compilerArgs = additional_compiler_args
761 print ("Setting target compatibility to "+targetCompatibility+"\n")
768 delete sourceSets.main.java.outputDir
775 delete cloverInstrDir
782 dependsOn cleanClover
784 delete sourceSets.test.java.outputDir
789 // format is a string like date.format("dd MMMM yyyy")
790 def getDate(format) {
791 def date = new Date()
792 return date.format(format)
797 def hashStdOut = new ByteArrayOutputStream()
799 commandLine "git", "rev-parse", "--short", "HEAD"
800 standardOutput = hashStdOut
804 def branchStdOut = new ByteArrayOutputStream()
806 commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
807 standardOutput = branchStdOut
811 gitHash = hashStdOut.toString().trim()
812 gitBranch = branchStdOut.toString().trim()
814 outputs.upToDateWhen { false }
818 task createBuildProperties(type: WriteProperties) {
820 inputs.dir(sourceDir)
821 inputs.dir(resourceDir)
822 file(buildProperties).getParentFile().mkdirs()
823 outputFile (buildProperties)
824 // taking time specific comment out to allow better incremental builds
825 comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
826 //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
827 property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
828 property "VERSION", JALVIEW_VERSION
829 property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
830 outputs.file(outputFile)
834 task cleanBuildingHTML(type: Delete) {
841 task convertBuildingMD(type: Exec) {
842 dependsOn cleanBuildingHTML
843 def buildingMD = "${jalviewDir}/${docDir}/building.md"
844 def css = "${jalviewDir}/${docDir}/github.css"
847 pandoc_exec.split(",").each {
848 if (file(it.trim()).exists()) {
854 def hostname = "hostname".execute().text.trim()
855 def buildtoolsPandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc"
856 if ((pandoc == null || ! file(pandoc).exists()) && file(buildtoolsPandoc).exists()) {
857 pandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc"
861 if (pandoc != null && file(pandoc).exists()) {
862 commandLine pandoc, '-s', '-o', buildingHTML, '--metadata', 'pagetitle="Building Jalview from Source"', '--toc', '-H', css, buildingMD
864 println("Cannot find pandoc. Skipping convert building.md to HTML")
865 throw new StopExecutionException("Cannot find pandoc. Skipping convert building.md to HTML")
871 inputs.file(buildingMD)
873 outputs.file(buildingHTML)
884 task syncDocs(type: Sync) {
885 dependsOn convertBuildingMD
886 def syncDir = "${classesDir}/${docDir}"
887 from fileTree("${jalviewDir}/${docDir}")
893 task copyHelp(type: Copy) {
894 def inputDir = helpSourceDir
895 def outputDir = "${classesDir}/${help_dir}"
900 filter(ReplaceTokens,
904 'Version-Rel': JALVIEW_VERSION,
905 'Year-Rel': getDate("yyyy")
917 outputs.files(helpFile)
918 outputs.dir(outputDir)
922 task syncLib(type: Sync) {
923 def syncDir = "${classesDir}/${libDistDir}"
924 from fileTree("${jalviewDir}/${libDistDir}")
929 task syncResources(type: Sync) {
940 dependsOn syncResources
946 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
949 dependsOn compileJava
951 dependsOn cloverInstr
955 print("Running tests " + (use_clover?"WITH":"WITHOUT") + " clover [clover="+use_clover+"]\n")
959 includeGroups testngGroups
960 excludeGroups testngExcludedGroups
962 useDefaultListeners=true
965 maxHeapSize = "1024m"
967 workingDir = jalviewDir
968 //systemProperties 'clover.jar' System.properties.clover.jar
969 def testLaf = project.findProperty("test_laf")
970 if (testLaf != null) {
971 println("Setting Test LaF to '${testLaf}'")
972 systemProperty "laf", testLaf
974 def testHiDPIScale = project.findProperty("test_HiDPIScale")
975 if (testHiDPIScale != null) {
976 println("Setting Test HiDPI Scale to '${testHiDPIScale}'")
977 systemProperty "sun.java2d.uiScale", testHiDPIScale
979 sourceCompatibility = compile_source_compatibility
980 targetCompatibility = compile_target_compatibility
981 jvmArgs += additional_compiler_args
986 task buildIndices(type: JavaExec) {
988 classpath = sourceSets.main.compileClasspath
989 main = "com.sun.java.help.search.Indexer"
990 workingDir = "${classesDir}/${help_dir}"
993 inputs.dir("${workingDir}/${argDir}")
995 outputs.dir("${classesDir}/doc")
996 outputs.dir("${classesDir}/help")
997 outputs.file("${workingDir}/JavaHelpSearch/DOCS")
998 outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB")
999 outputs.file("${workingDir}/JavaHelpSearch/OFFSETS")
1000 outputs.file("${workingDir}/JavaHelpSearch/POSITIONS")
1001 outputs.file("${workingDir}/JavaHelpSearch/SCHEMA")
1002 outputs.file("${workingDir}/JavaHelpSearch/TMAP")
1006 task compileLinkCheck(type: JavaCompile) {
1008 classpath = files("${jalviewDir}/${utilsDir}")
1009 destinationDir = file("${jalviewDir}/${utilsDir}")
1010 source = fileTree(dir: "${jalviewDir}/${utilsDir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
1012 inputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.java")
1013 inputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.java")
1014 outputs.file("${jalviewDir}/${utilsDir}/HelpLinksChecker.class")
1015 outputs.file("${jalviewDir}/${utilsDir}/BufferedLineReader.class")
1019 task linkCheck(type: JavaExec) {
1020 dependsOn prepare, compileLinkCheck
1022 def helpLinksCheckerOutFile = file("${jalviewDir}/${utilsDir}/HelpLinksChecker.out")
1023 classpath = files("${jalviewDir}/${utilsDir}")
1024 main = "HelpLinksChecker"
1025 workingDir = jalviewDir
1026 args = [ "${classesDir}/${help_dir}", "-nointernet" ]
1028 def outFOS = new FileOutputStream(helpLinksCheckerOutFile, false) // false == don't append
1030 standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
1033 errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
1037 inputs.dir("${classesDir}/${help_dir}")
1038 outputs.file(helpLinksCheckerOutFile)
1041 // import the pubhtmlhelp target
1042 ant.properties.basedir = "${jalviewDir}"
1043 ant.properties.helpBuildDir = "${jalviewDirAbsolutePath}/${classes_dir}/${help_dir}"
1044 ant.importBuild "${utilsDir}/publishHelp.xml"
1047 task cleanPackageDir(type: Delete) {
1049 delete fileTree(dir: "${jalviewDir}/${packageDir}", include: "*.jar")
1055 dependsOn buildIndices
1056 dependsOn createBuildProperties
1059 attributes "Main-Class": mainClass,
1060 "Permissions": "all-permissions",
1061 "Application-Name": "Jalview Desktop",
1062 "Codebase": application_codebase
1065 destinationDir = file("${jalviewDir}/${packageDir}")
1066 archiveName = rootProject.name+".jar"
1072 exclude "**/*.jar.*"
1074 inputs.dir(classesDir)
1075 outputs.file("${jalviewDir}/${packageDir}/${archiveName}")
1079 task copyJars(type: Copy) {
1080 from fileTree(dir: classesDir, include: "**/*.jar").files
1081 into "${jalviewDir}/${packageDir}"
1085 // doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
1086 task syncJars(type: Sync) {
1087 from fileTree(dir: "${jalviewDir}/${libDistDir}", include: "**/*.jar").files
1088 into "${jalviewDir}/${packageDir}"
1090 include jar.archiveName
1097 description = "Put all required libraries in dist"
1098 // order of "cleanPackageDir", "copyJars", "jar" important!
1099 jar.mustRunAfter cleanPackageDir
1100 syncJars.mustRunAfter cleanPackageDir
1101 dependsOn cleanPackageDir
1104 outputs.dir("${jalviewDir}/${packageDir}")
1109 dependsOn cleanPackageDir
1115 group = "distribution"
1119 from ("${jalviewDir}/${libDistDir}") {
1123 attributes 'Implementation-Version': JALVIEW_VERSION
1125 mainClassName = shadowJarMainClass
1127 classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
1132 task getdownWebsite() {
1133 group = "distribution"
1134 description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
1139 def getdownWebsiteResourceFilenames = []
1140 def getdownTextString = ""
1141 def getdownResourceDir = getdownResourceDir
1142 def getdownResourceFilenames = []
1145 // clean the getdown website and files dir before creating getdown folders
1146 delete getdownWebsiteDir
1147 delete getdownFilesDir
1150 from buildProperties
1151 rename(build_properties_file, getdown_build_properties)
1154 getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
1156 // set some getdown_txt_ properties then go through all properties looking for getdown_txt_...
1157 def props = project.properties.sort { it.key }
1158 if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) {
1159 props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion)
1161 if (getdownAltJavaMaxVersion != null && getdownAltJavaMaxVersion.length() > 0) {
1162 props.put("getdown_txt_java_max_version", getdownAltJavaMaxVersion)
1164 if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
1165 props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
1168 props.put("getdown_txt_title", jalview_name)
1169 props.put("getdown_txt_ui.name", install4jApplicationName)
1171 // start with appbase
1172 getdownTextString += "appbase = ${getdownAppBase}\n"
1173 props.each{ prop, val ->
1174 if (prop.startsWith("getdown_txt_") && val != null) {
1175 if (prop.startsWith("getdown_txt_multi_")) {
1176 def key = prop.substring(18)
1177 val.split(",").each{ v ->
1178 def line = "${key} = ${v}\n"
1179 getdownTextString += line
1182 // file values rationalised
1183 if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
1185 if (val.indexOf('/') == 0) {
1188 } else if (val.indexOf('/') > 0) {
1189 // relative path (relative to jalviewDir)
1190 r = file( "${jalviewDir}/${val}" )
1193 val = "${getdown_resource_dir}/" + r.getName()
1194 getdownWebsiteResourceFilenames += val
1195 getdownResourceFilenames += r.getPath()
1198 if (! prop.startsWith("getdown_txt_resource")) {
1199 def line = prop.substring(12) + " = ${val}\n"
1200 getdownTextString += line
1206 getdownWebsiteResourceFilenames.each{ filename ->
1207 getdownTextString += "resource = ${filename}\n"
1209 getdownResourceFilenames.each{ filename ->
1212 into getdownResourceDir
1217 fileTree(file(packageDir)).each{ f ->
1218 if (f.isDirectory()) {
1219 def files = fileTree(dir: f, include: ["*"]).getFiles()
1221 } else if (f.exists()) {
1225 codeFiles.sort().each{f ->
1226 def name = f.getName()
1227 def line = "code = ${getdownAppDistDir}/${name}\n"
1228 getdownTextString += line
1235 // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
1237 if (JAVA_VERSION.equals("11")) {
1238 def j11libFiles = fileTree(dir: "${jalviewDir}/${j11libDir}", include: ["*.jar"]).getFiles()
1239 j11libFiles.sort().each{f ->
1240 def name = f.getName()
1241 def line = "code = ${getdown_j11lib_dir}/${name}\n"
1242 getdownTextString += line
1245 into getdownJ11libDir
1251 // 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.
1252 //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
1253 getdownTextString += "resource = ${getdown_launcher_new}\n"
1254 getdownTextString += "class = ${mainClass}\n"
1256 def getdown_txt = file("${getdownWebsiteDir}/getdown.txt")
1257 getdown_txt.write(getdownTextString)
1259 def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl"
1260 def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}")
1261 launchJvl.write("appbase=${getdownAppBase}")
1264 from getdownLauncher
1265 rename(file(getdownLauncher).getName(), getdown_launcher_new)
1266 into getdownWebsiteDir
1270 from getdownLauncher
1271 if (file(getdownLauncher).getName() != getdown_launcher) {
1272 rename(file(getdownLauncher).getName(), getdown_launcher)
1274 into getdownWebsiteDir
1277 if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
1280 from getdownLauncher
1281 from "${getdownWebsiteDir}/${getdown_build_properties}"
1282 if (file(getdownLauncher).getName() != getdown_launcher) {
1283 rename(file(getdownLauncher).getName(), getdown_launcher)
1285 into getdownInstallDir
1289 from getdownInstallDir
1290 into getdownFilesInstallDir
1297 from getdownLauncher
1298 from "${getdownWebsiteDir}/${getdown_build_properties}"
1299 if (file(getdownLauncher).getName() != getdown_launcher) {
1300 rename(file(getdownLauncher).getName(), getdown_launcher)
1302 into getdownFilesDir
1306 from getdownResourceDir
1307 into "${getdownFilesDir}/${getdown_resource_dir}"
1312 inputs.dir("${jalviewDir}/${packageDir}")
1314 outputs.dir(getdownWebsiteDir)
1315 outputs.dir(getdownFilesDir)
1319 // a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
1320 task getdownDigestDir(type: JavaExec) {
1322 description "A task to run a getdown Digest on a dir with getdown.txt. Provide a DIGESTDIR property via -PDIGESTDIR=..."
1324 def digestDirPropertyName = "DIGESTDIR"
1326 classpath = files(getdownLauncher)
1327 def digestDir = findProperty(digestDirPropertyName)
1328 if (digestDir == null) {
1329 throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
1333 main = "com.threerings.getdown.tools.Digester"
1337 task getdownDigest(type: JavaExec) {
1338 group = "distribution"
1339 description = "Digest the getdown website folder"
1340 dependsOn getdownWebsite
1342 classpath = files(getdownLauncher)
1344 main = "com.threerings.getdown.tools.Digester"
1345 args getdownWebsiteDir
1346 inputs.dir(getdownWebsiteDir)
1347 outputs.file("${getdownWebsiteDir}/digest2.txt")
1352 group = "distribution"
1353 description = "Create the minimal and full getdown app folder for installers and website and create digest file"
1354 dependsOn getdownDigest
1356 if (reportRsyncCommand) {
1357 def fromDir = getdownWebsiteDir + (getdownWebsiteDir.endsWith('/')?'':'/')
1358 def toDir = "${getdown_rsync_dest}/${getdownDir}" + (getdownDir.endsWith('/')?'':'/')
1359 println "LIKELY RSYNC COMMAND:"
1360 println "mkdir -p '$toDir'\nrsync -avh --delete '$fromDir' '$toDir'"
1361 if (RUNRSYNC == "true") {
1363 commandLine "mkdir", "-p", toDir
1366 commandLine "rsync", "-avh", "--delete", fromDir, toDir
1376 delete getdownWebsiteDir
1377 delete getdownFilesDir
1383 if (file(install4jHomeDir).exists()) {
1385 } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
1386 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
1387 } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
1388 install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
1390 installDir(file(install4jHomeDir))
1392 mediaTypes = Arrays.asList(install4j_media_types.split(","))
1396 task copyInstall4jTemplate {
1397 def install4jTemplateFile = file("${install4jDir}/${install4j_template}")
1398 def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}")
1399 inputs.file(install4jTemplateFile)
1400 inputs.file(install4jFileAssociationsFile)
1401 inputs.property("CHANNEL", { CHANNEL })
1402 outputs.file(install4jConfFile)
1405 def install4jConfigXml = new XmlParser().parse(install4jTemplateFile)
1407 // turn off code signing if no OSX_KEYPASS
1408 if (OSX_KEYPASS == "") {
1409 install4jConfigXml.'**'.codeSigning.each { codeSigning ->
1410 codeSigning.'@macEnabled' = "false"
1412 install4jConfigXml.'**'.windows.each { windows ->
1413 windows.'@runPostProcessor' = "false"
1417 // turn off checksum creation for LOCAL channel
1418 def e = install4jConfigXml.application[0]
1419 if (CHANNEL == "LOCAL") {
1420 e.'@createChecksums' = "false"
1422 e.'@createChecksums' = "true"
1425 // put file association actions where placeholder action is
1426 def install4jFileAssociationsText = install4jFileAssociationsFile.text
1427 def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
1428 install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true
1429 if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') {
1430 def parent = a.parent()
1432 fileAssociationActions.each { faa ->
1435 // don't need to continue in .any loop once replacements have been made
1440 // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else
1441 // NB we're deleting the /other/ one!
1442 // Also remove the examples subdir from non-release versions
1443 def customizedIdToDelete = "PROGRAM_GROUP_RELEASE"
1444 // 2.11.1.0 NOT releasing with the Examples folder in the Program Group
1445 if (false && CHANNEL=="RELEASE") { // remove 'false && ' to include Examples folder in RELEASE channel
1446 customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE"
1448 // remove the examples subdir from Full File Set
1449 def files = install4jConfigXml.files[0]
1450 def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" }
1451 def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' }
1452 def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' }
1453 def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" }
1454 dirEntry.parent().remove(dirEntry)
1456 install4jConfigXml.'**'.action.any { a ->
1457 if (a.'@customizedId' == customizedIdToDelete) {
1458 def parent = a.parent()
1464 // remove the "Uninstall Old Jalview (optional)" symlink from DMG for non-release DS_Stores
1465 if (! (CHANNEL == "RELEASE" || CHANNEL == "TEST-RELEASE" ) ) {
1466 def symlink = install4jConfigXml.'**'.topLevelFiles.symlink.find { sl -> sl.'@name' == "Uninstall Old Jalview (optional).app" }
1467 symlink.parent().remove(symlink)
1470 // write install4j file
1471 install4jConfFile.text = XmlUtil.serialize(install4jConfigXml)
1478 delete install4jConfFile
1483 task installers(type: com.install4j.gradle.Install4jTask) {
1484 group = "distribution"
1485 description = "Create the install4j installers"
1486 dependsOn setGitVals
1488 dependsOn copyInstall4jTemplate
1490 projectFile = install4jConfFile
1492 // create an md5 for the input files to use as version for install4j conf file
1493 def digest = MessageDigest.getInstance("MD5")
1495 (file("${install4jDir}/${install4j_template}").text +
1496 file("${install4jDir}/${install4j_info_plist_file_associations}").text +
1497 file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
1498 def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
1499 if (filesMd5.length() >= 8) {
1500 filesMd5 = filesMd5.substring(0,8)
1502 def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
1503 // make install4jBuildDir relative to jalviewDir
1504 def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
1507 'JALVIEW_NAME': jalview_name,
1508 'JALVIEW_APPLICATION_NAME': install4jApplicationName,
1509 'JALVIEW_DIR': "../..",
1510 'OSX_KEYSTORE': OSX_KEYSTORE,
1511 'JSIGN_SH': JSIGN_SH,
1512 'JRE_DIR': getdown_app_dir_java,
1513 'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
1514 'JALVIEW_VERSION': JALVIEW_VERSION,
1515 'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
1516 'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
1517 'JAVA_VERSION': JAVA_VERSION,
1518 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
1519 'VERSION': JALVIEW_VERSION,
1520 'MACOS_JAVA_VM_DIR': macosJavaVMDir,
1521 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
1522 'LINUX_JAVA_VM_DIR': linuxJavaVMDir,
1523 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
1524 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
1525 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
1526 'COPYRIGHT_MESSAGE': install4j_copyright_message,
1527 'BUNDLE_ID': install4jBundleId,
1528 'INTERNAL_ID': install4jInternalId,
1529 'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
1530 'MACOS_DS_STORE': install4jDSStore,
1531 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
1532 'INSTALLER_NAME': install4jInstallerName,
1533 'INSTALL4J_UTILS_DIR': install4j_utils_dir,
1534 'GETDOWN_WEBSITE_DIR': getdown_website_dir,
1535 'GETDOWN_FILES_DIR': getdown_files_dir,
1536 'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
1537 'GETDOWN_DIST_DIR': getdownAppDistDir,
1538 'GETDOWN_ALT_DIR': getdown_app_dir_alt,
1539 'GETDOWN_INSTALL_DIR': getdown_install_dir,
1540 'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
1541 'BUILD_DIR': install4jBuildDir,
1542 'APPLICATION_CATEGORIES': install4j_application_categories,
1543 'APPLICATION_FOLDER': install4jApplicationFolder,
1544 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
1545 'EXECUTABLE_NAME': install4jExecutableName,
1546 'EXTRA_SCHEME': install4jExtraScheme,
1549 //println("INSTALL4J VARIABLES:")
1550 //variables.each{k,v->println("${k}=${v}")}
1552 destination = "${jalviewDir}/${install4jBuildDir}"
1553 buildSelected = true
1555 if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
1557 disableSigning = true
1561 macKeystorePassword = OSX_KEYPASS
1565 println("Using projectFile "+projectFile)
1568 inputs.dir(getdownWebsiteDir)
1569 inputs.file(install4jConfFile)
1570 inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
1571 inputs.dir(macosJavaVMDir)
1572 inputs.dir(windowsJavaVMDir)
1573 outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
1577 task sourceDist(type: Tar) {
1579 def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
1580 def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz"
1581 // cater for buildship < 3.1 [3.0.1 is max version in eclipse 2018-09]
1583 archiveFileName = outputFileName
1584 } catch (Exception e) {
1585 archiveName = outputFileName
1588 compression Compression.GZIP
1603 "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales",
1605 "utils/InstallAnywhere",
1620 "gradle.properties",
1631 ".settings/org.eclipse.jdt.core.jalview.prefs",
1635 exclude (EXCLUDE_FILES)
1636 include (PROCESS_FILES)
1637 filter(ReplaceTokens,
1641 'Version-Rel': JALVIEW_VERSION,
1642 'Year-Rel': getDate("yyyy")
1647 exclude (EXCLUDE_FILES)
1648 exclude (PROCESS_FILES)
1649 exclude ("appletlib")
1650 exclude ("**/*locales")
1651 exclude ("*locales/**")
1652 exclude ("utils/InstallAnywhere")
1654 exclude (getdown_files_dir)
1655 exclude (getdown_website_dir)
1657 // exluding these as not using jars as modules yet
1658 exclude ("$j11modDir/**/*.jar")
1661 include(INCLUDE_FILES)
1663 // from (jalviewDir) {
1664 // // explicit includes for stuff that seemed to not get included
1665 // include(fileTree("test/**/*."))
1666 // exclude(EXCLUDE_FILES)
1667 // exclude(PROCESS_FILES)
1674 dependsOn pubhtmlhelp
1676 inputs.dir("${classesDir}/${help_dir}")
1677 outputs.dir("${buildDir}/distributions/${help_dir}")
1680 // LARGE AMOUNT OF JALVIEWJS STUFF DELETED HERE
1681 task eclipseAutoBuildTask {}
1682 task eclipseSynchronizationTask {}