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
23 id 'com.github.johnrengelman.shadow' version '4.0.3'
24 id 'com.install4j.gradle' version '8.0.4'
25 id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
35 // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use
36 def string(Object o) {
37 return o == null ? "" : o.toString()
42 jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
43 jalviewDirRelativePath = jalviewDir
45 // local build environment properties
46 // can be "projectDir/local.properties"
47 def localProps = "${projectDir}/local.properties"
49 if (file(localProps).exists()) {
50 propsFile = localProps
52 // or "../projectDir_local.properties"
53 def dirLocalProps = projectDir.getParent() + "/" + projectDir.getName() + "_local.properties"
54 if (file(dirLocalProps).exists()) {
55 propsFile = dirLocalProps
57 if (propsFile != null) {
59 def p = new Properties()
60 def localPropsFIS = new FileInputStream(propsFile)
65 def oldval = findProperty(key)
68 println("Overriding property '${key}' ('${oldval}') with ${file(propsFile).getName()} value '${val}'")
70 println("Setting unknown property '${key}' with ${file(propsFile).getName()}s value '${val}'")
73 } catch (Exception e) {
74 System.out.println("Exception reading local.properties")
79 // Import releaseProps from the RELEASE file
80 // or a file specified via JALVIEW_RELEASE_FILE if defined
81 // Expect jalview.version and target release branch in jalview.release
82 def releaseProps = new Properties();
83 def releasePropFile = findProperty("JALVIEW_RELEASE_FILE");
84 def defaultReleasePropFile = "${jalviewDirAbsolutePath}/RELEASE";
86 (new File(releasePropFile!=null ? releasePropFile : defaultReleasePropFile)).withInputStream {
89 } catch (Exception fileLoadError) {
90 throw new Error("Couldn't load release properties file "+(releasePropFile==null ? defaultReleasePropFile : "from custom location: releasePropFile"),fileLoadError);
93 // Set JALVIEW_VERSION if it is not already set
94 if (findProperty(JALVIEW_VERSION)==null || "".equals(JALVIEW_VERSION)) {
95 JALVIEW_VERSION = releaseProps.get("jalview.version")
98 // this property set when running Eclipse headlessly
99 j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
100 // this property set by Eclipse
101 eclipseApplicationProperty = string("eclipse.application")
102 // CHECK IF RUNNING FROM WITHIN ECLIPSE
103 def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty]
104 IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.")
105 // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET
106 if (System.properties[j2sHeadlessBuildProperty].equals("true")) {
107 println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'")
111 println("WITHIN ECLIPSE IDE")
113 println("HEADLESS BUILD")
116 System.properties.sort { it.key }.each {
117 key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
120 if (false && IN_ECLIPSE) {
121 jalviewDir = jalviewDirAbsolutePath
126 bareSourceDir = string(source_dir)
127 sourceDir = string("${jalviewDir}/${bareSourceDir}")
128 resourceDir = string("${jalviewDir}/${resource_dir}")
129 bareTestSourceDir = string(test_source_dir)
130 testSourceDir = string("${jalviewDir}/${bareTestSourceDir}")
132 classesDir = string("${jalviewDir}/${classes_dir}")
135 useClover = clover.equals("true")
136 cloverInstrDir = file("${buildDir}/clover/${clover_sources_instr_dir}")
137 cloverClassesDir = file("${buildDir}/clover/${clover_classes_dir}")
138 cloverReportDir = file("${buildDir}/clover/${clover_report_dir}")
139 cloverDb = string("${buildDir}/clover/clover.db")
141 resourceClassesDir = useClover ? cloverClassesDir : classesDir
143 getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
146 // the following values might be overridden by the CHANNEL switch
147 getdownChannelName = CHANNEL.toLowerCase()
148 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
149 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
150 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
151 getdownAppDistDir = getdown_app_dir_alt
152 buildProperties = string("${classesDir}/${build_properties_file}")
153 reportRsyncCommand = false
154 jvlChannelName = CHANNEL.toLowerCase()
155 install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
156 install4jDSStore = "DS_Store-NON-RELEASE"
157 install4jDMGBackgroundImage = "jalview_dmg_background-NON-RELEASE.png"
158 install4jInstallerName = "${jalview_name} Non-Release Installer"
159 install4jExecutableName = jalview_name.replaceAll("[^\\w]+", "_").toLowerCase()
160 install4jExtraScheme = "jalviewx"
164 // TODO: get bamboo build artifact URL for getdown artifacts
165 getdown_channel_base = bamboo_channelbase
166 getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
167 getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
168 jvlChannelName += "_${getdownChannelName}"
169 // automatically add the test group Not-bamboo for exclusion
170 if ("".equals(testng_excluded_groups)) {
171 testng_excluded_groups = "Not-bamboo"
173 install4jExtraScheme = "jalviewb"
177 getdownAppDistDir = getdown_app_dir_release
178 reportRsyncCommand = true
180 install4jDSStore = "DS_Store"
181 install4jDMGBackgroundImage = "jalview_dmg_background.png"
182 install4jInstallerName = "${jalview_name} Installer"
186 getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
187 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
188 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
189 if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
190 throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
192 packageDir = string("${ARCHIVEDIR}/${packageDir}")
193 buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
196 reportRsyncCommand = true
197 install4jExtraScheme = "jalviewa"
201 getdownChannelName = string("archive/${JALVIEW_VERSION}")
202 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
203 getdownAppBase = file(getdownWebsiteDir).toURI().toString()
204 if (!file("${ARCHIVEDIR}/${packageDir}").exists()) {
205 throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
207 packageDir = string("${ARCHIVEDIR}/${packageDir}")
208 buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
211 reportRsyncCommand = true
212 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
213 install4jSuffix = "Archive"
214 install4jExtraScheme = "jalviewa"
218 reportRsyncCommand = true
220 // DEVELOP-RELEASE is usually associated with a Jalview release series so set the version
221 JALVIEW_VERSION=JALVIEW_VERSION+"-develop"
223 install4jSuffix = "Develop"
224 install4jDSStore = "DS_Store-DEVELOP"
225 install4jDMGBackgroundImage = "jalview_dmg_background-DEVELOP.png"
226 install4jExtraScheme = "jalviewd"
227 install4jInstallerName = "${jalview_name} Develop Installer"
231 reportRsyncCommand = true
233 // TEST-RELEASE is usually associated with a Jalview release series so set the version
234 JALVIEW_VERSION=JALVIEW_VERSION+"-test"
236 install4jSuffix = "Test"
237 install4jDSStore = "DS_Store-TEST-RELEASE"
238 install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png"
239 install4jExtraScheme = "jalviewt"
240 install4jInstallerName = "${jalview_name} Test Installer"
243 case ~/^SCRATCH(|-[-\w]*)$/:
244 getdownChannelName = CHANNEL
245 getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
246 getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
247 reportRsyncCommand = true
248 install4jSuffix = "Scratch"
252 if (!file("${LOCALDIR}").exists()) {
253 throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
255 getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
256 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
258 JALVIEW_VERSION = "TEST"
259 install4jSuffix = "Test-Local"
260 install4jDSStore = "DS_Store-TEST-RELEASE"
261 install4jDMGBackgroundImage = "jalview_dmg_background-TEST.png"
262 install4jExtraScheme = "jalviewt"
263 install4jInstallerName = "${jalview_name} Test Installer"
267 getdownAppBase = file(getdownWebsiteDir).toURI().toString()
268 getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
269 install4jExtraScheme = "jalviewl"
272 default: // something wrong specified
273 throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
277 // override getdownAppBase if requested
278 if (findProperty("getdown_appbase_override") != null) {
279 getdownAppBase = string(getProperty("getdown_appbase_override"))
280 println("Overriding getdown appbase with '${getdownAppBase}'")
282 // sanitise file name for jalview launcher file for this channel
283 jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_")
284 // install4j application and folder names
285 if (install4jSuffix == "") {
286 install4jApplicationName = "${jalview_name}"
287 install4jBundleId = "${install4j_bundle_id}"
288 install4jWinApplicationId = install4j_release_win_application_id
290 install4jApplicationName = "${jalview_name} ${install4jSuffix}"
291 install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
292 // add int hash of install4jSuffix to the last part of the application_id
293 def id = install4j_release_win_application_id
294 def idsplitreverse = id.split("-").reverse()
295 idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
296 install4jWinApplicationId = idsplitreverse.reverse().join("-")
298 // sanitise folder and id names
299 // install4jApplicationFolder = e.g. "Jalview Build"
300 install4jApplicationFolder = install4jApplicationName
301 .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
302 .replaceAll("_+", "_") // collapse __
303 install4jInternalId = install4jApplicationName
305 .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
306 .replaceAll("_+", "") // collapse __
307 //.replaceAll("_*-_*", "-") // collapse _-_
308 install4jUnixApplicationFolder = install4jApplicationName
310 .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
311 .replaceAll("_+", "_") // collapse __
312 .replaceAll("_*-_*", "-") // collapse _-_
315 getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
316 //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
317 getdownResourceDir = string("${getdownWebsiteDir}/${getdown_resource_dir}")
318 getdownInstallDir = string("${getdownWebsiteDir}/${getdown_install_dir}")
319 getdownFilesDir = string("${jalviewDir}/${getdown_files_dir}/${JAVA_VERSION}/")
320 getdownFilesInstallDir = string("${getdownFilesDir}/${getdown_install_dir}")
321 /* compile without modules -- using classpath libraries
322 modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
323 modules_runtimeClasspath = modules_compileClasspath
326 gitBranch = string("")
328 println("Using a ${CHANNEL} profile.")
330 additional_compiler_args = []
331 // configure classpath/args for j8/j11 compilation
332 if (JAVA_VERSION.equals("1.8")) {
333 JAVA_INTEGER_VERSION = string("8")
336 libDistDir = j8libDir
337 compile_source_compatibility = 1.8
338 compile_target_compatibility = 1.8
339 // these are getdown.txt properties defined dependent on the JAVA_VERSION
340 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
341 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
342 // this property is assigned below and expanded to multiple lines in the getdown task
343 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
344 // this property is for the Java library used in eclipse
345 eclipseJavaRuntimeName = string("JavaSE-1.8")
346 } else if (JAVA_VERSION.equals("11")) {
347 JAVA_INTEGER_VERSION = string("11")
349 libDistDir = j11libDir
350 compile_source_compatibility = 11
351 compile_target_compatibility = 11
352 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
353 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
354 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
355 eclipseJavaRuntimeName = string("JavaSE-11")
356 /* compile without modules -- using classpath libraries
357 additional_compiler_args += [
358 '--module-path', modules_compileClasspath.asPath,
359 '--add-modules', j11modules
362 } else if (JAVA_VERSION.equals("12") || JAVA_VERSION.equals("13")) {
363 JAVA_INTEGER_VERSION = JAVA_VERSION
365 libDistDir = j11libDir
366 compile_source_compatibility = JAVA_VERSION
367 compile_target_compatibility = JAVA_VERSION
368 getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
369 getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
370 getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
371 eclipseJavaRuntimeName = string("JavaSE-11")
372 /* compile without modules -- using classpath libraries
373 additional_compiler_args += [
374 '--module-path', modules_compileClasspath.asPath,
375 '--add-modules', j11modules
379 throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
384 JAVA_MIN_VERSION = JAVA_VERSION
385 JAVA_MAX_VERSION = JAVA_VERSION
386 def jreInstallsDir = string(jre_installs_dir)
387 if (jreInstallsDir.startsWith("~/")) {
388 jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1)
390 macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre")
391 macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-mac-x64.tar.gz")
392 windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre")
393 windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-windows-x64.tar.gz")
394 linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre")
395 linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-linux-x64.tar.gz")
396 install4jDir = string("${jalviewDir}/${install4j_utils_dir}")
397 install4jConfFileName = string("jalview-install4j-conf.install4j")
398 install4jConfFile = file("${install4jDir}/${install4jConfFileName}")
399 install4jHomeDir = install4j_home_dir
400 if (install4jHomeDir.startsWith("~/")) {
401 install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
406 buildingHTML = string("${jalviewDir}/${doc_dir}/building.html")
407 helpFile = string("${resourceClassesDir}/${help_dir}/help.jhm")
408 helpParentDir = string("${jalviewDir}/${help_parent_dir}")
409 helpSourceDir = string("${helpParentDir}/${help_dir}")
412 relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
413 jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs")
414 jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}")
416 jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir)
418 jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js")
420 jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib")
421 jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs")
422 jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core")
423 jalviewjsJalviewCoreHtmlFile = string("")
424 jalviewjsJalviewCoreName = string(jalviewjs_core_name)
425 jalviewjsCoreClasslists = []
426 jalviewjsJalviewTemplateName = string(jalviewjs_name)
427 jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
428 jalviewjsJ2sProps = null
430 eclipseWorkspace = null
431 eclipseBinary = string("")
432 eclipseVersion = string("")
442 outputDir = file(classesDir)
447 srcDirs += helpParentDir
450 jar.destinationDir = file("${jalviewDir}/${packageDir}")
452 compileClasspath = files(sourceSets.main.java.outputDir)
453 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
455 runtimeClasspath = compileClasspath
460 srcDirs cloverInstrDir
461 outputDir = cloverClassesDir
465 srcDirs = sourceSets.main.resources.srcDirs
468 compileClasspath = files( sourceSets.clover.java.outputDir )
469 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
470 compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
472 runtimeClasspath = compileClasspath
477 srcDirs testSourceDir
478 outputDir = file("${jalviewDir}/${test_output_dir}")
482 srcDirs = useClover ? sourceSets.clover.resources.srcDirs : sourceSets.main.resources.srcDirs
485 compileClasspath = files( sourceSets.test.java.outputDir )
486 compileClasspath += useClover ? sourceSets.clover.compileClasspath : sourceSets.main.compileClasspath
487 compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"])
489 runtimeClasspath = compileClasspath
494 // eclipse project and settings files creation, also used by buildship
497 name = eclipse_project_name
499 natures 'org.eclipse.jdt.core.javanature',
500 'org.eclipse.jdt.groovy.core.groovyNature',
501 'org.eclipse.buildship.core.gradleprojectnature'
503 buildCommand 'org.eclipse.jdt.core.javabuilder'
504 buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
508 //defaultOutputDir = sourceSets.main.java.outputDir
511 if (it.isCanBeResolved()) {
516 minusConfigurations += removeThese
517 plusConfigurations = [ ]
521 def removeTheseToo = []
522 HashMap<String, Boolean> alreadyAddedSrcPath = new HashMap<>();
523 cp.entries.each { entry ->
524 // This conditional removes all src classpathentries that a) have already been added or b) aren't "src" or "test".
525 // e.g. this removes the resources dir being copied into bin/main, bin/test AND bin/clover
526 // we add the resources and help/help dirs in as libs afterwards (see below)
527 if (entry.kind == 'src') {
528 if (alreadyAddedSrcPath.getAt(entry.path) || !(entry.path == bareSourceDir || entry.path == bareTestSourceDir)) {
529 removeTheseToo += entry
531 alreadyAddedSrcPath.putAt(entry.path, true)
536 cp.entries.removeAll(removeTheseToo)
538 //cp.entries += new Output("${eclipse_bin_dir}/main")
539 if (file(helpParentDir).isDirectory()) {
540 cp.entries += new Library(fileReference(helpParentDir))
542 if (file(resourceDir).isDirectory()) {
543 cp.entries += new Library(fileReference(resourceDir))
546 HashMap<String, Boolean> alreadyAddedLibPath = new HashMap<>();
548 sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
549 //don't want to add outputDir as eclipse is using its own output dir in bin/main
550 if (it.isDirectory() || ! it.exists()) {
551 // don't add dirs to classpath, especially if they don't exist
552 return false // groovy "continue" in .any closure
554 def itPath = it.toString()
555 if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
556 // make relative path
557 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
559 if (alreadyAddedLibPath.get(itPath)) {
560 //println("Not adding duplicate entry "+itPath)
562 //println("Adding entry "+itPath)
563 cp.entries += new Library(fileReference(itPath))
564 alreadyAddedLibPath.put(itPath, true)
568 sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
569 //no longer want to add outputDir as eclipse is using its own output dir in bin/main
570 if (it.isDirectory() || ! it.exists()) {
571 // don't add dirs to classpath
572 return false // groovy "continue" in .any closure
575 def itPath = it.toString()
576 if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
577 itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
579 if (alreadyAddedLibPath.get(itPath)) {
582 def lib = new Library(fileReference(itPath))
583 lib.entryAttributes["test"] = "true"
585 alreadyAddedLibPath.put(itPath, true)
593 containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
598 // for the IDE, use java 11 compatibility
599 sourceCompatibility = compile_source_compatibility
600 targetCompatibility = compile_target_compatibility
601 javaRuntimeName = eclipseJavaRuntimeName
603 // add in jalview project specific properties/preferences into eclipse core preferences
605 withProperties { props ->
606 def jalview_prefs = new Properties()
607 def ins = new FileInputStream("${jalviewDirAbsolutePath}/${eclipse_extra_jdt_prefs_file}")
608 jalview_prefs.load(ins)
610 jalview_prefs.forEach { t, v ->
611 if (props.getAt(t) == null) {
621 // Don't want these to be activated if in headless build
622 synchronizationTasks "eclipseSynchronizationTask"
623 autoBuildTasks "eclipseAutoBuildTask"
632 task cloverInstr(type: JavaExec) {
633 group = "Verification"
634 description = "Create clover instrumented source files"
636 inputs.files(sourceSets.main.allJava)
637 outputs.dir(cloverInstrDir)
639 //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
640 classpath = sourceSets.clover.compileClasspath
641 main = "com.atlassian.clover.CloverInstr"
649 cloverInstrDir.getPath(),
651 def srcFiles = sourceSets.main.allJava.files
654 { file -> file.absolutePath }
657 args argsList.toArray()
660 delete cloverInstrDir
662 println("Clover: About to instrument "+srcFiles.size() +" files")
667 cloverClasses.dependsOn cloverInstr
670 task cloverXmlReport(type: JavaExec) {
671 group = "Verification"
672 description = "Creates clover XML report"
674 inputs.dir cloverClassesDir
675 outputs.dir cloverReportDir
677 file(cloverDb).exists()
680 classpath = sourceSets.clover.runtimeClasspath
681 main = "com.atlassian.clover.reporters.xml.XMLReporter"
688 "${cloverReportDir}/clover.xml"
691 args argsList.toArray()
695 task cloverHtmlReport(type: JavaExec) {
696 group = "Verification"
697 description = "Creates clover HTML report"
699 inputs.dir cloverClassesDir
700 outputs.dir cloverReportDir
702 file(cloverDb).exists()
705 classpath = sourceSets.clover.runtimeClasspath
706 main = "com.atlassian.clover.reporters.html.HtmlReporter"
713 "${cloverReportDir}/clover"
716 args argsList.toArray()
721 group = "Verification"
722 description = "Creates clover reports"
724 dependsOn cloverXmlReport
725 dependsOn cloverHtmlReport
732 sourceCompatibility = compile_source_compatibility
733 targetCompatibility = compile_target_compatibility
734 options.compilerArgs += additional_compiler_args
735 print ("Setting target compatibility to "+targetCompatibility+"\n")
737 classpath += configurations.cloverRuntime
743 delete "${buildDir/clover}"
752 sourceCompatibility = compile_source_compatibility
753 targetCompatibility = compile_target_compatibility
754 options.compilerArgs = additional_compiler_args
755 print ("Setting target compatibility to "+targetCompatibility+"\n")
763 sourceCompatibility = compile_source_compatibility
764 targetCompatibility = compile_target_compatibility
765 options.compilerArgs = additional_compiler_args
766 print ("Setting target compatibility to "+targetCompatibility+"\n")
773 delete sourceSets.main.java.outputDir
779 dependsOn cleanClover
781 delete sourceSets.test.java.outputDir
786 // format is a string like date.format("dd MMMM yyyy")
787 def getDate(format) {
788 def date = new Date()
789 return date.format(format)
794 def hashStdOut = new ByteArrayOutputStream()
796 commandLine "git", "rev-parse", "--short", "HEAD"
797 standardOutput = hashStdOut
801 def branchStdOut = new ByteArrayOutputStream()
803 commandLine "git", "rev-parse", "--abbrev-ref", "HEAD"
804 standardOutput = branchStdOut
808 gitHash = hashStdOut.toString().trim()
809 gitBranch = branchStdOut.toString().trim()
811 outputs.upToDateWhen { false }
815 task createBuildProperties(type: WriteProperties) {
817 inputs.dir(sourceDir)
818 inputs.dir(resourceDir)
819 file(buildProperties).getParentFile().mkdirs()
820 outputFile (buildProperties)
821 // taking time specific comment out to allow better incremental builds
822 comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
823 //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
824 property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
825 property "VERSION", JALVIEW_VERSION
826 property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
827 outputs.file(outputFile)
831 task cleanBuildingHTML(type: Delete) {
838 task convertBuildingMD(type: Exec) {
839 dependsOn cleanBuildingHTML
840 def buildingMD = "${jalviewDir}/${doc_dir}/building.md"
841 def css = "${jalviewDir}/${doc_dir}/github.css"
844 pandoc_exec.split(",").each {
845 if (file(it.trim()).exists()) {
851 def hostname = "hostname".execute().text.trim()
852 def buildtoolsPandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc"
853 if ((pandoc == null || ! file(pandoc).exists()) && file(buildtoolsPandoc).exists()) {
854 pandoc = System.getProperty("user.home")+"/buildtools/pandoc/bin/pandoc"
858 if (pandoc != null && file(pandoc).exists()) {
859 commandLine pandoc, '-s', '-o', buildingHTML, '--metadata', 'pagetitle="Building Jalview from Source"', '--toc', '-H', css, buildingMD
861 println("Cannot find pandoc. Skipping convert building.md to HTML")
862 throw new StopExecutionException("Cannot find pandoc. Skipping convert building.md to HTML")
868 inputs.file(buildingMD)
870 outputs.file(buildingHTML)
881 task syncDocs(type: Sync) {
882 dependsOn convertBuildingMD
883 def syncDir = "${resourceClassesDir}/${doc_dir}"
884 from fileTree("${jalviewDir}/${doc_dir}")
890 task copyHelp(type: Copy) {
891 def inputDir = helpSourceDir
892 def outputDir = "${resourceClassesDir}/${help_dir}"
897 filter(ReplaceTokens,
901 'Version-Rel': JALVIEW_VERSION,
902 'Year-Rel': getDate("yyyy")
914 outputs.files(helpFile)
915 outputs.dir(outputDir)
919 task syncLib(type: Sync) {
920 def syncDir = "${resourceClassesDir}/${libDistDir}"
921 from fileTree("${jalviewDir}/${libDistDir}")
926 task syncResources(type: Sync) {
929 into "${resourceClassesDir}"
937 dependsOn syncResources
943 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
948 dependsOn cloverClasses
950 dependsOn compileJava
954 includeGroups testng_groups
955 excludeGroups testng_excluded_groups
957 useDefaultListeners=true
960 maxHeapSize = "1024m"
962 workingDir = jalviewDir
963 //systemProperties 'clover.jar' System.properties.clover.jar
964 def testLaf = project.findProperty("test_laf")
965 if (testLaf != null) {
966 println("Setting Test LaF to '${testLaf}'")
967 systemProperty "laf", testLaf
969 def testHiDPIScale = project.findProperty("test_HiDPIScale")
970 if (testHiDPIScale != null) {
971 println("Setting Test HiDPI Scale to '${testHiDPIScale}'")
972 systemProperty "sun.java2d.uiScale", testHiDPIScale
974 sourceCompatibility = compile_source_compatibility
975 targetCompatibility = compile_target_compatibility
976 jvmArgs += additional_compiler_args
980 print("Running tests " + (useClover?"WITH":"WITHOUT") + " clover [clover="+useClover+"]\n")
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}/${utils_dir}")
1009 destinationDir = file("${jalviewDir}/${utils_dir}")
1010 source = fileTree(dir: "${jalviewDir}/${utils_dir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
1012 inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
1013 inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
1014 outputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.class")
1015 outputs.file("${jalviewDir}/${utils_dir}/BufferedLineReader.class")
1019 task linkCheck(type: JavaExec) {
1020 dependsOn prepare, compileLinkCheck
1022 def helpLinksCheckerOutFile = file("${jalviewDir}/${utils_dir}/HelpLinksChecker.out")
1023 classpath = files("${jalviewDir}/${utils_dir}")
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 "${utils_dir}/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": main_class,
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 = shadow_jar_main_class
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 {}