1 --- a/build.gradle 2021-09-20 17:46:04.088152106 +0100
2 +++ b/build.gradle 2021-09-20 17:46:09.180302062 +0100
4 * For properties set within build.gradle, use camelCaseNoSpace.
6 import org.apache.tools.ant.filters.ReplaceTokens
7 -import org.gradle.internal.os.OperatingSystem
8 -import org.gradle.plugins.ide.internal.generator.PropertiesPersistableConfigurationObject
9 -import org.gradle.api.internal.PropertiesTransformer
10 -import org.gradle.util.ConfigureUtil
11 -import org.gradle.plugins.ide.eclipse.model.Output
12 -import org.gradle.plugins.ide.eclipse.model.Library
13 -import java.security.MessageDigest
14 -import groovy.transform.ExternalizeMethods
15 -import groovy.util.XmlParser
16 -import groovy.xml.XmlUtil
17 import com.vladsch.flexmark.util.ast.Node
18 import com.vladsch.flexmark.html.HtmlRenderer
19 import com.vladsch.flexmark.parser.Parser
21 import com.vladsch.flexmark.ext.toc.TocExtension
29 classpath "com.vladsch.flexmark:flexmark-all:0.62.0"
38 - id "com.diffplug.gradle.spotless" version "3.28.0"
39 - id 'com.github.johnrengelman.shadow' version '4.0.3'
40 - id 'com.install4j.gradle' version '8.0.10'
41 - id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
42 id 'com.palantir.git-version' version '0.12.3'
52 // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use
53 def string(Object o) {
54 return o == null ? "" : o.toString()
56 jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
57 jalviewDirRelativePath = jalviewDir
59 - getdownChannelName = CHANNEL.toLowerCase()
60 - // default to "default". Currently only has different cosmetics for "develop", "release", "default"
61 - propertiesChannelName = ["develop", "release", "test-release", "jalviewjs", "jalviewjs-release" ].contains(getdownChannelName) ? getdownChannelName : "default"
62 - // Import channel_properties
63 + propertiesChannelName = "release"
64 channelDir = string("${jalviewDir}/${channel_properties_dir}/${propertiesChannelName}")
65 channelGradleProperties = string("${channelDir}/channel_gradle.properties")
66 overrideProperties(channelGradleProperties, false)
67 - // local build environment properties
68 - // can be "projectDir/local.properties"
69 - overrideProperties("${projectDir}/local.properties", true)
70 - // or "../projectDir_local.properties"
71 - overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true)
75 // Import releaseProps from the RELEASE file
76 // or a file specified via JALVIEW_RELEASE_FILE if defined
78 if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) {
79 JALVIEW_VERSION = releaseProps.get("jalview.version")
82 - // this property set when running Eclipse headlessly
83 - j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
84 - // this property set by Eclipse
85 - eclipseApplicationProperty = string("eclipse.application")
86 - // CHECK IF RUNNING FROM WITHIN ECLIPSE
87 - def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty]
88 - IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.")
89 - // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET
90 - if (System.properties[j2sHeadlessBuildProperty].equals("true")) {
91 - println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'")
95 - println("WITHIN ECLIPSE IDE")
97 - println("HEADLESS BUILD")
100 - J2S_ENABLED = (project.hasProperty('j2s.compiler.status') && project['j2s.compiler.status'] != null && project['j2s.compiler.status'] == "enable")
102 - println("J2S ENABLED")
105 - System.properties.sort { it.key }.each {
106 - key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
109 - if (false && IN_ECLIPSE) {
110 - jalviewDir = jalviewDirAbsolutePath
115 - buildDate = new Date().format("yyyyMMdd")
118 bareSourceDir = string(source_dir)
119 @@ -173,214 +103,18 @@
121 classesDir = string("${jalviewDir}/${classes_dir}")
124 - useClover = clover.equals("true")
125 - cloverBuildDir = "${buildDir}/clover"
126 - cloverInstrDir = file("${cloverBuildDir}/clover-instr")
127 - cloverClassesDir = file("${cloverBuildDir}/clover-classes")
128 - cloverReportDir = file("${buildDir}/reports/clover")
129 - cloverTestInstrDir = file("${cloverBuildDir}/clover-test-instr")
130 - cloverTestClassesDir = file("${cloverBuildDir}/clover-test-classes")
131 - //cloverTestClassesDir = cloverClassesDir
132 - cloverDb = string("${cloverBuildDir}/clover.db")
134 - testSourceDir = useClover ? cloverTestInstrDir : testDir
135 - testClassesDir = useClover ? cloverTestClassesDir : "${jalviewDir}/${test_output_dir}"
137 - getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
139 - buildProperties = null
141 - // the following values might be overridden by the CHANNEL switch
142 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
143 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
144 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
145 - getdownAppDistDir = getdown_app_dir_alt
146 - getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}")
149 + resourceClassesDir = classesDir
151 + testSourceDir = testDir
152 + testClassesDir = "${jalviewDir}/${test_output_dir}"
154 + buildProperties = string("${classesDir}/${build_properties_file}")
155 getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application
156 - reportRsyncCommand = false
157 - jvlChannelName = CHANNEL.toLowerCase()
158 - install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
159 - install4jDMGDSStore = "${install4j_images_dir}/${install4j_dmg_ds_store}"
160 - install4jDMGBackgroundImage = "${install4j_images_dir}/${install4j_dmg_background}"
161 - install4jInstallerName = "${jalview_name} Non-Release Installer"
162 - install4jExecutableName = install4j_executable_name
163 - install4jExtraScheme = "jalviewx"
164 - install4jMacIconsFile = string("${install4j_images_dir}/${install4j_mac_icons_file}")
165 - install4jWindowsIconsFile = string("${install4j_images_dir}/${install4j_windows_icons_file}")
166 - install4jPngIconFile = string("${install4j_images_dir}/${install4j_png_icon_file}")
167 - install4jBackground = string("${install4j_images_dir}/${install4j_background}")
171 - // TODO: get bamboo build artifact URL for getdown artifacts
172 - getdown_channel_base = bamboo_channelbase
173 - getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
174 - getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
175 - jvlChannelName += "_${getdownChannelName}"
176 - // automatically add the test group Not-bamboo for exclusion
177 - if ("".equals(testng_excluded_groups)) {
178 - testng_excluded_groups = "Not-bamboo"
180 - install4jExtraScheme = "jalviewb"
183 - case [ "RELEASE", "JALVIEWJS-RELEASE" ]:
184 - getdownAppDistDir = getdown_app_dir_release
185 - reportRsyncCommand = true
186 - install4jSuffix = ""
187 - install4jInstallerName = "${jalview_name} Installer"
191 - getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
192 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
193 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
194 - if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
195 - throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
197 - package_dir = string("${ARCHIVEDIR}/${package_dir}")
198 - buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
201 - reportRsyncCommand = true
202 - install4jExtraScheme = "jalviewa"
205 - case "ARCHIVELOCAL":
206 - getdownChannelName = string("archive/${JALVIEW_VERSION}")
207 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
208 - getdownAppBase = file(getdownWebsiteDir).toURI().toString()
209 - if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
210 - throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
212 - package_dir = string("${ARCHIVEDIR}/${package_dir}")
213 - buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
216 - reportRsyncCommand = true
217 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
218 - install4jSuffix = "Archive"
219 - install4jExtraScheme = "jalviewa"
223 - reportRsyncCommand = true
224 - getdownSetAppBaseProperty = true
225 - // DEVELOP-RELEASE is usually associated with a Jalview release series so set the version
226 - JALVIEW_VERSION=JALVIEW_VERSION+"-d${buildDate}"
228 - install4jSuffix = "Develop"
229 - install4jExtraScheme = "jalviewd"
230 - install4jInstallerName = "${jalview_name} Develop Installer"
233 - case "TEST-RELEASE":
234 - reportRsyncCommand = true
235 - // Don't ignore transpile errors for release build
236 - if (jalviewjs_ignore_transpile_errors.equals("true")) {
237 - jalviewjs_ignore_transpile_errors = "false"
238 - println("Setting jalviewjs_ignore_transpile_errors to 'false'")
240 - JALVIEW_VERSION = JALVIEW_VERSION+"-test"
241 - install4jSuffix = "Test"
242 - install4jExtraScheme = "jalviewt"
243 - install4jInstallerName = "${jalview_name} Test Installer"
246 - case ~/^SCRATCH(|-[-\w]*)$/:
247 - getdownChannelName = CHANNEL
248 - JALVIEW_VERSION = JALVIEW_VERSION+"-"+CHANNEL
250 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
251 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
252 - reportRsyncCommand = true
253 - install4jSuffix = "Scratch"
257 - if (!file("${LOCALDIR}").exists()) {
258 - throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
260 - getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
261 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
263 - JALVIEW_VERSION = "TEST"
264 - install4jSuffix = "Test-Local"
265 - install4jExtraScheme = "jalviewt"
266 - install4jInstallerName = "${jalview_name} Test Installer"
269 - case [ "LOCAL", "JALVIEWJS" ]:
270 - JALVIEW_VERSION = "TEST"
271 - getdownAppBase = file(getdownWebsiteDir).toURI().toString()
272 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
273 - install4jExtraScheme = "jalviewl"
276 - default: // something wrong specified
277 - throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
281 - // override getdownAppBase if requested
282 - if (findProperty("getdown_appbase_override") != null) {
283 - // revert to LOCAL if empty string
284 - if (string(getdown_appbase_override) == "") {
285 - getdownAppBase = file(getdownWebsiteDir).toURI().toString()
286 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
287 - } else if (string(getdown_appbase_override).startsWith("file://")) {
288 - getdownAppBase = string(getdown_appbase_override)
289 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
291 - getdownAppBase = string(getdown_appbase_override)
293 - println("Overriding getdown appbase with '${getdownAppBase}'")
295 - // sanitise file name for jalview launcher file for this channel
296 - jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_")
297 - // install4j application and folder names
298 - if (install4jSuffix == "") {
299 - install4jApplicationName = "${jalview_name}"
300 - install4jBundleId = "${install4j_bundle_id}"
301 - install4jWinApplicationId = install4j_release_win_application_id
303 - install4jApplicationName = "${jalview_name} ${install4jSuffix}"
304 - install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
305 - // add int hash of install4jSuffix to the last part of the application_id
306 - def id = install4j_release_win_application_id
307 - def idsplitreverse = id.split("-").reverse()
308 - idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
309 - install4jWinApplicationId = idsplitreverse.reverse().join("-")
311 - // sanitise folder and id names
312 - // install4jApplicationFolder = e.g. "Jalview Build"
313 - install4jApplicationFolder = install4jApplicationName
314 - .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
315 - .replaceAll("_+", "_") // collapse __
316 - install4jInternalId = install4jApplicationName
317 - .replaceAll(" ","_")
318 - .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
319 - .replaceAll("_+", "") // collapse __
320 - //.replaceAll("_*-_*", "-") // collapse _-_
321 - install4jUnixApplicationFolder = install4jApplicationName
322 - .replaceAll(" ","_")
323 - .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
324 - .replaceAll("_+", "_") // collapse __
325 - .replaceAll("_*-_*", "-") // collapse _-_
328 - getdownWrapperLink = install4jUnixApplicationFolder // e.g. "jalview_local"
329 - getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
330 - //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
331 - getdownResourceDir = string("${getdownWebsiteDir}/${getdown_resource_dir}")
332 - getdownInstallDir = string("${getdownWebsiteDir}/${getdown_install_dir}")
333 - getdownFilesDir = string("${jalviewDir}/${getdown_files_dir}/${JAVA_VERSION}/")
334 - getdownFilesInstallDir = string("${getdownFilesDir}/${getdown_install_dir}")
335 - /* compile without modules -- using classpath libraries
336 - modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
337 - modules_runtimeClasspath = modules_compileClasspath
339 + install4jApplicationName = "${jalview_name}"
341 def details = versionDetails()
342 gitHash = details.gitHash
343 gitBranch = details.branchName
344 @@ -396,71 +130,16 @@
345 libDistDir = j8libDir
346 compile_source_compatibility = 1.8
347 compile_target_compatibility = 1.8
348 - // these are getdown.txt properties defined dependent on the JAVA_VERSION
349 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
350 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
351 - // this property is assigned below and expanded to multiple lines in the getdown task
352 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
353 - // this property is for the Java library used in eclipse
354 - eclipseJavaRuntimeName = string("JavaSE-1.8")
355 } else if (JAVA_VERSION.equals("11")) {
356 JAVA_INTEGER_VERSION = string("11")
358 libDistDir = j11libDir
359 compile_source_compatibility = 11
360 compile_target_compatibility = 11
361 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
362 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
363 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
364 - eclipseJavaRuntimeName = string("JavaSE-11")
365 - /* compile without modules -- using classpath libraries
366 - additional_compiler_args += [
367 - '--module-path', modules_compileClasspath.asPath,
368 - '--add-modules', j11modules
371 - } else if (JAVA_VERSION.equals("12") || JAVA_VERSION.equals("13")) {
372 - JAVA_INTEGER_VERSION = JAVA_VERSION
374 - libDistDir = j11libDir
375 - compile_source_compatibility = JAVA_VERSION
376 - compile_target_compatibility = JAVA_VERSION
377 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
378 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
379 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
380 - eclipseJavaRuntimeName = string("JavaSE-11")
381 - /* compile without modules -- using classpath libraries
382 - additional_compiler_args += [
383 - '--module-path', modules_compileClasspath.asPath,
384 - '--add-modules', j11modules
388 throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
393 - JAVA_MIN_VERSION = JAVA_VERSION
394 - JAVA_MAX_VERSION = JAVA_VERSION
395 - def jreInstallsDir = string(jre_installs_dir)
396 - if (jreInstallsDir.startsWith("~/")) {
397 - jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1)
399 - macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre")
400 - macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-mac-x64.tar.gz")
401 - windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre")
402 - windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-windows-x64.tar.gz")
403 - linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre")
404 - linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-linux-x64.tar.gz")
405 - install4jDir = string("${jalviewDir}/${install4j_utils_dir}")
406 - install4jConfFileName = string("jalview-install4j-conf.install4j")
407 - install4jConfFile = file("${install4jDir}/${install4jConfFileName}")
408 - install4jHomeDir = install4j_home_dir
409 - if (install4jHomeDir.startsWith("~/")) {
410 - install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
413 resourceBuildDir = string("${buildDir}/resources")
414 resourcesBuildDir = string("${resourceBuildDir}/resources_build")
415 helpBuildDir = string("${resourceBuildDir}/help_build")
417 helpSourceDir = string("${helpParentDir}/${help_dir}")
418 helpFile = string("${helpBuildDir}/${help_dir}/help.jhm")
421 - relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
422 - jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs")
423 - jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}")
425 - jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir)
427 - jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js")
429 - jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib")
430 - jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs")
431 - jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core")
432 - jalviewjsJalviewCoreHtmlFile = string("")
433 - jalviewjsJalviewCoreName = string(jalviewjs_core_name)
434 - jalviewjsCoreClasslists = []
435 - jalviewjsJalviewTemplateName = string(jalviewjs_name)
436 - jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
437 - jalviewjsJ2sAltSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_alt_settings}")
438 - jalviewjsJ2sProps = null
439 - jalviewjsJ2sPlugin = jalviewjs_j2s_plugin
441 - eclipseWorkspace = null
442 - eclipseBinary = string("")
443 - eclipseVersion = string("")
444 - eclipseDebug = false
448 @@ -517,27 +171,12 @@
449 compileClasspath = files(sourceSets.main.java.outputDir)
450 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
452 - runtimeClasspath = compileClasspath
453 - runtimeClasspath += files(sourceSets.main.resources.srcDirs)
458 - srcDirs cloverInstrDir
459 - outputDir = cloverClassesDir
463 - srcDirs = sourceSets.main.resources.srcDirs
466 - compileClasspath = files( sourceSets.clover.java.outputDir )
467 - //compileClasspath += files( testClassesDir )
468 + compileClasspath = files(sourceSets.main.java.outputDir)
469 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
470 - compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
471 - compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"])
473 runtimeClasspath = compileClasspath
474 + runtimeClasspath += files(sourceSets.main.resources.srcDirs)
478 @@ -557,453 +196,41 @@
479 runtimeClasspath = compileClasspath
480 runtimeClasspath += files(sourceSets.test.resources.srcDirs)
486 -// eclipse project and settings files creation, also used by buildship
489 - name = eclipse_project_name
491 - natures 'org.eclipse.jdt.core.javanature',
492 - 'org.eclipse.jdt.groovy.core.groovyNature',
493 - 'org.eclipse.buildship.core.gradleprojectnature'
495 - buildCommand 'org.eclipse.jdt.core.javabuilder'
496 - buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
500 - //defaultOutputDir = sourceSets.main.java.outputDir
501 - configurations.each{ c->
502 - if (c.isCanBeResolved()) {
503 - minusConfigurations += [c]
507 - plusConfigurations = [ ]
511 - def removeTheseToo = []
512 - HashMap<String, Boolean> alreadyAddedSrcPath = new HashMap<>();
513 - cp.entries.each { entry ->
514 - // This conditional removes all src classpathentries that a) have already been added or b) aren't "src" or "test".
515 - // e.g. this removes the resources dir being copied into bin/main, bin/test AND bin/clover
516 - // we add the resources and help/help dirs in as libs afterwards (see below)
517 - if (entry.kind == 'src') {
518 - if (alreadyAddedSrcPath.getAt(entry.path) || !(entry.path == bareSourceDir || entry.path == bareTestSourceDir)) {
519 - removeTheseToo += entry
521 - alreadyAddedSrcPath.putAt(entry.path, true)
526 - cp.entries.removeAll(removeTheseToo)
528 - //cp.entries += new Output("${eclipse_bin_dir}/main")
529 - if (file(helpParentDir).isDirectory()) {
530 - cp.entries += new Library(fileReference(helpParentDir))
532 - if (file(resourceDir).isDirectory()) {
533 - cp.entries += new Library(fileReference(resourceDir))
536 - HashMap<String, Boolean> alreadyAddedLibPath = new HashMap<>();
538 - sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
539 - //don't want to add outputDir as eclipse is using its own output dir in bin/main
540 - if (it.isDirectory() || ! it.exists()) {
541 - // don't add dirs to classpath, especially if they don't exist
542 - return false // groovy "continue" in .any closure
544 - def itPath = it.toString()
545 - if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
546 - // make relative path
547 - itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
549 - if (alreadyAddedLibPath.get(itPath)) {
550 - //println("Not adding duplicate entry "+itPath)
552 - //println("Adding entry "+itPath)
553 - cp.entries += new Library(fileReference(itPath))
554 - alreadyAddedLibPath.put(itPath, true)
558 - sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
559 - //no longer want to add outputDir as eclipse is using its own output dir in bin/main
560 - if (it.isDirectory() || ! it.exists()) {
561 - // don't add dirs to classpath
562 - return false // groovy "continue" in .any closure
565 - def itPath = it.toString()
566 - if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
567 - itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
569 - if (alreadyAddedLibPath.get(itPath)) {
572 - def lib = new Library(fileReference(itPath))
573 - lib.entryAttributes["test"] = "true"
575 - alreadyAddedLibPath.put(itPath, true)
583 - containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
588 - // for the IDE, use java 11 compatibility
589 - sourceCompatibility = compile_source_compatibility
590 - targetCompatibility = compile_target_compatibility
591 - javaRuntimeName = eclipseJavaRuntimeName
593 - // add in jalview project specific properties/preferences into eclipse core preferences
595 - withProperties { props ->
596 - def jalview_prefs = new Properties()
597 - def ins = new FileInputStream("${jalviewDirAbsolutePath}/${eclipse_extra_jdt_prefs_file}")
598 - jalview_prefs.load(ins)
600 - jalview_prefs.forEach { t, v ->
601 - if (props.getAt(t) == null) {
605 - // codestyle file -- overrides previous formatter prefs
606 - def csFile = file("${jalviewDirAbsolutePath}/${eclipse_codestyle_file}")
607 - if (csFile.exists()) {
608 - XmlParser parser = new XmlParser()
609 - def profiles = parser.parse(csFile)
610 - def profile = profiles.'profile'.find { p -> (p.'@kind' == "CodeFormatterProfile" && p.'@name' == "Jalview") }
611 - if (profile != null) {
612 - profile.'setting'.each { s ->
614 - def value = s.'@value'
615 - if (id != null && value != null) {
616 - props.putAt(id, value)
627 - // Don't want these to be activated if in headless build
628 - synchronizationTasks "eclipseSynchronizationTask"
629 - //autoBuildTasks "eclipseAutoBuildTask"
635 -/* hack to change eclipse prefs in .settings files other than org.eclipse.jdt.core.prefs */
636 -// Class to allow updating arbitrary properties files
637 -class PropertiesFile extends PropertiesPersistableConfigurationObject {
638 - public PropertiesFile(PropertiesTransformer t) { super(t); }
639 - @Override protected void load(Properties properties) { }
640 - @Override protected void store(Properties properties) { }
641 - @Override protected String getDefaultResourceName() { return ""; }
642 - // This is necessary, because PropertiesPersistableConfigurationObject fails
643 - // if no default properties file exists.
644 - @Override public void loadDefaults() { load(new StringBufferInputStream("")); }
647 -// Task to update arbitrary properties files (set outputFile)
648 -class PropertiesFileTask extends PropertiesGeneratorTask<PropertiesFile> {
649 - private final PropertiesFileContentMerger file;
650 - public PropertiesFileTask() { file = new PropertiesFileContentMerger(getTransformer()); }
651 - protected PropertiesFile create() { return new PropertiesFile(getTransformer()); }
652 - protected void configure(PropertiesFile props) {
653 - file.getBeforeMerged().execute(props); file.getWhenMerged().execute(props);
655 - public void file(Closure closure) { ConfigureUtil.configure(closure, file); }
658 -task eclipseUIPreferences(type: PropertiesFileTask) {
659 - description = "Generate Eclipse additional settings"
660 - def filename = "org.eclipse.jdt.ui.prefs"
661 - outputFile = "$projectDir/.settings/${filename}" as File
664 - it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
667 + srcDirs testSourceDir
668 + outputDir = file(testClassesDir)
673 -task eclipseGroovyCorePreferences(type: PropertiesFileTask) {
674 - description = "Generate Eclipse additional settings"
675 - def filename = "org.eclipse.jdt.groovy.core.prefs"
676 - outputFile = "$projectDir/.settings/${filename}" as File
679 - it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
681 + srcDirs = sourceSets.main.resources.srcDirs
686 -task eclipseAllPreferences {
687 - dependsOn eclipseJdt
688 - dependsOn eclipseUIPreferences
689 - dependsOn eclipseGroovyCorePreferences
692 -eclipseUIPreferences.mustRunAfter eclipseJdt
693 -eclipseGroovyCorePreferences.mustRunAfter eclipseJdt
695 -/* end of eclipse preferences hack */
703 - delete cloverBuildDir
704 - delete cloverReportDir
709 -task cloverInstrJava(type: JavaExec) {
710 - group = "Verification"
711 - description = "Create clover instrumented source java files"
713 - dependsOn cleanClover
715 - inputs.files(sourceSets.main.allJava)
716 - outputs.dir(cloverInstrDir)
718 - //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
719 - classpath = sourceSets.clover.compileClasspath
720 - main = "com.atlassian.clover.CloverInstr"
728 - cloverInstrDir.getPath(),
730 - def srcFiles = sourceSets.main.allJava.files
733 - { file -> file.absolutePath }
736 - args argsList.toArray()
739 - delete cloverInstrDir
740 - println("Clover: About to instrument "+srcFiles.size() +" files")
745 -task cloverInstrTests(type: JavaExec) {
746 - group = "Verification"
747 - description = "Create clover instrumented source test files"
749 - dependsOn cleanClover
751 - inputs.files(testDir)
752 - outputs.dir(cloverTestInstrDir)
754 - classpath = sourceSets.clover.compileClasspath
755 - main = "com.atlassian.clover.CloverInstr"
765 - cloverTestInstrDir.getPath(),
767 - args argsList.toArray()
770 - delete cloverTestInstrDir
771 - println("Clover: About to instrument test files")
777 - group = "Verification"
778 - description = "Create clover instrumented all source files"
780 - dependsOn cloverInstrJava
781 - dependsOn cloverInstrTests
785 -cloverClasses.dependsOn cloverInstr
788 -task cloverConsoleReport(type: JavaExec) {
789 - group = "Verification"
790 - description = "Creates clover console report"
793 - file(cloverDb).exists()
796 - inputs.dir cloverClassesDir
798 - classpath = sourceSets.clover.runtimeClasspath
799 - main = "com.atlassian.clover.reporters.console.ConsoleReporter"
801 - if (cloverreport_mem.length() > 0) {
802 - maxHeapSize = cloverreport_mem
804 - if (cloverreport_jvmargs.length() > 0) {
805 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
815 - args argsList.toArray()
819 -task cloverHtmlReport(type: JavaExec) {
820 - group = "Verification"
821 - description = "Creates clover HTML report"
824 - file(cloverDb).exists()
827 - def cloverHtmlDir = cloverReportDir
828 - inputs.dir cloverClassesDir
829 - outputs.dir cloverHtmlDir
831 - classpath = sourceSets.clover.runtimeClasspath
832 - main = "com.atlassian.clover.reporters.html.HtmlReporter"
834 - if (cloverreport_mem.length() > 0) {
835 - maxHeapSize = cloverreport_mem
837 - if (cloverreport_jvmargs.length() > 0) {
838 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
849 - if (cloverreport_html_options.length() > 0) {
850 - argsList += cloverreport_html_options.split(" ")
853 - args argsList.toArray()
857 -task cloverXmlReport(type: JavaExec) {
858 - group = "Verification"
859 - description = "Creates clover XML report"
862 - file(cloverDb).exists()
865 - def cloverXmlFile = "${cloverReportDir}/clover.xml"
866 - inputs.dir cloverClassesDir
867 - outputs.file cloverXmlFile
869 - classpath = sourceSets.clover.runtimeClasspath
870 - main = "com.atlassian.clover.reporters.xml.XMLReporter"
872 - if (cloverreport_mem.length() > 0) {
873 - maxHeapSize = cloverreport_mem
875 - if (cloverreport_jvmargs.length() > 0) {
876 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
887 - if (cloverreport_xml_options.length() > 0) {
888 - argsList += cloverreport_xml_options.split(" ")
891 - args argsList.toArray()
896 - group = "Verification"
897 - description = "Creates clover reports"
899 - dependsOn cloverXmlReport
900 - dependsOn cloverHtmlReport
905 + compileClasspath = files( sourceSets.test.java.outputDir )
906 + compileClasspath += sourceSets.main.compileClasspath
907 + compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["** REMOVE_THIS_GAP /*.jar"])
910 - sourceCompatibility = compile_source_compatibility
911 - targetCompatibility = compile_target_compatibility
912 - options.compilerArgs += additional_compiler_args
913 - print ("Setting target compatibility to "+targetCompatibility+"\n")
914 + runtimeClasspath = compileClasspath
916 - //classpath += configurations.cloverRuntime
923 - // JBP->BS should the print statement in doFirst refer to compile_target_compatibility ?
924 sourceCompatibility = compile_source_compatibility
925 targetCompatibility = compile_target_compatibility
926 options.compilerArgs = additional_compiler_args
927 - options.encoding = "UTF-8"
929 print ("Setting target compatibility to "+compile_target_compatibility+"\n")
936 - sourceCompatibility = compile_source_compatibility
937 - targetCompatibility = compile_target_compatibility
938 - options.compilerArgs = additional_compiler_args
940 + sourceCompatibility = compile_source_compatibility
941 + targetCompatibility = compile_target_compatibility
942 + options.compilerArgs = additional_compiler_args
943 print ("Setting target compatibility to "+targetCompatibility+"\n")
950 - dependsOn cleanClover
952 delete sourceSets.test.java.outputDir
954 @@ -1306,12 +532,7 @@
955 //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
960 - dependsOn cloverClasses
962 - dependsOn compileJava //?
964 + dependsOn compileJava //?
967 includeGroups testng_groups
969 maxHeapSize = "1024m"
971 workingDir = jalviewDir
972 + //systemProperties 'clover.jar' System.properties.clover.jar
973 def testLaf = project.findProperty("test_laf")
974 if (testLaf != null) {
975 println("Setting Test LaF to '${testLaf}'")
977 jvmArgs += additional_compiler_args
981 - println("Running tests " + (useClover?"WITH":"WITHOUT") + " clover")
986 @@ -1420,1752 +639,7 @@
987 sourceSets.main.resources.srcDirs.each{ dir ->
990 - outputs.file("${outputDir}/${archiveFileName}")
994 -task copyJars(type: Copy) {
995 - from fileTree(dir: classesDir, include: "**/*.jar").files
996 - into "${jalviewDir}/${package_dir}"
1000 -// doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
1001 -task syncJars(type: Sync) {
1003 - from fileTree(dir: "${jalviewDir}/${libDistDir}", include: "**/*.jar").files
1004 - into "${jalviewDir}/${package_dir}"
1006 - include jar.archiveFileName.getOrNull()
1013 - description = "Put all required libraries in dist"
1014 - // order of "cleanPackageDir", "copyJars", "jar" important!
1015 - jar.mustRunAfter cleanPackageDir
1016 - syncJars.mustRunAfter cleanPackageDir
1017 - dependsOn cleanPackageDir
1018 - dependsOn syncJars
1020 - outputs.dir("${jalviewDir}/${package_dir}")
1025 - dependsOn cleanPackageDir
1026 - dependsOn cleanTest
1032 - group = "distribution"
1033 - description = "Create a single jar file with all dependency libraries merged. Can be run with java -jar"
1035 - dependsOn makeDist
1037 - from ("${jalviewDir}/${libDistDir}") {
1041 - attributes "Implementation-Version": JALVIEW_VERSION,
1042 - "Application-Name": install4jApplicationName
1044 - mainClassName = shadow_jar_main_class
1045 - mergeServiceFiles()
1046 - classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
1051 -task getdownWebsite() {
1052 - group = "distribution"
1053 - description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
1055 - dependsOn makeDist
1058 - def getdownWebsiteResourceFilenames = []
1059 - def getdownTextString = ""
1060 - def getdownResourceDir = getdownResourceDir
1061 - def getdownResourceFilenames = []
1064 - // clean the getdown website and files dir before creating getdown folders
1065 - delete getdownWebsiteDir
1066 - delete getdownFilesDir
1069 - from buildProperties
1070 - rename(file(buildProperties).getName(), getdown_build_properties)
1071 - into getdownAppDir
1073 - getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
1075 - // set some getdown_txt_ properties then go through all properties looking for getdown_txt_...
1076 - def props = project.properties.sort { it.key }
1077 - if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) {
1078 - props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion)
1080 - if (getdownAltJavaMaxVersion != null && getdownAltJavaMaxVersion.length() > 0) {
1081 - props.put("getdown_txt_java_max_version", getdownAltJavaMaxVersion)
1083 - if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
1084 - props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
1086 - if (getdownImagesDir != null && file(getdownImagesDir).exists()) {
1087 - props.put("getdown_txt_ui.background_image", "${getdownImagesDir}/${getdown_background_image}")
1088 - props.put("getdown_txt_ui.instant_background_image", "${getdownImagesDir}/${getdown_instant_background_image}")
1089 - props.put("getdown_txt_ui.error_background", "${getdownImagesDir}/${getdown_error_background}")
1090 - props.put("getdown_txt_ui.progress_image", "${getdownImagesDir}/${getdown_progress_image}")
1091 - props.put("getdown_txt_ui.icon", "${getdownImagesDir}/${getdown_icon}")
1092 - props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesDir}/${getdown_mac_dock_icon}")
1095 - props.put("getdown_txt_title", jalview_name)
1096 - props.put("getdown_txt_ui.name", install4jApplicationName)
1098 - // start with appbase
1099 - getdownTextString += "appbase = ${getdownAppBase}\n"
1100 - props.each{ prop, val ->
1101 - if (prop.startsWith("getdown_txt_") && val != null) {
1102 - if (prop.startsWith("getdown_txt_multi_")) {
1103 - def key = prop.substring(18)
1104 - val.split(",").each{ v ->
1105 - def line = "${key} = ${v}\n"
1106 - getdownTextString += line
1109 - // file values rationalised
1110 - if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
1112 - if (val.indexOf('/') == 0) {
1115 - } else if (val.indexOf('/') > 0) {
1116 - // relative path (relative to jalviewDir)
1117 - r = file( "${jalviewDir}/${val}" )
1120 - val = "${getdown_resource_dir}/" + r.getName()
1121 - getdownWebsiteResourceFilenames += val
1122 - getdownResourceFilenames += r.getPath()
1125 - if (! prop.startsWith("getdown_txt_resource")) {
1126 - def line = prop.substring(12) + " = ${val}\n"
1127 - getdownTextString += line
1133 - getdownWebsiteResourceFilenames.each{ filename ->
1134 - getdownTextString += "resource = ${filename}\n"
1136 - getdownResourceFilenames.each{ filename ->
1139 - into getdownResourceDir
1143 - def getdownWrapperScripts = [ getdown_bash_wrapper_script, getdown_powershell_wrapper_script, getdown_batch_wrapper_script ]
1144 - getdownWrapperScripts.each{ script ->
1145 - def s = file( "${jalviewDir}/utils/getdown/${getdown_wrapper_script_dir}/${script}" )
1149 - into "${getdownWebsiteDir}/${getdown_wrapper_script_dir}"
1151 - getdownTextString += "resource = ${getdown_wrapper_script_dir}/${script}\n"
1155 - def codeFiles = []
1156 - fileTree(file(package_dir)).each{ f ->
1157 - if (f.isDirectory()) {
1158 - def files = fileTree(dir: f, include: ["*"]).getFiles()
1159 - codeFiles += files
1160 - } else if (f.exists()) {
1164 - codeFiles.sort().each{f ->
1165 - def name = f.getName()
1166 - def line = "code = ${getdownAppDistDir}/${name}\n"
1167 - getdownTextString += line
1170 - into getdownAppDir
1174 - // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
1176 - if (JAVA_VERSION.equals("11")) {
1177 - def j11libFiles = fileTree(dir: "${jalviewDir}/${j11libDir}", include: ["*.jar"]).getFiles()
1178 - j11libFiles.sort().each{f ->
1179 - def name = f.getName()
1180 - def line = "code = ${getdown_j11lib_dir}/${name}\n"
1181 - getdownTextString += line
1184 - into getdownJ11libDir
1190 - // 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.
1191 - //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
1192 - getdownTextString += "resource = ${getdown_launcher_new}\n"
1193 - getdownTextString += "class = ${main_class}\n"
1194 - // Not setting these properties in general so that getdownappbase and getdowndistdir will default to release version in jalview.bin.Cache
1195 - if (getdownSetAppBaseProperty) {
1196 - getdownTextString += "jvmarg = -Dgetdowndistdir=${getdownAppDistDir}\n"
1197 - getdownTextString += "jvmarg = -Dgetdownappbase=${getdownAppBase}\n"
1200 - def getdown_txt = file("${getdownWebsiteDir}/getdown.txt")
1201 - getdown_txt.write(getdownTextString)
1203 - def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl"
1204 - def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}")
1205 - launchJvl.write("appbase=${getdownAppBase}")
1207 - // files going into the getdown website dir: getdown-launcher.jar
1209 - from getdownLauncher
1210 - rename(file(getdownLauncher).getName(), getdown_launcher_new)
1211 - into getdownWebsiteDir
1214 - // files going into the getdown website dir: getdown-launcher(-local).jar
1216 - from getdownLauncher
1217 - if (file(getdownLauncher).getName() != getdown_launcher) {
1218 - rename(file(getdownLauncher).getName(), getdown_launcher)
1220 - into getdownWebsiteDir
1223 - // files going into the getdown website dir: ./install dir and files
1224 - if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
1227 - from getdownLauncher
1228 - from "${getdownAppDir}/${getdown_build_properties}"
1229 - if (file(getdownLauncher).getName() != getdown_launcher) {
1230 - rename(file(getdownLauncher).getName(), getdown_launcher)
1232 - into getdownInstallDir
1235 - // and make a copy in the getdown files dir (these are not downloaded by getdown)
1237 - from getdownInstallDir
1238 - into getdownFilesInstallDir
1242 - // files going into the getdown files dir: getdown.txt, getdown-launcher.jar, channel-launch.jvl, build_properties
1246 - from getdownLauncher
1247 - from "${getdownWebsiteDir}/${getdown_build_properties}"
1248 - if (file(getdownLauncher).getName() != getdown_launcher) {
1249 - rename(file(getdownLauncher).getName(), getdown_launcher)
1251 - into getdownFilesDir
1254 - // and ./resources (not all downloaded by getdown)
1256 - from getdownResourceDir
1257 - into "${getdownFilesDir}/${getdown_resource_dir}"
1262 - inputs.dir("${jalviewDir}/${package_dir}")
1264 - outputs.dir(getdownWebsiteDir)
1265 - outputs.dir(getdownFilesDir)
1269 -// a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
1270 -task getdownDigestDir(type: JavaExec) {
1272 - description "A task to run a getdown Digest on a dir with getdown.txt. Provide a DIGESTDIR property via -PDIGESTDIR=..."
1274 - def digestDirPropertyName = "DIGESTDIR"
1276 - classpath = files(getdownLauncher)
1277 - def digestDir = findProperty(digestDirPropertyName)
1278 - if (digestDir == null) {
1279 - throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
1283 - main = "com.threerings.getdown.tools.Digester"
1287 -task getdownDigest(type: JavaExec) {
1288 - group = "distribution"
1289 - description = "Digest the getdown website folder"
1290 - dependsOn getdownWebsite
1292 - classpath = files(getdownLauncher)
1294 - main = "com.threerings.getdown.tools.Digester"
1295 - args getdownWebsiteDir
1296 - inputs.dir(getdownWebsiteDir)
1297 - outputs.file("${getdownWebsiteDir}/digest2.txt")
1302 - group = "distribution"
1303 - description = "Create the minimal and full getdown app folder for installers and website and create digest file"
1304 - dependsOn getdownDigest
1306 - if (reportRsyncCommand) {
1307 - def fromDir = getdownWebsiteDir + (getdownWebsiteDir.endsWith('/')?'':'/')
1308 - def toDir = "${getdown_rsync_dest}/${getdownDir}" + (getdownDir.endsWith('/')?'':'/')
1309 - println "LIKELY RSYNC COMMAND:"
1310 - println "mkdir -p '$toDir'\nrsync -avh --delete '$fromDir' '$toDir'"
1311 - if (RUNRSYNC == "true") {
1313 - commandLine "mkdir", "-p", toDir
1316 - commandLine "rsync", "-avh", "--delete", fromDir, toDir
1324 -tasks.withType(JavaCompile) {
1325 - options.encoding = 'UTF-8'
1331 - delete getdownWebsiteDir
1332 - delete getdownFilesDir
1338 - if (file(install4jHomeDir).exists()) {
1340 - } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
1341 - install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
1342 - } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
1343 - install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
1345 - installDir(file(install4jHomeDir))
1347 - mediaTypes = Arrays.asList(install4j_media_types.split(","))
1351 -task copyInstall4jTemplate {
1352 - def install4jTemplateFile = file("${install4jDir}/${install4j_template}")
1353 - def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}")
1354 - inputs.file(install4jTemplateFile)
1355 - inputs.file(install4jFileAssociationsFile)
1356 - inputs.property("CHANNEL", { CHANNEL })
1357 - outputs.file(install4jConfFile)
1360 - def install4jConfigXml = new XmlParser().parse(install4jTemplateFile)
1362 - // turn off code signing if no OSX_KEYPASS
1363 - if (OSX_KEYPASS == "") {
1364 - install4jConfigXml.'**'.codeSigning.each { codeSigning ->
1365 - codeSigning.'@macEnabled' = "false"
1367 - install4jConfigXml.'**'.windows.each { windows ->
1368 - windows.'@runPostProcessor' = "false"
1372 - // turn off checksum creation for LOCAL channel
1373 - def e = install4jConfigXml.application[0]
1374 - if (CHANNEL == "LOCAL") {
1375 - e.'@createChecksums' = "false"
1377 - e.'@createChecksums' = "true"
1380 - // put file association actions where placeholder action is
1381 - def install4jFileAssociationsText = install4jFileAssociationsFile.text
1382 - def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
1383 - install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true
1384 - if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') {
1385 - def parent = a.parent()
1387 - fileAssociationActions.each { faa ->
1388 - parent.append(faa)
1390 - // don't need to continue in .any loop once replacements have been made
1395 - // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else
1396 - // NB we're deleting the /other/ one!
1397 - // Also remove the examples subdir from non-release versions
1398 - def customizedIdToDelete = "PROGRAM_GROUP_RELEASE"
1399 - // 2.11.1.0 NOT releasing with the Examples folder in the Program Group
1400 - if (false && CHANNEL=="RELEASE") { // remove 'false && ' to include Examples folder in RELEASE channel
1401 - customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE"
1403 - // remove the examples subdir from Full File Set
1404 - def files = install4jConfigXml.files[0]
1405 - def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" }
1406 - def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' }
1407 - def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' }
1408 - def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" }
1409 - dirEntry.parent().remove(dirEntry)
1411 - install4jConfigXml.'**'.action.any { a ->
1412 - if (a.'@customizedId' == customizedIdToDelete) {
1413 - def parent = a.parent()
1419 - // write install4j file
1420 - install4jConfFile.text = XmlUtil.serialize(install4jConfigXml)
1427 - delete install4jConfFile
1432 -task installers(type: com.install4j.gradle.Install4jTask) {
1433 - group = "distribution"
1434 - description = "Create the install4j installers"
1436 - dependsOn copyInstall4jTemplate
1438 - projectFile = install4jConfFile
1440 - // create an md5 for the input files to use as version for install4j conf file
1441 - def digest = MessageDigest.getInstance("MD5")
1443 - (file("${install4jDir}/${install4j_template}").text +
1444 - file("${install4jDir}/${install4j_info_plist_file_associations}").text +
1445 - file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
1446 - def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
1447 - if (filesMd5.length() >= 8) {
1448 - filesMd5 = filesMd5.substring(0,8)
1450 - def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
1451 - // make install4jBuildDir relative to jalviewDir
1452 - def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
1455 - 'JALVIEW_NAME': jalview_name,
1456 - 'JALVIEW_APPLICATION_NAME': install4jApplicationName,
1457 - 'JALVIEW_DIR': "../..",
1458 - 'OSX_KEYSTORE': OSX_KEYSTORE,
1459 - 'OSX_APPLEID': OSX_APPLEID,
1460 - 'OSX_ALTOOLPASS': OSX_ALTOOLPASS,
1461 - 'JSIGN_SH': JSIGN_SH,
1462 - 'JRE_DIR': getdown_app_dir_java,
1463 - 'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
1464 - 'JALVIEW_VERSION': JALVIEW_VERSION,
1465 - 'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
1466 - 'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
1467 - 'JAVA_VERSION': JAVA_VERSION,
1468 - 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
1469 - 'VERSION': JALVIEW_VERSION,
1470 - 'MACOS_JAVA_VM_DIR': macosJavaVMDir,
1471 - 'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
1472 - 'LINUX_JAVA_VM_DIR': linuxJavaVMDir,
1473 - 'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
1474 - 'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
1475 - 'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
1476 - 'COPYRIGHT_MESSAGE': install4j_copyright_message,
1477 - 'BUNDLE_ID': install4jBundleId,
1478 - 'INTERNAL_ID': install4jInternalId,
1479 - 'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
1480 - 'MACOS_DMG_DS_STORE': install4jDMGDSStore,
1481 - 'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
1482 - 'WRAPPER_LINK': getdownWrapperLink,
1483 - 'BASH_WRAPPER_SCRIPT': getdown_bash_wrapper_script,
1484 - 'POWERSHELL_WRAPPER_SCRIPT': getdown_powershell_wrapper_script,
1485 - 'WRAPPER_SCRIPT_BIN_DIR': getdown_wrapper_script_dir,
1486 - 'INSTALLER_NAME': install4jInstallerName,
1487 - 'INSTALL4J_UTILS_DIR': install4j_utils_dir,
1488 - 'GETDOWN_WEBSITE_DIR': getdown_website_dir,
1489 - 'GETDOWN_FILES_DIR': getdown_files_dir,
1490 - 'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
1491 - 'GETDOWN_DIST_DIR': getdownAppDistDir,
1492 - 'GETDOWN_ALT_DIR': getdown_app_dir_alt,
1493 - 'GETDOWN_INSTALL_DIR': getdown_install_dir,
1494 - 'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
1495 - 'BUILD_DIR': install4jBuildDir,
1496 - 'APPLICATION_CATEGORIES': install4j_application_categories,
1497 - 'APPLICATION_FOLDER': install4jApplicationFolder,
1498 - 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
1499 - 'EXECUTABLE_NAME': install4jExecutableName,
1500 - 'EXTRA_SCHEME': install4jExtraScheme,
1501 - 'MAC_ICONS_FILE': install4jMacIconsFile,
1502 - 'WINDOWS_ICONS_FILE': install4jWindowsIconsFile,
1503 - 'PNG_ICON_FILE': install4jPngIconFile,
1504 - 'BACKGROUND': install4jBackground,
1508 - //println("INSTALL4J VARIABLES:")
1509 - //variables.each{k,v->println("${k}=${v}")}
1511 - destination = "${jalviewDir}/${install4jBuildDir}"
1512 - buildSelected = true
1514 - if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
1516 - disableSigning = true
1517 - disableNotarization = true
1520 - if (OSX_KEYPASS) {
1521 - macKeystorePassword = OSX_KEYPASS
1524 - if (OSX_ALTOOLPASS) {
1525 - appleIdPassword = OSX_ALTOOLPASS
1526 - disableNotarization = false
1528 - disableNotarization = true
1532 - println("Using projectFile "+projectFile)
1533 - if (!disableNotarization) { println("Will notarize OSX App DMG") }
1537 - inputs.dir(getdownWebsiteDir)
1538 - inputs.file(install4jConfFile)
1539 - inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
1540 - inputs.dir(macosJavaVMDir)
1541 - inputs.dir(windowsJavaVMDir)
1542 - outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
1548 - eclipse().configFile(eclipse_codestyle_file)
1553 -task sourceDist(type: Tar) {
1554 - group "distribution"
1555 - description "Create a source .tar.gz file for distribution"
1557 - dependsOn createBuildProperties
1558 - dependsOn convertMdFiles
1560 - def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
1561 - def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz"
1562 - archiveFileName = outputFileName
1564 - compression Compression.GZIP
1568 - def EXCLUDE_FILES=[
1579 - "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales",
1581 - "utils/InstallAnywhere",
1584 - def PROCESS_FILES=[
1596 - "gradle.properties",
1602 - "**/*.properties",
1606 - def INCLUDE_FILES=[
1607 - ".settings/org.eclipse.jdt.core.jalview.prefs",
1610 - from(jalviewDir) {
1611 - exclude (EXCLUDE_FILES)
1612 - include (PROCESS_FILES)
1613 - filter(ReplaceTokens,
1617 - 'Version-Rel': JALVIEW_VERSION,
1618 - 'Year-Rel': getDate("yyyy")
1622 - from(jalviewDir) {
1623 - exclude (EXCLUDE_FILES)
1624 - exclude (PROCESS_FILES)
1625 - exclude ("appletlib")
1626 - exclude ("**/*locales")
1627 - exclude ("*locales/**")
1628 - exclude ("utils/InstallAnywhere")
1630 - exclude (getdown_files_dir)
1631 - exclude (getdown_website_dir)
1633 - // exluding these as not using jars as modules yet
1634 - exclude ("${j11modDir}/**/*.jar")
1636 - from(jalviewDir) {
1637 - include(INCLUDE_FILES)
1639 -// from (jalviewDir) {
1640 -// // explicit includes for stuff that seemed to not get included
1641 -// include(fileTree("test/**/*."))
1642 -// exclude(EXCLUDE_FILES)
1643 -// exclude(PROCESS_FILES)
1646 - from(file(buildProperties).getParent()) {
1647 - include(file(buildProperties).getName())
1648 - rename(file(buildProperties).getName(), "build_properties")
1650 - line.replaceAll("^INSTALLATION=.*\$","INSTALLATION=Source Release"+" git-commit\\\\:"+gitHash+" ["+gitBranch+"]")
1658 - dependsOn copyHelp
1659 - dependsOn pubhtmlhelp
1661 - inputs.dir("${helpBuildDir}/${help_dir}")
1662 - outputs.dir("${buildDir}/distributions/${help_dir}")
1666 -task j2sSetHeadlessBuild {
1668 - IN_ECLIPSE = false
1673 -task jalviewjsEnableAltFileProperty(type: WriteProperties) {
1675 - description "Enable the alternative J2S Config file for headless build"
1677 - outputFile = jalviewjsJ2sSettingsFileName
1678 - def j2sPropsFile = file(jalviewjsJ2sSettingsFileName)
1679 - def j2sProps = new Properties()
1680 - if (j2sPropsFile.exists()) {
1682 - def j2sPropsFileFIS = new FileInputStream(j2sPropsFile)
1683 - j2sProps.load(j2sPropsFileFIS)
1684 - j2sPropsFileFIS.close()
1686 - j2sProps.each { prop, val ->
1687 - property(prop, val)
1689 - } catch (Exception e) {
1690 - println("Exception reading ${jalviewjsJ2sSettingsFileName}")
1691 - e.printStackTrace()
1694 - if (! j2sProps.stringPropertyNames().contains(jalviewjs_j2s_alt_file_property_config)) {
1695 - property(jalviewjs_j2s_alt_file_property_config, jalviewjs_j2s_alt_file_property)
1700 -task jalviewjsSetEclipseWorkspace {
1701 - def propKey = "jalviewjs_eclipse_workspace"
1702 - def propVal = null
1703 - if (project.hasProperty(propKey)) {
1704 - propVal = project.getProperty(propKey)
1705 - if (propVal.startsWith("~/")) {
1706 - propVal = System.getProperty("user.home") + propVal.substring(1)
1709 - def propsFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_workspace_location_file}"
1710 - def propsFile = file(propsFileName)
1711 - def eclipseWsDir = propVal
1712 - def props = new Properties()
1714 - def writeProps = true
1715 - if (( eclipseWsDir == null || !file(eclipseWsDir).exists() ) && propsFile.exists()) {
1716 - def ins = new FileInputStream(propsFileName)
1719 - if (props.getProperty(propKey, null) != null) {
1720 - eclipseWsDir = props.getProperty(propKey)
1721 - writeProps = false
1725 - if (eclipseWsDir == null || !file(eclipseWsDir).exists()) {
1726 - def tempDir = File.createTempDir()
1727 - eclipseWsDir = tempDir.getAbsolutePath()
1730 - eclipseWorkspace = file(eclipseWsDir)
1733 - // do not run a headless transpile when we claim to be in Eclipse
1735 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1736 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
1738 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1742 - props.setProperty(propKey, eclipseWsDir)
1743 - propsFile.parentFile.mkdirs()
1744 - def bytes = new ByteArrayOutputStream()
1745 - props.store(bytes, null)
1746 - def propertiesString = bytes.toString()
1747 - propsFile.text = propertiesString
1750 - print("EXISTING ")
1753 - println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
1756 - //inputs.property(propKey, eclipseWsDir) // eclipseWsDir only gets set once this task runs, so will be out-of-date
1757 - outputs.file(propsFileName)
1758 - outputs.upToDateWhen { eclipseWorkspace.exists() && propsFile.exists() }
1762 -task jalviewjsEclipsePaths {
1763 - def eclipseProduct
1765 - def eclipseRoot = jalviewjs_eclipse_root
1766 - if (eclipseRoot.startsWith("~/")) {
1767 - eclipseRoot = System.getProperty("user.home") + eclipseRoot.substring(1)
1769 - if (OperatingSystem.current().isMacOsX()) {
1770 - eclipseRoot += "/Eclipse.app"
1771 - eclipseBinary = "${eclipseRoot}/Contents/MacOS/eclipse"
1772 - eclipseProduct = "${eclipseRoot}/Contents/Eclipse/.eclipseproduct"
1773 - } else if (OperatingSystem.current().isWindows()) { // check these paths!!
1774 - if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
1775 - eclipseRoot += "/eclipse"
1777 - eclipseBinary = "${eclipseRoot}/eclipse.exe"
1778 - eclipseProduct = "${eclipseRoot}/.eclipseproduct"
1779 - } else { // linux or unix
1780 - if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
1781 - eclipseRoot += "/eclipse"
1782 -println("eclipseDir exists")
1784 - eclipseBinary = "${eclipseRoot}/eclipse"
1785 - eclipseProduct = "${eclipseRoot}/.eclipseproduct"
1788 - eclipseVersion = "4.13" // default
1789 - def assumedVersion = true
1790 - if (file(eclipseProduct).exists()) {
1791 - def fis = new FileInputStream(eclipseProduct)
1792 - def props = new Properties()
1794 - eclipseVersion = props.getProperty("version")
1796 - assumedVersion = false
1799 - def propKey = "eclipse_debug"
1800 - eclipseDebug = (project.hasProperty(propKey) && project.getProperty(propKey).equals("true"))
1803 - // do not run a headless transpile when we claim to be in Eclipse
1805 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1806 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
1808 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1811 - if (!assumedVersion) {
1812 - println("ECLIPSE VERSION=${eclipseVersion}")
1818 -task printProperties {
1820 - description "Output to console all System.properties"
1822 - System.properties.each { key, val -> System.out.println("Property: ${key}=${val}") }
1827 -task eclipseSetup {
1828 - dependsOn eclipseProject
1829 - dependsOn eclipseClasspath
1830 - dependsOn eclipseJdt
1834 -// this version (type: Copy) will delete anything in the eclipse dropins folder that isn't in fromDropinsDir
1835 -task jalviewjsEclipseCopyDropins(type: Copy) {
1836 - dependsOn jalviewjsEclipsePaths
1838 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_eclipse_dropins_dir}", include: "*.jar")
1839 - inputFiles += file("${jalviewDir}/${jalviewjsJ2sPlugin}")
1840 - def outputDir = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}"
1847 -// this eclipse -clean doesn't actually work
1848 -task jalviewjsCleanEclipse(type: Exec) {
1849 - dependsOn eclipseSetup
1850 - dependsOn jalviewjsEclipsePaths
1851 - dependsOn jalviewjsEclipseCopyDropins
1853 - executable(eclipseBinary)
1854 - args(["-nosplash", "--launcher.suppressErrors", "-data", eclipseWorkspace.getPath(), "-clean", "-console", "-consoleLog"])
1855 - if (eclipseDebug) {
1860 - def inputString = """exit
1863 - def inputByteStream = new ByteArrayInputStream(inputString.getBytes())
1864 - standardInput = inputByteStream
1867 -/* not really working yet
1868 -jalviewjsEclipseCopyDropins.finalizedBy jalviewjsCleanEclipse
1872 -task jalviewjsTransferUnzipSwingJs {
1873 - def file_zip = "${jalviewDir}/${jalviewjs_swingjs_zip}"
1877 - from zipTree(file_zip)
1878 - into "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
1882 - inputs.file file_zip
1883 - outputs.dir "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
1887 -task jalviewjsTransferUnzipLib {
1888 - def zipFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_libjs_dir}", include: "*.zip")
1891 - zipFiles.each { file_zip ->
1893 - from zipTree(file_zip)
1894 - into "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
1899 - inputs.files zipFiles
1900 - outputs.dir "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
1904 -task jalviewjsTransferUnzipAllLibs {
1905 - dependsOn jalviewjsTransferUnzipSwingJs
1906 - dependsOn jalviewjsTransferUnzipLib
1910 -task jalviewjsCreateJ2sSettings(type: WriteProperties) {
1912 - description "Create the alternative j2s file from the j2s.* properties"
1914 - jalviewjsJ2sProps = project.properties.findAll { it.key.startsWith("j2s.") }.sort { it.key }
1915 - def siteDirProperty = "j2s.site.directory"
1916 - def setSiteDir = false
1917 - jalviewjsJ2sProps.each { prop, val ->
1918 - if (val != null) {
1919 - if (prop == siteDirProperty) {
1920 - if (!(val.startsWith('/') || val.startsWith("file://") )) {
1921 - val = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${val}"
1925 - property(prop,val)
1927 - if (!setSiteDir) { // default site location, don't override specifically set property
1928 - property(siteDirProperty,"${jalviewDirRelativePath}/${jalviewjsTransferSiteJsDir}")
1931 - outputFile = jalviewjsJ2sAltSettingsFileName
1933 - if (! IN_ECLIPSE) {
1934 - inputs.properties(jalviewjsJ2sProps)
1935 - outputs.file(jalviewjsJ2sAltSettingsFileName)
1940 -task jalviewjsEclipseSetup {
1941 - dependsOn jalviewjsEclipseCopyDropins
1942 - dependsOn jalviewjsSetEclipseWorkspace
1943 - dependsOn jalviewjsCreateJ2sSettings
1947 -task jalviewjsSyncAllLibs (type: Sync) {
1948 - dependsOn jalviewjsTransferUnzipAllLibs
1949 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteLibDir}")
1950 - inputFiles += fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}")
1951 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
1955 - def outputFiles = []
1956 - rename { filename ->
1957 - outputFiles += "${outputDir}/${filename}"
1963 - outputs.files outputFiles
1964 - inputs.files inputFiles
1968 -task jalviewjsSyncResources (type: Sync) {
1969 - dependsOn buildResources
1971 - def inputFiles = fileTree(dir: resourcesBuildDir)
1972 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
1976 - def outputFiles = []
1977 - rename { filename ->
1978 - outputFiles += "${outputDir}/${filename}"
1984 - outputs.files outputFiles
1985 - inputs.files inputFiles
1989 -task jalviewjsSyncSiteResources (type: Sync) {
1990 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_site_resource_dir}")
1991 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
1995 - def outputFiles = []
1996 - rename { filename ->
1997 - outputFiles += "${outputDir}/${filename}"
2003 - outputs.files outputFiles
2004 - inputs.files inputFiles
2008 -task jalviewjsSyncBuildProperties (type: Sync) {
2009 - dependsOn createBuildProperties
2010 - def inputFiles = [file(buildProperties)]
2011 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
2015 - def outputFiles = []
2016 - rename { filename ->
2017 - outputFiles += "${outputDir}/${filename}"
2023 - outputs.files outputFiles
2024 - inputs.files inputFiles
2028 -task jalviewjsProjectImport(type: Exec) {
2029 - dependsOn eclipseSetup
2030 - dependsOn jalviewjsEclipsePaths
2031 - dependsOn jalviewjsEclipseSetup
2034 - // do not run a headless import when we claim to be in Eclipse
2036 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2037 - throw new StopExecutionException("Not running headless import whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
2039 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2043 - //def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview/org.eclipse.jdt.core"
2044 - def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview"
2045 - executable(eclipseBinary)
2046 - args(["-nosplash", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", eclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath])
2047 - if (eclipseDebug) {
2050 - args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
2051 - if (!IN_ECLIPSE) {
2052 - args += [ "-D${j2sHeadlessBuildProperty}=true" ]
2053 - args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
2056 - inputs.file("${jalviewDir}/.project")
2057 - outputs.upToDateWhen {
2058 - file(projdir).exists()
2063 -task jalviewjsTranspile(type: Exec) {
2064 - dependsOn jalviewjsEclipseSetup
2065 - dependsOn jalviewjsProjectImport
2066 - dependsOn jalviewjsEclipsePaths
2067 - if (!IN_ECLIPSE) {
2068 - dependsOn jalviewjsEnableAltFileProperty
2072 - // do not run a headless transpile when we claim to be in Eclipse
2074 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2075 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
2077 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2081 - executable(eclipseBinary)
2082 - args(["-nosplash", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", eclipseWorkspace, "-${jalviewjs_eclipse_build_arg}", eclipse_project_name ])
2083 - if (eclipseDebug) {
2086 - args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
2087 - if (!IN_ECLIPSE) {
2088 - args += [ "-D${j2sHeadlessBuildProperty}=true" ]
2089 - args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
2095 - stdout = new ByteArrayOutputStream()
2096 - stderr = new ByteArrayOutputStream()
2098 - def logOutFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}"
2099 - def logOutFile = file(logOutFileName)
2100 - logOutFile.createNewFile()
2101 - logOutFile.text = """ROOT: ${jalviewjs_eclipse_root}
2102 -BINARY: ${eclipseBinary}
2103 -VERSION: ${eclipseVersion}
2104 -WORKSPACE: ${eclipseWorkspace}
2105 -DEBUG: ${eclipseDebug}
2108 - def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
2109 - // combine stdout and stderr
2110 - def logErrFOS = logOutFOS
2112 - if (jalviewjs_j2s_to_console.equals("true")) {
2113 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2114 - new org.apache.tools.ant.util.TeeOutputStream(
2118 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2119 - new org.apache.tools.ant.util.TeeOutputStream(
2124 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2127 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2134 - if (stdout.toString().contains("Error processing ")) {
2135 - // j2s did not complete transpile
2136 - //throw new TaskExecutionException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2137 - if (jalviewjs_ignore_transpile_errors.equals("true")) {
2138 - println("IGNORING TRANSPILE ERRORS")
2139 - println("See eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2141 - throw new GradleException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2146 - inputs.dir("${jalviewDir}/${sourceDir}")
2147 - outputs.dir("${jalviewDir}/${jalviewjsTransferSiteJsDir}")
2148 - outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteJsDir}${jalviewjs_server_resource}").exists() } )
2152 -def jalviewjsCallCore(String name, FileCollection list, String prefixFile, String suffixFile, String jsfile, String zjsfile, File logOutFile, Boolean logOutConsole) {
2154 - def stdout = new ByteArrayOutputStream()
2155 - def stderr = new ByteArrayOutputStream()
2157 - def coreFile = file(jsfile)
2159 - msg = "Creating core for ${name}...\nGenerating ${jsfile}"
2161 - logOutFile.createNewFile()
2162 - logOutFile.append(msg+"\n")
2164 - def coreTop = file(prefixFile)
2165 - def coreBottom = file(suffixFile)
2166 - coreFile.getParentFile().mkdirs()
2167 - coreFile.createNewFile()
2168 - coreFile.write( coreTop.getText("UTF-8") )
2172 - def t = f.getText("UTF-8")
2173 - t.replaceAll("Clazz\\.([^_])","Clazz_${1}")
2174 - coreFile.append( t )
2176 - msg = "...file '"+f.getPath()+"' does not exist, skipping"
2178 - logOutFile.append(msg+"\n")
2181 - coreFile.append( coreBottom.getText("UTF-8") )
2183 - msg = "Generating ${zjsfile}"
2185 - logOutFile.append(msg+"\n")
2186 - def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
2187 - def logErrFOS = logOutFOS
2190 - classpath = files(["${jalviewDir}/${jalviewjs_closure_compiler}"])
2191 - main = "com.google.javascript.jscomp.CommandLineRunner"
2192 - jvmArgs = [ "-Dfile.encoding=UTF-8" ]
2193 - args = [ "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--charset", "UTF-8", "--js", jsfile, "--js_output_file", zjsfile ]
2194 - maxHeapSize = "2g"
2196 - msg = "\nRunning '"+commandLine.join(' ')+"'\n"
2198 - logOutFile.append(msg+"\n")
2200 - if (logOutConsole) {
2201 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2202 - new org.apache.tools.ant.util.TeeOutputStream(
2206 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2207 - new org.apache.tools.ant.util.TeeOutputStream(
2212 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2215 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2222 - logOutFile.append(msg+"\n")
2226 -task jalviewjsBuildAllCores {
2228 - description "Build the core js lib closures listed in the classlists dir"
2229 - dependsOn jalviewjsTranspile
2230 - dependsOn jalviewjsTransferUnzipSwingJs
2232 - def j2sDir = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${jalviewjs_j2s_subdir}"
2233 - def swingJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_j2s_subdir}"
2234 - def libJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteLibDir}/${jalviewjs_j2s_subdir}"
2235 - def jsDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_js_subdir}"
2236 - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}/${jalviewjs_j2s_subdir}/core"
2237 - def prefixFile = "${jsDir}/core/coretop2.js"
2238 - def suffixFile = "${jsDir}/core/corebottom2.js"
2240 - inputs.file prefixFile
2241 - inputs.file suffixFile
2243 - def classlistFiles = []
2244 - // add the classlists found int the jalviewjs_classlists_dir
2245 - fileTree(dir: "${jalviewDir}/${jalviewjs_classlists_dir}", include: "*.txt").each {
2247 - def name = file.getName() - ".txt"
2248 - classlistFiles += [
2254 - // _jmol and _jalview cores. Add any other peculiar classlist.txt files here
2255 - //classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jmol}"), 'name': "_jvjmol" ]
2256 - classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jalview}"), 'name': jalviewjsJalviewCoreName ]
2258 - jalviewjsCoreClasslists = []
2260 - classlistFiles.each {
2263 - def file = hash['file']
2264 - if (! file.exists()) {
2265 - //println("...classlist file '"+file.getPath()+"' does not exist, skipping")
2266 - return false // this is a "continue" in groovy .each closure
2268 - def name = hash['name']
2269 - if (name == null) {
2270 - name = file.getName() - ".txt"
2278 - def list = fileTree(dir: j2sDir, includes: filelist)
2280 - def jsfile = "${outputDir}/core${name}.js"
2281 - def zjsfile = "${outputDir}/core${name}.z.js"
2283 - jalviewjsCoreClasslists += [
2285 - 'zjsfile': zjsfile,
2291 - inputs.files(list)
2292 - outputs.file(jsfile)
2293 - outputs.file(zjsfile)
2296 - // _stevesoft core. add any cores without a classlist here (and the inputs and outputs)
2297 - def stevesoftClasslistName = "_stevesoft"
2298 - def stevesoftClasslist = [
2299 - 'jsfile': "${outputDir}/core${stevesoftClasslistName}.js",
2300 - 'zjsfile': "${outputDir}/core${stevesoftClasslistName}.z.js",
2301 - 'list': fileTree(dir: j2sDir, include: "com/stevesoft/pat/**/*.js"),
2302 - 'name': stevesoftClasslistName
2304 - jalviewjsCoreClasslists += stevesoftClasslist
2305 - inputs.files(stevesoftClasslist['list'])
2306 - outputs.file(stevesoftClasslist['jsfile'])
2307 - outputs.file(stevesoftClasslist['zjsfile'])
2310 - def allClasslistName = "_all"
2311 - def allJsFiles = fileTree(dir: j2sDir, include: "**/*.js")
2312 - allJsFiles += fileTree(
2314 - include: "**/*.js",
2316 - // these exlusions are files that the closure-compiler produces errors for. Should fix them
2317 - "**/org/jmol/jvxl/readers/IsoIntersectFileReader.js",
2318 - "**/org/jmol/export/JSExporter.js"
2321 - allJsFiles += fileTree(
2323 - include: "**/*.js",
2325 - // these exlusions are files that the closure-compiler produces errors for. Should fix them
2326 - "**/sun/misc/Unsafe.js",
2327 - "**/swingjs/jquery/jquery-editable-select.js",
2328 - "**/swingjs/jquery/j2sComboBox.js",
2329 - "**/sun/misc/FloatingDecimal.js"
2332 - def allClasslist = [
2333 - 'jsfile': "${outputDir}/core${allClasslistName}.js",
2334 - 'zjsfile': "${outputDir}/core${allClasslistName}.z.js",
2335 - 'list': allJsFiles,
2336 - 'name': allClasslistName
2338 - // not including this version of "all" core at the moment
2339 - //jalviewjsCoreClasslists += allClasslist
2340 - inputs.files(allClasslist['list'])
2341 - outputs.file(allClasslist['jsfile'])
2342 - outputs.file(allClasslist['zjsfile'])
2345 - def logOutFile = file("${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_closure_stdout}")
2346 - logOutFile.getParentFile().mkdirs()
2347 - logOutFile.createNewFile()
2348 - logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildAllCores\n----\n")
2350 - jalviewjsCoreClasslists.each {
2351 - jalviewjsCallCore(it.name, it.list, prefixFile, suffixFile, it.jsfile, it.zjsfile, logOutFile, jalviewjs_j2s_to_console.equals("true"))
2358 -def jalviewjsPublishCoreTemplate(String coreName, String templateName, File inputFile, String outputFile) {
2361 - into file(outputFile).getParentFile()
2362 - rename { filename ->
2363 - if (filename.equals(inputFile.getName())) {
2364 - return file(outputFile).getName()
2368 - filter(ReplaceTokens,
2372 - 'MAIN': '"'+main_class+'"',
2374 - 'NAME': jalviewjsJalviewTemplateName+" [core ${coreName}]",
2375 - 'COREKEY': jalviewjs_core_key,
2376 - 'CORENAME': coreName
2383 -task jalviewjsPublishCoreTemplates {
2384 - dependsOn jalviewjsBuildAllCores
2385 - def inputFileName = "${jalviewDir}/${j2s_coretemplate_html}"
2386 - def inputFile = file(inputFileName)
2387 - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
2389 - def outputFiles = []
2390 - jalviewjsCoreClasslists.each { cl ->
2391 - def outputFile = "${outputDir}/${jalviewjsJalviewTemplateName}_${cl.name}.html"
2392 - cl['outputfile'] = outputFile
2393 - outputFiles += outputFile
2397 - jalviewjsCoreClasslists.each { cl ->
2398 - jalviewjsPublishCoreTemplate(cl.name, jalviewjsJalviewTemplateName, inputFile, cl.outputfile)
2401 - inputs.file(inputFile)
2402 - outputs.files(outputFiles)
2406 -task jalviewjsSyncCore (type: Sync) {
2407 - dependsOn jalviewjsBuildAllCores
2408 - dependsOn jalviewjsPublishCoreTemplates
2409 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteCoreDir}")
2410 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
2414 - def outputFiles = []
2415 - rename { filename ->
2416 - outputFiles += "${outputDir}/${filename}"
2422 - outputs.files outputFiles
2423 - inputs.files inputFiles
2427 -// this Copy version of TransferSiteJs will delete anything else in the target dir
2428 -task jalviewjsCopyTransferSiteJs(type: Copy) {
2429 - dependsOn jalviewjsTranspile
2430 - from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2431 - into "${jalviewDir}/${jalviewjsSiteDir}"
2435 -// this Sync version of TransferSite is used by buildship to keep the website automatically up to date when a file changes
2436 -task jalviewjsSyncTransferSiteJs(type: Sync) {
2437 - from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2439 - into "${jalviewDir}/${jalviewjsSiteDir}"
2446 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsCopyTransferSiteJs
2447 -jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSiteJs
2448 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSiteJs
2449 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsCopyTransferSiteJs
2451 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsSyncTransferSiteJs
2452 -jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSiteJs
2453 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSiteJs
2454 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsSyncTransferSiteJs
2457 -task jalviewjsPrepareSite {
2459 - description "Prepares the website folder including unzipping files and copying resources"
2460 - dependsOn jalviewjsSyncAllLibs
2461 - dependsOn jalviewjsSyncResources
2462 - dependsOn jalviewjsSyncSiteResources
2463 - dependsOn jalviewjsSyncBuildProperties
2464 - dependsOn jalviewjsSyncCore
2468 -task jalviewjsBuildSite {
2470 - description "Builds the whole website including transpiled code"
2471 - dependsOn jalviewjsCopyTransferSiteJs
2472 - dependsOn jalviewjsPrepareSite
2476 -task cleanJalviewjsTransferSite {
2478 - delete "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2479 - delete "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
2480 - delete "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
2481 - delete "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
2486 -task cleanJalviewjsSite {
2487 - dependsOn cleanJalviewjsTransferSite
2489 - delete "${jalviewDir}/${jalviewjsSiteDir}"
2494 -task jalviewjsSiteTar(type: Tar) {
2496 - description "Creates a tar.gz file for the website"
2497 - dependsOn jalviewjsBuildSite
2498 - def outputFilename = "jalviewjs-site-${JALVIEW_VERSION}.tar.gz"
2499 - archiveFileName = outputFilename
2501 - compression Compression.GZIP
2503 - from "${jalviewDir}/${jalviewjsSiteDir}"
2504 - into jalviewjs_site_dir // this is inside the tar file
2506 - inputs.dir("${jalviewDir}/${jalviewjsSiteDir}")
2510 -task jalviewjsServer {
2512 - def filename = "jalviewjsTest.html"
2513 - description "Starts a webserver on localhost to test the website. See ${filename} to access local site on most recently used port."
2514 - def htmlFile = "${jalviewDirAbsolutePath}/${filename}"
2519 - def f = Class.forName("org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory")
2520 - factory = f.newInstance()
2521 - } catch (ClassNotFoundException e) {
2522 - throw new GradleException("Unable to create SimpleHttpFileServerFactory")
2524 - def port = Integer.valueOf(jalviewjs_server_port)
2526 - def running = false
2528 - def jalviewjsServer
2529 - while(port < start+1000 && !running) {
2531 - def doc_root = new File("${jalviewDirAbsolutePath}/${jalviewjsSiteDir}")
2532 - jalviewjsServer = factory.start(doc_root, port)
2534 - url = jalviewjsServer.getResourceUrl(jalviewjs_server_resource)
2535 - println("SERVER STARTED with document root ${doc_root}.")
2536 - println("Go to "+url+" . Run gradle --stop to stop (kills all gradle daemons).")
2537 - println("For debug: "+url+"?j2sdebug")
2538 - println("For verbose: "+url+"?j2sverbose")
2539 - } catch (Exception e) {
2543 - def htmlText = """
2544 - <p><a href="${url}">JalviewJS Test. <${url}></a></p>
2545 - <p><a href="${url}?j2sdebug">JalviewJS Test with debug. <${url}?j2sdebug></a></p>
2546 - <p><a href="${url}?j2sverbose">JalviewJS Test with verbose. <${url}?j2sdebug></a></p>
2548 - jalviewjsCoreClasslists.each { cl ->
2549 - def urlcore = jalviewjsServer.getResourceUrl(file(cl.outputfile).getName())
2551 - <p><a href="${urlcore}">${jalviewjsJalviewTemplateName} [core ${cl.name}]. <${urlcore}></a></p>
2553 - println("For core ${cl.name}: "+urlcore)
2556 - file(htmlFile).text = htmlText
2559 - outputs.file(htmlFile)
2560 - outputs.upToDateWhen({false})
2564 -task cleanJalviewjsAll {
2566 - description "Delete all configuration and build artifacts to do with JalviewJS build"
2567 - dependsOn cleanJalviewjsSite
2568 - dependsOn jalviewjsEclipsePaths
2571 - delete "${jalviewDir}/${jalviewjsBuildDir}"
2572 - delete "${jalviewDir}/${eclipse_bin_dir}"
2573 - if (eclipseWorkspace != null && file(eclipseWorkspace.getAbsolutePath()+"/.metadata").exists()) {
2574 - delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata")
2576 - delete jalviewjsJ2sAltSettingsFileName
2579 - outputs.upToDateWhen( { false } )
2583 -task jalviewjsIDE_checkJ2sPlugin {
2584 - group "00 JalviewJS in Eclipse"
2585 - description "Compare the swingjs/net.sf.j2s.core(-j11)?.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)"
2588 - def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
2589 - def j2sPluginFile = file(j2sPlugin)
2590 - def eclipseHome = System.properties["eclipse.home.location"]
2591 - if (eclipseHome == null || ! IN_ECLIPSE) {
2592 - throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
2594 - def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ]
2595 - def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"]
2596 - if (altPluginsDir != null && file(altPluginsDir).exists()) {
2597 - eclipseJ2sPluginDirs += altPluginsDir
2599 - def foundPlugin = false
2600 - def j2sPluginFileName = j2sPluginFile.getName()
2601 - def eclipseJ2sPlugin
2602 - def eclipseJ2sPluginFile
2603 - eclipseJ2sPluginDirs.any { dir ->
2604 - eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}"
2605 - eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
2606 - if (eclipseJ2sPluginFile.exists()) {
2607 - foundPlugin = true
2611 - if (!foundPlugin) {
2612 - def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin"
2613 - System.err.println(msg)
2614 - throw new StopExecutionException(msg)
2617 - def digest = MessageDigest.getInstance("MD5")
2619 - digest.update(j2sPluginFile.text.bytes)
2620 - def j2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
2622 - digest.update(eclipseJ2sPluginFile.text.bytes)
2623 - def eclipseJ2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
2625 - if (j2sPluginMd5 != eclipseJ2sPluginMd5) {
2626 - def msg = "WARNING! Eclipse J2S Plugin '${eclipseJ2sPlugin}' is different to this commit's version '${j2sPlugin}'"
2627 - System.err.println(msg)
2628 - throw new StopExecutionException(msg)
2630 - def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)"
2636 -task jalviewjsIDE_copyJ2sPlugin {
2637 - group "00 JalviewJS in Eclipse"
2638 - description "Copy the swingjs/net.sf.j2s.core(-j11)?.jar file into the Eclipse IDE's 'dropins' dir"
2641 - def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
2642 - def j2sPluginFile = file(j2sPlugin)
2643 - def eclipseHome = System.properties["eclipse.home.location"]
2644 - if (eclipseHome == null || ! IN_ECLIPSE) {
2645 - throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. NOT copying J2S Plugin.")
2647 - def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}"
2648 - def eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
2649 - def msg = "WARNING! Copying this commit's j2s plugin '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n* May require an Eclipse restart"
2650 - System.err.println(msg)
2653 - eclipseJ2sPluginFile.getParentFile().mkdirs()
2654 - into eclipseJ2sPluginFile.getParent()
2660 -task jalviewjsIDE_j2sFile {
2661 - group "00 JalviewJS in Eclipse"
2662 - description "Creates the .j2s file"
2663 - dependsOn jalviewjsCreateJ2sSettings
2667 -task jalviewjsIDE_SyncCore {
2668 - group "00 JalviewJS in Eclipse"
2669 - description "Build the core js lib closures listed in the classlists dir and publish core html from template"
2670 - dependsOn jalviewjsSyncCore
2674 -task jalviewjsIDE_SyncSiteAll {
2675 - dependsOn jalviewjsSyncAllLibs
2676 - dependsOn jalviewjsSyncResources
2677 - dependsOn jalviewjsSyncSiteResources
2678 - dependsOn jalviewjsSyncBuildProperties
2682 -cleanJalviewjsTransferSite.mustRunAfter jalviewjsIDE_SyncSiteAll
2685 -task jalviewjsIDE_PrepareSite {
2686 - group "00 JalviewJS in Eclipse"
2687 - description "Sync libs and resources to site dir, but not closure cores"
2689 - dependsOn jalviewjsIDE_SyncSiteAll
2690 - //dependsOn cleanJalviewjsTransferSite // not sure why this clean is here -- will slow down a re-run of this task
2694 -task jalviewjsIDE_AssembleSite {
2695 - group "00 JalviewJS in Eclipse"
2696 - description "Assembles unzipped supporting zipfiles, resources, site resources and closure cores into the Eclipse transpiled site"
2697 - dependsOn jalviewjsPrepareSite
2701 -task jalviewjsIDE_SiteClean {
2702 - group "00 JalviewJS in Eclipse"
2703 - description "Deletes the Eclipse transpiled site"
2704 - dependsOn cleanJalviewjsSite
2708 -task jalviewjsIDE_Server {
2709 - group "00 JalviewJS in Eclipse"
2710 - description "Starts a webserver on localhost to test the website"
2711 - dependsOn jalviewjsServer
2715 -// buildship runs this at import or gradle refresh
2716 -task eclipseSynchronizationTask {
2717 - //dependsOn eclipseSetup
2718 - dependsOn createBuildProperties
2719 - if (J2S_ENABLED) {
2720 - dependsOn jalviewjsIDE_j2sFile
2721 - dependsOn jalviewjsIDE_checkJ2sPlugin
2722 - dependsOn jalviewjsIDE_PrepareSite
2727 -// buildship runs this at build time or project refresh
2728 -task eclipseAutoBuildTask {
2729 - //dependsOn jalviewjsIDE_checkJ2sPlugin
2730 - //dependsOn jalviewjsIDE_PrepareSite
2731 + outputs.file("${outputDir}/${archiveFileName}")
2737 - description "Build the site"
2738 - dependsOn jalviewjsBuildSite