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 sourceCompatibility = compile_source_compatibility
965 targetCompatibility = compile_target_compatibility
966 jvmArgs += additional_compiler_args
970 print("Running tests " + (useClover?"WITH":"WITHOUT") + " clover [clover="+useClover+"]\n")
976 task buildIndices(type: JavaExec) {
978 classpath = sourceSets.main.compileClasspath
979 main = "com.sun.java.help.search.Indexer"
980 workingDir = "${classesDir}/${help_dir}"
983 inputs.dir("${workingDir}/${argDir}")
985 outputs.dir("${classesDir}/doc")
986 outputs.dir("${classesDir}/help")
987 outputs.file("${workingDir}/JavaHelpSearch/DOCS")
988 outputs.file("${workingDir}/JavaHelpSearch/DOCS.TAB")
989 outputs.file("${workingDir}/JavaHelpSearch/OFFSETS")
990 outputs.file("${workingDir}/JavaHelpSearch/POSITIONS")
991 outputs.file("${workingDir}/JavaHelpSearch/SCHEMA")
992 outputs.file("${workingDir}/JavaHelpSearch/TMAP")
996 task compileLinkCheck(type: JavaCompile) {
998 classpath = files("${jalviewDir}/${utils_dir}")
999 destinationDir = file("${jalviewDir}/${utils_dir}")
1000 source = fileTree(dir: "${jalviewDir}/${utils_dir}", include: ["HelpLinksChecker.java", "BufferedLineReader.java"])
1002 inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
1003 inputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.java")
1004 outputs.file("${jalviewDir}/${utils_dir}/HelpLinksChecker.class")
1005 outputs.file("${jalviewDir}/${utils_dir}/BufferedLineReader.class")
1009 task linkCheck(type: JavaExec) {
1010 dependsOn prepare, compileLinkCheck
1012 def helpLinksCheckerOutFile = file("${jalviewDir}/${utils_dir}/HelpLinksChecker.out")
1013 classpath = files("${jalviewDir}/${utils_dir}")
1014 main = "HelpLinksChecker"
1015 workingDir = jalviewDir
1016 args = [ "${classesDir}/${help_dir}", "-nointernet" ]
1018 def outFOS = new FileOutputStream(helpLinksCheckerOutFile, false) // false == don't append
1020 standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
1023 errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
1027 inputs.dir("${classesDir}/${help_dir}")
1028 outputs.file(helpLinksCheckerOutFile)
1031 // import the pubhtmlhelp target
1032 ant.properties.basedir = "${jalviewDir}"
1033 ant.properties.helpBuildDir = "${jalviewDirAbsolutePath}/${classes_dir}/${help_dir}"
1034 ant.importBuild "${utils_dir}/publishHelp.xml"
1037 task cleanPackageDir(type: Delete) {
1039 delete fileTree(dir: "${jalviewDir}/${packageDir}", include: "*.jar")
1045 dependsOn buildIndices
1046 dependsOn createBuildProperties
1049 attributes "Main-Class": main_class,
1050 "Permissions": "all-permissions",
1051 "Application-Name": "Jalview Desktop",
1052 "Codebase": application_codebase
1055 destinationDir = file("${jalviewDir}/${packageDir}")
1056 archiveName = rootProject.name+".jar"
1062 exclude "**/*.jar.*"
1064 inputs.dir(classesDir)
1065 outputs.file("${jalviewDir}/${packageDir}/${archiveName}")
1069 task copyJars(type: Copy) {
1070 from fileTree(dir: classesDir, include: "**/*.jar").files
1071 into "${jalviewDir}/${packageDir}"
1075 // doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
1076 task syncJars(type: Sync) {
1077 from fileTree(dir: "${jalviewDir}/${libDistDir}", include: "**/*.jar").files
1078 into "${jalviewDir}/${packageDir}"
1080 include jar.archiveName
1087 description = "Put all required libraries in dist"
1088 // order of "cleanPackageDir", "copyJars", "jar" important!
1089 jar.mustRunAfter cleanPackageDir
1090 syncJars.mustRunAfter cleanPackageDir
1091 dependsOn cleanPackageDir
1094 outputs.dir("${jalviewDir}/${packageDir}")
1099 dependsOn cleanPackageDir
1105 group = "distribution"
1109 from ("${jalviewDir}/${libDistDir}") {
1113 attributes 'Implementation-Version': JALVIEW_VERSION
1115 mainClassName = shadow_jar_main_class
1117 classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
1122 task getdownWebsite() {
1123 group = "distribution"
1124 description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
1129 def getdownWebsiteResourceFilenames = []
1130 def getdownTextString = ""
1131 def getdownResourceDir = getdownResourceDir
1132 def getdownResourceFilenames = []
1135 // clean the getdown website and files dir before creating getdown folders
1136 delete getdownWebsiteDir
1137 delete getdownFilesDir
1140 from buildProperties
1141 rename(build_properties_file, getdown_build_properties)
1144 getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
1146 // set some getdown_txt_ properties then go through all properties looking for getdown_txt_...
1147 def props = project.properties.sort { it.key }
1148 if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) {
1149 props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion)
1151 if (getdownAltJavaMaxVersion != null && getdownAltJavaMaxVersion.length() > 0) {
1152 props.put("getdown_txt_java_max_version", getdownAltJavaMaxVersion)
1154 if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
1155 props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
1158 props.put("getdown_txt_title", jalview_name)
1159 props.put("getdown_txt_ui.name", install4jApplicationName)
1161 // start with appbase
1162 getdownTextString += "appbase = ${getdownAppBase}\n"
1163 props.each{ prop, val ->
1164 if (prop.startsWith("getdown_txt_") && val != null) {
1165 if (prop.startsWith("getdown_txt_multi_")) {
1166 def key = prop.substring(18)
1167 val.split(",").each{ v ->
1168 def line = "${key} = ${v}\n"
1169 getdownTextString += line
1172 // file values rationalised
1173 if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
1175 if (val.indexOf('/') == 0) {
1178 } else if (val.indexOf('/') > 0) {
1179 // relative path (relative to jalviewDir)
1180 r = file( "${jalviewDir}/${val}" )
1183 val = "${getdown_resource_dir}/" + r.getName()
1184 getdownWebsiteResourceFilenames += val
1185 getdownResourceFilenames += r.getPath()
1188 if (! prop.startsWith("getdown_txt_resource")) {
1189 def line = prop.substring(12) + " = ${val}\n"
1190 getdownTextString += line
1196 getdownWebsiteResourceFilenames.each{ filename ->
1197 getdownTextString += "resource = ${filename}\n"
1199 getdownResourceFilenames.each{ filename ->
1202 into getdownResourceDir
1207 fileTree(file(packageDir)).each{ f ->
1208 if (f.isDirectory()) {
1209 def files = fileTree(dir: f, include: ["*"]).getFiles()
1211 } else if (f.exists()) {
1215 codeFiles.sort().each{f ->
1216 def name = f.getName()
1217 def line = "code = ${getdownAppDistDir}/${name}\n"
1218 getdownTextString += line
1225 // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
1227 if (JAVA_VERSION.equals("11")) {
1228 def j11libFiles = fileTree(dir: "${jalviewDir}/${j11libDir}", include: ["*.jar"]).getFiles()
1229 j11libFiles.sort().each{f ->
1230 def name = f.getName()
1231 def line = "code = ${getdown_j11lib_dir}/${name}\n"
1232 getdownTextString += line
1235 into getdownJ11libDir
1241 // 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.
1242 //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
1243 getdownTextString += "resource = ${getdown_launcher_new}\n"
1244 getdownTextString += "class = ${mainClass}\n"
1246 def getdown_txt = file("${getdownWebsiteDir}/getdown.txt")
1247 getdown_txt.write(getdownTextString)
1249 def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl"
1250 def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}")
1251 launchJvl.write("appbase=${getdownAppBase}")
1254 from getdownLauncher
1255 rename(file(getdownLauncher).getName(), getdown_launcher_new)
1256 into getdownWebsiteDir
1260 from getdownLauncher
1261 if (file(getdownLauncher).getName() != getdown_launcher) {
1262 rename(file(getdownLauncher).getName(), getdown_launcher)
1264 into getdownWebsiteDir
1267 if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
1270 from getdownLauncher
1271 from "${getdownWebsiteDir}/${getdown_build_properties}"
1272 if (file(getdownLauncher).getName() != getdown_launcher) {
1273 rename(file(getdownLauncher).getName(), getdown_launcher)
1275 into getdownInstallDir
1279 from getdownInstallDir
1280 into getdownFilesInstallDir
1287 from getdownLauncher
1288 from "${getdownWebsiteDir}/${getdown_build_properties}"
1289 if (file(getdownLauncher).getName() != getdown_launcher) {
1290 rename(file(getdownLauncher).getName(), getdown_launcher)
1292 into getdownFilesDir
1296 from getdownResourceDir
1297 into "${getdownFilesDir}/${getdown_resource_dir}"
1302 inputs.dir("${jalviewDir}/${packageDir}")
1304 outputs.dir(getdownWebsiteDir)
1305 outputs.dir(getdownFilesDir)
1309 // a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
1310 task getdownDigestDir(type: JavaExec) {
1312 description "A task to run a getdown Digest on a dir with getdown.txt. Provide a DIGESTDIR property via -PDIGESTDIR=..."
1314 def digestDirPropertyName = "DIGESTDIR"
1316 classpath = files(getdownLauncher)
1317 def digestDir = findProperty(digestDirPropertyName)
1318 if (digestDir == null) {
1319 throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
1323 main = "com.threerings.getdown.tools.Digester"
1327 task getdownDigest(type: JavaExec) {
1328 group = "distribution"
1329 description = "Digest the getdown website folder"
1330 dependsOn getdownWebsite
1332 classpath = files(getdownLauncher)
1334 main = "com.threerings.getdown.tools.Digester"
1335 args getdownWebsiteDir
1336 inputs.dir(getdownWebsiteDir)
1337 outputs.file("${getdownWebsiteDir}/digest2.txt")
1342 group = "distribution"
1343 description = "Create the minimal and full getdown app folder for installers and website and create digest file"
1344 dependsOn getdownDigest
1346 if (reportRsyncCommand) {
1347 def fromDir = getdownWebsiteDir + (getdownWebsiteDir.endsWith('/')?'':'/')
1348 def toDir = "${getdown_rsync_dest}/${getdownDir}" + (getdownDir.endsWith('/')?'':'/')
1349 println "LIKELY RSYNC COMMAND:"
1350 println "mkdir -p '$toDir'\nrsync -avh --delete '$fromDir' '$toDir'"
1351 if (RUNRSYNC == "true") {
1353 commandLine "mkdir", "-p", toDir
1356 commandLine "rsync", "-avh", "--delete", fromDir, toDir
1366 delete getdownWebsiteDir
1367 delete getdownFilesDir
1373 if (file(install4jHomeDir).exists()) {
1375 } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
1376 install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
1377 } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
1378 install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
1380 installDir(file(install4jHomeDir))
1382 mediaTypes = Arrays.asList(install4j_media_types.split(","))
1386 task copyInstall4jTemplate {
1387 def install4jTemplateFile = file("${install4jDir}/${install4j_template}")
1388 def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}")
1389 inputs.file(install4jTemplateFile)
1390 inputs.file(install4jFileAssociationsFile)
1391 inputs.property("CHANNEL", { CHANNEL })
1392 outputs.file(install4jConfFile)
1395 def install4jConfigXml = new XmlParser().parse(install4jTemplateFile)
1397 // turn off code signing if no OSX_KEYPASS
1398 if (OSX_KEYPASS == "") {
1399 install4jConfigXml.'**'.codeSigning.each { codeSigning ->
1400 codeSigning.'@macEnabled' = "false"
1402 install4jConfigXml.'**'.windows.each { windows ->
1403 windows.'@runPostProcessor' = "false"
1407 // turn off checksum creation for LOCAL channel
1408 def e = install4jConfigXml.application[0]
1409 if (CHANNEL == "LOCAL") {
1410 e.'@createChecksums' = "false"
1412 e.'@createChecksums' = "true"
1415 // put file association actions where placeholder action is
1416 def install4jFileAssociationsText = install4jFileAssociationsFile.text
1417 def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
1418 install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true
1419 if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') {
1420 def parent = a.parent()
1422 fileAssociationActions.each { faa ->
1425 // don't need to continue in .any loop once replacements have been made
1430 // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else
1431 // NB we're deleting the /other/ one!
1432 // Also remove the examples subdir from non-release versions
1433 def customizedIdToDelete = "PROGRAM_GROUP_RELEASE"
1434 // 2.11.1.0 NOT releasing with the Examples folder in the Program Group
1435 if (false && CHANNEL=="RELEASE") { // remove 'false && ' to include Examples folder in RELEASE channel
1436 customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE"
1438 // remove the examples subdir from Full File Set
1439 def files = install4jConfigXml.files[0]
1440 def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" }
1441 def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' }
1442 def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' }
1443 def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" }
1444 dirEntry.parent().remove(dirEntry)
1446 install4jConfigXml.'**'.action.any { a ->
1447 if (a.'@customizedId' == customizedIdToDelete) {
1448 def parent = a.parent()
1454 // remove the "Uninstall Old Jalview (optional)" symlink from DMG for non-release DS_Stores
1455 if (! (CHANNEL == "RELEASE" || CHANNEL == "TEST-RELEASE" ) ) {
1456 def symlink = install4jConfigXml.'**'.topLevelFiles.symlink.find { sl -> sl.'@name' == "Uninstall Old Jalview (optional).app" }
1457 symlink.parent().remove(symlink)
1460 // write install4j file
1461 install4jConfFile.text = XmlUtil.serialize(install4jConfigXml)
1468 delete install4jConfFile
1473 task installers(type: com.install4j.gradle.Install4jTask) {
1474 group = "distribution"
1475 description = "Create the install4j installers"
1476 dependsOn setGitVals
1478 dependsOn copyInstall4jTemplate
1480 projectFile = install4jConfFile
1482 // create an md5 for the input files to use as version for install4j conf file
1483 def digest = MessageDigest.getInstance("MD5")
1485 (file("${install4jDir}/${install4j_template}").text +
1486 file("${install4jDir}/${install4j_info_plist_file_associations}").text +
1487 file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
1488 def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
1489 if (filesMd5.length() >= 8) {
1490 filesMd5 = filesMd5.substring(0,8)
1492 def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
1493 // make install4jBuildDir relative to jalviewDir
1494 def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
1497 'JALVIEW_NAME': jalview_name,
1498 'JALVIEW_APPLICATION_NAME': install4jApplicationName,
1499 'JALVIEW_DIR': "../..",
1500 'OSX_KEYSTORE': OSX_KEYSTORE,
1501 'JSIGN_SH': JSIGN_SH,
1502 'JRE_DIR': getdown_app_dir_java,
1503 'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
1504 'JALVIEW_VERSION': JALVIEW_VERSION,
1505 'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
1506 'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
1507 'JAVA_VERSION': JAVA_VERSION,
1508 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
1509 'VERSION': JALVIEW_VERSION,
1510 'MACOS_JAVA_VM_DIR': macosJavaVMDir,
1511 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
1512 'LINUX_JAVA_VM_DIR': linuxJavaVMDir,
1513 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
1514 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
1515 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
1516 'COPYRIGHT_MESSAGE': install4j_copyright_message,
1517 'BUNDLE_ID': install4jBundleId,
1518 'INTERNAL_ID': install4jInternalId,
1519 'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
1520 'MACOS_DS_STORE': install4jDSStore,
1521 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
1522 'INSTALLER_NAME': install4jInstallerName,
1523 'INSTALL4J_UTILS_DIR': install4j_utils_dir,
1524 'GETDOWN_WEBSITE_DIR': getdown_website_dir,
1525 'GETDOWN_FILES_DIR': getdown_files_dir,
1526 'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
1527 'GETDOWN_DIST_DIR': getdownAppDistDir,
1528 'GETDOWN_ALT_DIR': getdown_app_dir_alt,
1529 'GETDOWN_INSTALL_DIR': getdown_install_dir,
1530 'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
1531 'BUILD_DIR': install4jBuildDir,
1532 'APPLICATION_CATEGORIES': install4j_application_categories,
1533 'APPLICATION_FOLDER': install4jApplicationFolder,
1534 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
1535 'EXECUTABLE_NAME': install4jExecutableName,
1536 'EXTRA_SCHEME': install4jExtraScheme,
1539 //println("INSTALL4J VARIABLES:")
1540 //variables.each{k,v->println("${k}=${v}")}
1542 destination = "${jalviewDir}/${install4jBuildDir}"
1543 buildSelected = true
1545 if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
1547 disableSigning = true
1551 macKeystorePassword = OSX_KEYPASS
1555 println("Using projectFile "+projectFile)
1558 inputs.dir(getdownWebsiteDir)
1559 inputs.file(install4jConfFile)
1560 inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
1561 inputs.dir(macosJavaVMDir)
1562 inputs.dir(windowsJavaVMDir)
1563 outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
1567 task sourceDist(type: Tar) {
1569 def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
1570 def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz"
1571 // cater for buildship < 3.1 [3.0.1 is max version in eclipse 2018-09]
1573 archiveFileName = outputFileName
1574 } catch (Exception e) {
1575 archiveName = outputFileName
1578 compression Compression.GZIP
1593 "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales",
1595 "utils/InstallAnywhere",
1610 "gradle.properties",
1621 ".settings/org.eclipse.jdt.core.jalview.prefs",
1625 exclude (EXCLUDE_FILES)
1626 include (PROCESS_FILES)
1627 filter(ReplaceTokens,
1631 'Version-Rel': JALVIEW_VERSION,
1632 'Year-Rel': getDate("yyyy")
1637 exclude (EXCLUDE_FILES)
1638 exclude (PROCESS_FILES)
1639 exclude ("appletlib")
1640 exclude ("**/*locales")
1641 exclude ("*locales/**")
1642 exclude ("utils/InstallAnywhere")
1644 exclude (getdown_files_dir)
1645 exclude (getdown_website_dir)
1647 // exluding these as not using jars as modules yet
1648 exclude ("$j11modDir/**/*.jar")
1651 include(INCLUDE_FILES)
1653 // from (jalviewDir) {
1654 // // explicit includes for stuff that seemed to not get included
1655 // include(fileTree("test/**/*."))
1656 // exclude(EXCLUDE_FILES)
1657 // exclude(PROCESS_FILES)
1664 dependsOn pubhtmlhelp
1666 inputs.dir("${classesDir}/${help_dir}")
1667 outputs.dir("${buildDir}/distributions/${help_dir}")
1670 // LARGE AMOUNT OF JALVIEWJS STUFF DELETED HERE
1671 task eclipseAutoBuildTask {}
1672 task eclipseSynchronizationTask {}