1 diff --git a/build.gradle b/build.gradle
2 index ca599a85a..ce7f13634 100644
6 * For properties set within build.gradle, use camelCaseNoSpace.
8 import org.apache.tools.ant.filters.ReplaceTokens
9 -import org.gradle.internal.os.OperatingSystem
10 -import org.gradle.plugins.ide.internal.generator.PropertiesPersistableConfigurationObject
11 -import org.gradle.api.internal.PropertiesTransformer
12 -import org.gradle.util.ConfigureUtil
13 -import org.gradle.plugins.ide.eclipse.model.Output
14 -import org.gradle.plugins.ide.eclipse.model.Library
15 -import java.security.MessageDigest
16 -import java.util.regex.Matcher
17 -import groovy.transform.ExternalizeMethods
18 -import groovy.util.XmlParser
19 -import groovy.xml.XmlUtil
20 -import groovy.json.JsonBuilder
21 -import com.vladsch.flexmark.util.ast.Node
22 -import com.vladsch.flexmark.html.HtmlRenderer
23 -import com.vladsch.flexmark.parser.Parser
24 -import com.vladsch.flexmark.util.data.MutableDataSet
25 -import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension
26 -import com.vladsch.flexmark.ext.tables.TablesExtension
27 -import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension
28 -import com.vladsch.flexmark.ext.autolink.AutolinkExtension
29 -import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension
30 -import com.vladsch.flexmark.ext.toc.TocExtension
31 -import com.google.common.hash.HashCode
32 -import com.google.common.hash.Hashing
33 -import com.google.common.io.Files
34 -import org.jsoup.Jsoup
35 -import org.jsoup.nodes.Element
43 - classpath "com.vladsch.flexmark:flexmark-all:0.62.0"
44 - classpath "org.jsoup:jsoup:1.14.3"
45 - classpath "com.eowise:gradle-imagemagick:0.5.1"
54 - id "com.diffplug.gradle.spotless" version "3.28.0"
55 - id 'com.github.johnrengelman.shadow' version '4.0.3'
56 - id 'com.install4j.gradle' version '10.0.3'
57 - id 'com.dorongold.task-tree' version '2.1.1' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
58 - id 'com.palantir.git-version' version '0.13.0' apply false
69 // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use
70 def string(Object o) {
71 return o == null ? "" : o.toString()
72 @@ -102,34 +48,20 @@ def overrideProperties(String propsFileName, boolean output = false) {
78 jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
79 jalviewDirRelativePath = jalviewDir
82 - getdownChannelName = CHANNEL.toLowerCase()
83 - // default to "default". Currently only has different cosmetics for "develop", "release", "default"
84 - propertiesChannelName = ["develop", "release", "test-release", "jalviewjs", "jalviewjs-release" ].contains(getdownChannelName) ? getdownChannelName : "default"
85 - channelDirName = propertiesChannelName
86 - // Import channel_properties
87 - if (getdownChannelName.startsWith("develop-")) {
88 - channelDirName = "develop-SUFFIX"
90 - channelDir = string("${jalviewDir}/${channel_properties_dir}/${channelDirName}")
91 + propertiesChannelName = "release"
92 + channelDir = string("${jalviewDir}/${channel_properties_dir}/${propertiesChannelName}")
93 channelGradleProperties = string("${channelDir}/channel_gradle.properties")
94 - channelPropsFile = string("${channelDir}/${resource_dir}/${channel_props}")
95 overrideProperties(channelGradleProperties, false)
96 - // local build environment properties
97 - // can be "projectDir/local.properties"
98 - overrideProperties("${projectDir}/local.properties", true)
99 - // or "../projectDir_local.properties"
100 - overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true)
104 // Import releaseProps from the RELEASE file
105 // or a file specified via JALVIEW_RELEASE_FILE if defined
106 // Expect jalview.version and target release branch in jalview.release
107 - releaseProps = new Properties();
108 + def releaseProps = new Properties();
109 def releasePropFile = findProperty("JALVIEW_RELEASE_FILE");
110 def defaultReleasePropFile = "${jalviewDirAbsolutePath}/RELEASE";
112 @@ -144,42 +76,6 @@ ext {
113 if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) {
114 JALVIEW_VERSION = releaseProps.get("jalview.version")
116 - println("JALVIEW_VERSION is set to '${JALVIEW_VERSION}'")
118 - // this property set when running Eclipse headlessly
119 - j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
120 - // this property set by Eclipse
121 - eclipseApplicationProperty = string("eclipse.application")
122 - // CHECK IF RUNNING FROM WITHIN ECLIPSE
123 - def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty]
124 - IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.")
125 - // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET
126 - if (System.properties[j2sHeadlessBuildProperty].equals("true")) {
127 - println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'")
131 - println("WITHIN ECLIPSE IDE")
133 - println("HEADLESS BUILD")
136 - J2S_ENABLED = (project.hasProperty('j2s.compiler.status') && project['j2s.compiler.status'] != null && project['j2s.compiler.status'] == "enable")
138 - println("J2S ENABLED")
141 - System.properties.sort { it.key }.each {
142 - key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
145 - if (false && IN_ECLIPSE) {
146 - jalviewDir = jalviewDirAbsolutePath
151 - buildDate = new Date().format("yyyyMMdd")
154 bareSourceDir = string(source_dir)
155 @@ -190,273 +86,18 @@ ext {
157 classesDir = string("${jalviewDir}/${classes_dir}")
160 - useClover = clover.equals("true")
161 - cloverBuildDir = "${buildDir}/clover"
162 - cloverInstrDir = file("${cloverBuildDir}/clover-instr")
163 - cloverClassesDir = file("${cloverBuildDir}/clover-classes")
164 - cloverReportDir = file("${buildDir}/reports/clover")
165 - cloverTestInstrDir = file("${cloverBuildDir}/clover-test-instr")
166 - cloverTestClassesDir = file("${cloverBuildDir}/clover-test-classes")
167 - //cloverTestClassesDir = cloverClassesDir
168 - cloverDb = string("${cloverBuildDir}/clover.db")
171 - testSourceDir = useClover ? cloverTestInstrDir : testDir
172 - testClassesDir = useClover ? cloverTestClassesDir : "${jalviewDir}/${test_output_dir}"
173 + resourceClassesDir = classesDir
176 - backgroundImageText = BACKGROUNDIMAGETEXT
177 - getdownChannelDir = string("${getdown_website_dir}/${propertiesChannelName}")
178 - getdownAppBaseDir = string("${jalviewDir}/${getdownChannelDir}/${JAVA_VERSION}")
179 - getdownArchiveDir = string("${jalviewDir}/${getdown_archive_dir}")
180 - getdownFullArchiveDir = null
181 - getdownTextLines = []
182 - getdownLaunchJvl = null
183 - getdownVersionLaunchJvl = null
185 - buildProperties = null
186 + testSourceDir = testDir
187 + testClassesDir = "${jalviewDir}/${test_output_dir}"
189 - // the following values might be overridden by the CHANNEL switch
190 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
191 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
192 - getdownArchiveAppBase = getdown_archive_base
193 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
194 - getdownAppDistDir = getdown_app_dir_alt
195 - getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}")
196 - getdownImagesBuildDir = string("${buildDir}/imagemagick/getdown")
197 + buildProperties = string("${classesDir}/${build_properties_file}")
198 getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application
199 - reportRsyncCommand = false
200 - jvlChannelName = CHANNEL.toLowerCase()
201 - install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
202 - install4jDMGDSStore = "${install4j_images_dir}/${install4j_dmg_ds_store}"
203 - install4jDMGBackgroundImageDir = "${install4j_images_dir}"
204 - install4jDMGBackgroundImageBuildDir = "build/imagemagick/install4j"
205 - install4jDMGBackgroundImageFile = "${install4j_dmg_background}"
206 - install4jInstallerName = "${jalview_name} Non-Release Installer"
207 - install4jExecutableName = install4j_executable_name
208 - install4jExtraScheme = "jalviewx"
209 - install4jMacIconsFile = string("${install4j_images_dir}/${install4j_mac_icons_file}")
210 - install4jWindowsIconsFile = string("${install4j_images_dir}/${install4j_windows_icons_file}")
211 - install4jPngIconFile = string("${install4j_images_dir}/${install4j_png_icon_file}")
212 - install4jBackground = string("${install4j_images_dir}/${install4j_background}")
213 - install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
214 - install4jCheckSums = true
216 - applicationName = "${jalview_name}"
220 - // TODO: get bamboo build artifact URL for getdown artifacts
221 - getdown_channel_base = bamboo_channelbase
222 - getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
223 - getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
224 - jvlChannelName += "_${getdownChannelName}"
225 - // automatically add the test group Not-bamboo for exclusion
226 - if ("".equals(testng_excluded_groups)) {
227 - testng_excluded_groups = "Not-bamboo"
229 - install4jExtraScheme = "jalviewb"
230 - backgroundImageText = true
233 - case [ "RELEASE", "JALVIEWJS-RELEASE" ]:
234 - getdownAppDistDir = getdown_app_dir_release
235 - getdownSetAppBaseProperty = true
236 - reportRsyncCommand = true
237 - install4jSuffix = ""
238 - install4jInstallerName = "${jalview_name} Installer"
242 - getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
243 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
244 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
245 - if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
246 - throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
248 - package_dir = string("${ARCHIVEDIR}/${package_dir}")
249 - buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
252 - reportRsyncCommand = true
253 - install4jExtraScheme = "jalviewa"
256 - case "ARCHIVELOCAL":
257 - getdownChannelName = string("archive/${JALVIEW_VERSION}")
258 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
259 - getdownAppBase = file(getdownAppBaseDir).toURI().toString()
260 - if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
261 - throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution [did not find '${ARCHIVEDIR}/${package_dir}']")
263 - package_dir = string("${ARCHIVEDIR}/${package_dir}")
264 - buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
267 - reportRsyncCommand = true
268 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
269 - install4jSuffix = "Archive"
270 - install4jExtraScheme = "jalviewa"
273 - case ~/^DEVELOP-([\.\-\w]*)$/:
274 - def suffix = Matcher.lastMatcher[0][1]
275 - reportRsyncCommand = true
276 - getdownSetAppBaseProperty = true
277 - JALVIEW_VERSION=JALVIEW_VERSION+"-d${suffix}-${buildDate}"
278 - install4jSuffix = "Develop ${suffix}"
279 - install4jExtraScheme = "jalviewd"
280 - install4jInstallerName = "${jalview_name} Develop ${suffix} Installer"
281 - getdownChannelName = string("develop-${suffix}")
282 - getdownChannelDir = string("${getdown_website_dir}/${getdownChannelName}")
283 - getdownAppBaseDir = string("${jalviewDir}/${getdownChannelDir}/${JAVA_VERSION}")
284 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
285 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
286 - channelSuffix = string(suffix)
287 - backgroundImageText = true
291 - reportRsyncCommand = true
292 - getdownSetAppBaseProperty = true
293 - // DEVELOP-RELEASE is usually associated with a Jalview release series so set the version
294 - JALVIEW_VERSION=JALVIEW_VERSION+"-d${buildDate}"
296 - install4jSuffix = "Develop"
297 - install4jExtraScheme = "jalviewd"
298 - install4jInstallerName = "${jalview_name} Develop Installer"
299 - backgroundImageText = true
302 - case "TEST-RELEASE":
303 - reportRsyncCommand = true
304 - getdownSetAppBaseProperty = true
305 - // Don't ignore transpile errors for release build
306 - if (jalviewjs_ignore_transpile_errors.equals("true")) {
307 - jalviewjs_ignore_transpile_errors = "false"
308 - println("Setting jalviewjs_ignore_transpile_errors to 'false'")
310 - JALVIEW_VERSION = JALVIEW_VERSION+"-test"
311 - install4jSuffix = "Test"
312 - install4jExtraScheme = "jalviewt"
313 - install4jInstallerName = "${jalview_name} Test Installer"
314 - backgroundImageText = true
317 - case ~/^SCRATCH(|-[-\w]*)$/:
318 - getdownChannelName = CHANNEL
319 - JALVIEW_VERSION = JALVIEW_VERSION+"-"+CHANNEL
321 - getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
322 - getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
323 - reportRsyncCommand = true
324 - install4jSuffix = "Scratch"
328 - if (!file("${LOCALDIR}").exists()) {
329 - throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
331 - getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
332 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
334 - JALVIEW_VERSION = "TEST"
335 - install4jSuffix = "Test-Local"
336 - install4jExtraScheme = "jalviewt"
337 - install4jInstallerName = "${jalview_name} Test Installer"
338 - backgroundImageText = true
341 - case [ "LOCAL", "JALVIEWJS" ]:
342 - JALVIEW_VERSION = "TEST"
343 - getdownAppBase = file(getdownAppBaseDir).toURI().toString()
344 - getdownArchiveAppBase = file("${jalviewDir}/${getdown_archive_dir}").toURI().toString()
345 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
346 - install4jExtraScheme = "jalviewl"
347 - install4jCheckSums = false
350 - default: // something wrong specified
351 - throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
355 - JALVIEW_VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
356 - hugoDataJsonFile = file("${jalviewDir}/${hugo_build_dir}/${hugo_data_installers_dir}/installers-${JALVIEW_VERSION_UNDERSCORES}.json")
357 - hugoArchiveMdFile = file("${jalviewDir}/${hugo_build_dir}/${hugo_version_archive_dir}/Version-${JALVIEW_VERSION_UNDERSCORES}/_index.md")
358 - // override getdownAppBase if requested
359 - if (findProperty("getdown_appbase_override") != null) {
360 - // revert to LOCAL if empty string
361 - if (string(getdown_appbase_override) == "") {
362 - getdownAppBase = file(getdownAppBaseDir).toURI().toString()
363 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
364 - } else if (string(getdown_appbase_override).startsWith("file://")) {
365 - getdownAppBase = string(getdown_appbase_override)
366 - getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
368 - getdownAppBase = string(getdown_appbase_override)
370 - println("Overriding getdown appbase with '${getdownAppBase}'")
372 - // sanitise file name for jalview launcher file for this channel
373 - jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_")
374 - // install4j application and folder names
375 - if (install4jSuffix == "") {
376 - install4jBundleId = "${install4j_bundle_id}"
377 - install4jWinApplicationId = install4j_release_win_application_id
379 - applicationName = "${jalview_name} ${install4jSuffix}"
380 - install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
381 - // add int hash of install4jSuffix to the last part of the application_id
382 - def id = install4j_release_win_application_id
383 - def idsplitreverse = id.split("-").reverse()
384 - idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
385 - install4jWinApplicationId = idsplitreverse.reverse().join("-")
387 - // sanitise folder and id names
388 - // install4jApplicationFolder = e.g. "Jalview Build"
389 - install4jApplicationFolder = applicationName
390 - .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
391 - .replaceAll("_+", "_") // collapse __
392 - install4jInternalId = applicationName
393 - .replaceAll(" ","_")
394 - .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
395 - .replaceAll("_+", "") // collapse __
396 - //.replaceAll("_*-_*", "-") // collapse _-_
397 - install4jUnixApplicationFolder = applicationName
398 - .replaceAll(" ","_")
399 - .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
400 - .replaceAll("_+", "_") // collapse __
401 - .replaceAll("_*-_*", "-") // collapse _-_
404 - getdownWrapperLink = install4jUnixApplicationFolder // e.g. "jalview_local"
405 - getdownAppDir = string("${getdownAppBaseDir}/${getdownAppDistDir}")
406 - //getdownJ11libDir = "${getdownAppBaseDir}/${getdown_j11lib_dir}"
407 - getdownResourceDir = string("${getdownAppBaseDir}/${getdown_resource_dir}")
408 - getdownInstallDir = string("${getdownAppBaseDir}/${getdown_install_dir}")
409 - getdownFilesDir = string("${jalviewDir}/${getdown_files_dir}/${JAVA_VERSION}/")
410 - getdownFilesInstallDir = string("${getdownFilesDir}/${getdown_install_dir}")
411 - /* compile without modules -- using classpath libraries
412 - modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
413 - modules_runtimeClasspath = modules_compileClasspath
417 - gitBranch = "Source"
419 - apply plugin: "com.palantir.git-version"
420 - def details = versionDetails()
421 - gitHash = details.gitHash
422 - gitBranch = details.branchName
423 - } catch(org.gradle.api.internal.plugins.PluginApplicationException e) {
424 - println("Not in a git repository. Using git values from RELEASE properties file.")
425 - gitHash = releaseProps.getProperty("git.hash")
426 - gitBranch = releaseProps.getProperty("git.branch")
427 - } catch(java.lang.RuntimeException e1) {
428 - throw new GradleException("Error with git-version plugin. Directory '.git' exists but versionDetails() cannot be found.")
431 + install4jApplicationName = "${jalview_name}"
433 println("Using a ${CHANNEL} profile.")
435 additional_compiler_args = []
436 @@ -468,65 +109,16 @@ ext {
437 libDistDir = j8libDir
438 compile_source_compatibility = 1.8
439 compile_target_compatibility = 1.8
440 - // these are getdown.txt properties defined dependent on the JAVA_VERSION
441 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
442 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
443 - // this property is assigned below and expanded to multiple lines in the getdown task
444 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
445 - // this property is for the Java library used in eclipse
446 - eclipseJavaRuntimeName = string("JavaSE-1.8")
447 } else if (JAVA_VERSION.equals("11")) {
448 JAVA_INTEGER_VERSION = string("11")
450 libDistDir = j11libDir
451 compile_source_compatibility = 11
452 compile_target_compatibility = 11
453 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
454 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
455 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
456 - eclipseJavaRuntimeName = string("JavaSE-11")
457 - /* compile without modules -- using classpath libraries
458 - additional_compiler_args += [
459 - '--module-path', modules_compileClasspath.asPath,
460 - '--add-modules', j11modules
463 - } else if (JAVA_VERSION.equals("17")) {
464 - JAVA_INTEGER_VERSION = string("17")
466 - libDistDir = j17libDir
467 - compile_source_compatibility = 17
468 - compile_target_compatibility = 17
469 - getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
470 - getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
471 - getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
472 - eclipseJavaRuntimeName = string("JavaSE-17")
473 - /* compile without modules -- using classpath libraries
474 - additional_compiler_args += [
475 - '--module-path', modules_compileClasspath.asPath,
476 - '--add-modules', j11modules
480 throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
485 - JAVA_MIN_VERSION = JAVA_VERSION
486 - JAVA_MAX_VERSION = JAVA_VERSION
487 - jreInstallsDir = string(jre_installs_dir)
488 - if (jreInstallsDir.startsWith("~/")) {
489 - jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1)
491 - install4jDir = string("${jalviewDir}/${install4j_utils_dir}")
492 - install4jConfFileName = string("jalview-install4j-conf.install4j")
493 - install4jConfFile = file("${install4jDir}/${install4jConfFileName}")
494 - install4jHomeDir = install4j_home_dir
495 - if (install4jHomeDir.startsWith("~/")) {
496 - install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
499 resourceBuildDir = string("${buildDir}/resources")
500 resourcesBuildDir = string("${resourceBuildDir}/resources_build")
501 helpBuildDir = string("${resourceBuildDir}/help_build")
502 @@ -540,39 +132,6 @@ ext {
503 helpSourceDir = string("${helpParentDir}/${help_dir}")
504 helpFile = string("${helpBuildDir}/${help_dir}/help.jhm")
506 - convertBinary = null
507 - convertBinaryExpectedLocation = imagemagick_convert
508 - if (convertBinaryExpectedLocation.startsWith("~/")) {
509 - convertBinaryExpectedLocation = System.getProperty("user.home") + convertBinaryExpectedLocation.substring(1)
511 - if (file(convertBinaryExpectedLocation).exists()) {
512 - convertBinary = convertBinaryExpectedLocation
515 - relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
516 - jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs")
517 - jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}")
519 - jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir)
521 - jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js")
523 - jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib")
524 - jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs")
525 - jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core")
526 - jalviewjsJalviewCoreHtmlFile = string("")
527 - jalviewjsJalviewCoreName = string(jalviewjs_core_name)
528 - jalviewjsCoreClasslists = []
529 - jalviewjsJalviewTemplateName = string(jalviewjs_name)
530 - jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
531 - jalviewjsJ2sAltSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_alt_settings}")
532 - jalviewjsJ2sProps = null
533 - jalviewjsJ2sPlugin = jalviewjs_j2s_plugin
535 - eclipseWorkspace = null
536 - eclipseBinary = string("")
537 - eclipseVersion = string("")
538 - eclipseDebug = false
542 @@ -591,27 +150,12 @@ sourceSets {
543 compileClasspath = files(sourceSets.main.java.outputDir)
544 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
546 - runtimeClasspath = compileClasspath
547 - runtimeClasspath += files(sourceSets.main.resources.srcDirs)
552 - srcDirs cloverInstrDir
553 - outputDir = cloverClassesDir
557 - srcDirs = sourceSets.main.resources.srcDirs
560 - compileClasspath = files( sourceSets.clover.java.outputDir )
561 - //compileClasspath += files( testClassesDir )
562 + compileClasspath = files(sourceSets.main.java.outputDir)
563 compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
564 - compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
565 - compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"])
567 runtimeClasspath = compileClasspath
568 + runtimeClasspath += files(sourceSets.main.resources.srcDirs)
572 @@ -631,453 +175,41 @@ sourceSets {
573 runtimeClasspath = compileClasspath
574 runtimeClasspath += files(sourceSets.test.resources.srcDirs)
580 -// eclipse project and settings files creation, also used by buildship
583 - name = eclipse_project_name
585 - natures 'org.eclipse.jdt.core.javanature',
586 - 'org.eclipse.jdt.groovy.core.groovyNature',
587 - 'org.eclipse.buildship.core.gradleprojectnature'
589 - buildCommand 'org.eclipse.jdt.core.javabuilder'
590 - buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
594 - //defaultOutputDir = sourceSets.main.java.outputDir
595 - configurations.each{ c->
596 - if (c.isCanBeResolved()) {
597 - minusConfigurations += [c]
601 - plusConfigurations = [ ]
605 - def removeTheseToo = []
606 - HashMap<String, Boolean> alreadyAddedSrcPath = new HashMap<>();
607 - cp.entries.each { entry ->
608 - // This conditional removes all src classpathentries that a) have already been added or b) aren't "src" or "test".
609 - // e.g. this removes the resources dir being copied into bin/main, bin/test AND bin/clover
610 - // we add the resources and help/help dirs in as libs afterwards (see below)
611 - if (entry.kind == 'src') {
612 - if (alreadyAddedSrcPath.getAt(entry.path) || !(entry.path == bareSourceDir || entry.path == bareTestSourceDir)) {
613 - removeTheseToo += entry
615 - alreadyAddedSrcPath.putAt(entry.path, true)
620 - cp.entries.removeAll(removeTheseToo)
622 - //cp.entries += new Output("${eclipse_bin_dir}/main")
623 - if (file(helpParentDir).isDirectory()) {
624 - cp.entries += new Library(fileReference(helpParentDir))
626 - if (file(resourceDir).isDirectory()) {
627 - cp.entries += new Library(fileReference(resourceDir))
630 - HashMap<String, Boolean> alreadyAddedLibPath = new HashMap<>();
632 - sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
633 - //don't want to add outputDir as eclipse is using its own output dir in bin/main
634 - if (it.isDirectory() || ! it.exists()) {
635 - // don't add dirs to classpath, especially if they don't exist
636 - return false // groovy "continue" in .any closure
638 - def itPath = it.toString()
639 - if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
640 - // make relative path
641 - itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
643 - if (alreadyAddedLibPath.get(itPath)) {
644 - //println("Not adding duplicate entry "+itPath)
646 - //println("Adding entry "+itPath)
647 - cp.entries += new Library(fileReference(itPath))
648 - alreadyAddedLibPath.put(itPath, true)
652 - sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
653 - //no longer want to add outputDir as eclipse is using its own output dir in bin/main
654 - if (it.isDirectory() || ! it.exists()) {
655 - // don't add dirs to classpath
656 - return false // groovy "continue" in .any closure
659 - def itPath = it.toString()
660 - if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
661 - itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
663 - if (alreadyAddedLibPath.get(itPath)) {
666 - def lib = new Library(fileReference(itPath))
667 - lib.entryAttributes["test"] = "true"
669 - alreadyAddedLibPath.put(itPath, true)
677 - containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
682 - // for the IDE, use java 11 compatibility
683 - sourceCompatibility = compile_source_compatibility
684 - targetCompatibility = compile_target_compatibility
685 - javaRuntimeName = eclipseJavaRuntimeName
687 - // add in jalview project specific properties/preferences into eclipse core preferences
689 - withProperties { props ->
690 - def jalview_prefs = new Properties()
691 - def ins = new FileInputStream("${jalviewDirAbsolutePath}/${eclipse_extra_jdt_prefs_file}")
692 - jalview_prefs.load(ins)
694 - jalview_prefs.forEach { t, v ->
695 - if (props.getAt(t) == null) {
699 - // codestyle file -- overrides previous formatter prefs
700 - def csFile = file("${jalviewDirAbsolutePath}/${eclipse_codestyle_file}")
701 - if (csFile.exists()) {
702 - XmlParser parser = new XmlParser()
703 - def profiles = parser.parse(csFile)
704 - def profile = profiles.'profile'.find { p -> (p.'@kind' == "CodeFormatterProfile" && p.'@name' == "Jalview") }
705 - if (profile != null) {
706 - profile.'setting'.each { s ->
708 - def value = s.'@value'
709 - if (id != null && value != null) {
710 - props.putAt(id, value)
721 - // Don't want these to be activated if in headless build
722 - synchronizationTasks "eclipseSynchronizationTask"
723 - //autoBuildTasks "eclipseAutoBuildTask"
729 -/* hack to change eclipse prefs in .settings files other than org.eclipse.jdt.core.prefs */
730 -// Class to allow updating arbitrary properties files
731 -class PropertiesFile extends PropertiesPersistableConfigurationObject {
732 - public PropertiesFile(PropertiesTransformer t) { super(t); }
733 - @Override protected void load(Properties properties) { }
734 - @Override protected void store(Properties properties) { }
735 - @Override protected String getDefaultResourceName() { return ""; }
736 - // This is necessary, because PropertiesPersistableConfigurationObject fails
737 - // if no default properties file exists.
738 - @Override public void loadDefaults() { load(new StringBufferInputStream("")); }
741 -// Task to update arbitrary properties files (set outputFile)
742 -class PropertiesFileTask extends PropertiesGeneratorTask<PropertiesFile> {
743 - private final PropertiesFileContentMerger file;
744 - public PropertiesFileTask() { file = new PropertiesFileContentMerger(getTransformer()); }
745 - protected PropertiesFile create() { return new PropertiesFile(getTransformer()); }
746 - protected void configure(PropertiesFile props) {
747 - file.getBeforeMerged().execute(props); file.getWhenMerged().execute(props);
749 - public void file(Closure closure) { ConfigureUtil.configure(closure, file); }
752 -task eclipseUIPreferences(type: PropertiesFileTask) {
753 - description = "Generate Eclipse additional settings"
754 - def filename = "org.eclipse.jdt.ui.prefs"
755 - outputFile = "$projectDir/.settings/${filename}" as File
758 - it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
761 + srcDirs testSourceDir
762 + outputDir = file(testClassesDir)
767 -task eclipseGroovyCorePreferences(type: PropertiesFileTask) {
768 - description = "Generate Eclipse additional settings"
769 - def filename = "org.eclipse.jdt.groovy.core.prefs"
770 - outputFile = "$projectDir/.settings/${filename}" as File
773 - it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
775 + srcDirs = sourceSets.main.resources.srcDirs
780 -task eclipseAllPreferences {
781 - dependsOn eclipseJdt
782 - dependsOn eclipseUIPreferences
783 - dependsOn eclipseGroovyCorePreferences
786 -eclipseUIPreferences.mustRunAfter eclipseJdt
787 -eclipseGroovyCorePreferences.mustRunAfter eclipseJdt
789 -/* end of eclipse preferences hack */
797 - delete cloverBuildDir
798 - delete cloverReportDir
803 -task cloverInstrJava(type: JavaExec) {
804 - group = "Verification"
805 - description = "Create clover instrumented source java files"
807 - dependsOn cleanClover
809 - inputs.files(sourceSets.main.allJava)
810 - outputs.dir(cloverInstrDir)
812 - //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
813 - classpath = sourceSets.clover.compileClasspath
814 - main = "com.atlassian.clover.CloverInstr"
822 - cloverInstrDir.getPath(),
824 - def srcFiles = sourceSets.main.allJava.files
827 - { file -> file.absolutePath }
830 - args argsList.toArray()
833 - delete cloverInstrDir
834 - println("Clover: About to instrument "+srcFiles.size() +" files")
839 -task cloverInstrTests(type: JavaExec) {
840 - group = "Verification"
841 - description = "Create clover instrumented source test files"
843 - dependsOn cleanClover
845 - inputs.files(testDir)
846 - outputs.dir(cloverTestInstrDir)
848 - classpath = sourceSets.clover.compileClasspath
849 - main = "com.atlassian.clover.CloverInstr"
859 - cloverTestInstrDir.getPath(),
861 - args argsList.toArray()
864 - delete cloverTestInstrDir
865 - println("Clover: About to instrument test files")
871 - group = "Verification"
872 - description = "Create clover instrumented all source files"
874 - dependsOn cloverInstrJava
875 - dependsOn cloverInstrTests
879 -cloverClasses.dependsOn cloverInstr
882 -task cloverConsoleReport(type: JavaExec) {
883 - group = "Verification"
884 - description = "Creates clover console report"
887 - file(cloverDb).exists()
890 - inputs.dir cloverClassesDir
892 - classpath = sourceSets.clover.runtimeClasspath
893 - main = "com.atlassian.clover.reporters.console.ConsoleReporter"
895 - if (cloverreport_mem.length() > 0) {
896 - maxHeapSize = cloverreport_mem
898 - if (cloverreport_jvmargs.length() > 0) {
899 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
909 - args argsList.toArray()
913 -task cloverHtmlReport(type: JavaExec) {
914 - group = "Verification"
915 - description = "Creates clover HTML report"
918 - file(cloverDb).exists()
921 - def cloverHtmlDir = cloverReportDir
922 - inputs.dir cloverClassesDir
923 - outputs.dir cloverHtmlDir
925 - classpath = sourceSets.clover.runtimeClasspath
926 - main = "com.atlassian.clover.reporters.html.HtmlReporter"
928 - if (cloverreport_mem.length() > 0) {
929 - maxHeapSize = cloverreport_mem
931 - if (cloverreport_jvmargs.length() > 0) {
932 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
943 - if (cloverreport_html_options.length() > 0) {
944 - argsList += cloverreport_html_options.split(" ")
947 - args argsList.toArray()
951 -task cloverXmlReport(type: JavaExec) {
952 - group = "Verification"
953 - description = "Creates clover XML report"
956 - file(cloverDb).exists()
959 - def cloverXmlFile = "${cloverReportDir}/clover.xml"
960 - inputs.dir cloverClassesDir
961 - outputs.file cloverXmlFile
963 - classpath = sourceSets.clover.runtimeClasspath
964 - main = "com.atlassian.clover.reporters.xml.XMLReporter"
966 - if (cloverreport_mem.length() > 0) {
967 - maxHeapSize = cloverreport_mem
969 - if (cloverreport_jvmargs.length() > 0) {
970 - jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
981 - if (cloverreport_xml_options.length() > 0) {
982 - argsList += cloverreport_xml_options.split(" ")
985 - args argsList.toArray()
990 - group = "Verification"
991 - description = "Creates clover reports"
993 - dependsOn cloverXmlReport
994 - dependsOn cloverHtmlReport
999 + compileClasspath = files( sourceSets.test.java.outputDir )
1000 + compileClasspath += sourceSets.main.compileClasspath
1001 + compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["** REMOVE_THIS_GAP /*.jar"])
1004 - sourceCompatibility = compile_source_compatibility
1005 - targetCompatibility = compile_target_compatibility
1006 - options.compilerArgs += additional_compiler_args
1007 - print ("Setting target compatibility to "+targetCompatibility+"\n")
1008 + runtimeClasspath = compileClasspath
1010 - //classpath += configurations.cloverRuntime
1017 - // JBP->BS should the print statement in doFirst refer to compile_target_compatibility ?
1018 sourceCompatibility = compile_source_compatibility
1019 targetCompatibility = compile_target_compatibility
1020 - options.compilerArgs += additional_compiler_args
1021 - options.encoding = "UTF-8"
1022 + options.compilerArgs = additional_compiler_args
1024 print ("Setting target compatibility to "+compile_target_compatibility+"\n")
1031 - sourceCompatibility = compile_source_compatibility
1032 - targetCompatibility = compile_target_compatibility
1033 - options.compilerArgs += additional_compiler_args
1035 + sourceCompatibility = compile_source_compatibility
1036 + targetCompatibility = compile_target_compatibility
1037 + options.compilerArgs = additional_compiler_args
1038 print ("Setting target compatibility to "+targetCompatibility+"\n")
1041 @@ -1091,7 +223,6 @@ clean {
1045 - dependsOn cleanClover
1047 delete sourceSets.test.java.outputDir
1049 @@ -1100,89 +231,11 @@ cleanTest {
1051 // format is a string like date.format("dd MMMM yyyy")
1052 def getDate(format) {
1053 + def date = new Date()
1054 return date.format(format)
1058 -def convertMdToHtml (FileTree mdFiles, File cssFile) {
1059 - MutableDataSet options = new MutableDataSet()
1061 - def extensions = new ArrayList<>()
1062 - extensions.add(AnchorLinkExtension.create())
1063 - extensions.add(AutolinkExtension.create())
1064 - extensions.add(StrikethroughExtension.create())
1065 - extensions.add(TaskListExtension.create())
1066 - extensions.add(TablesExtension.create())
1067 - extensions.add(TocExtension.create())
1069 - options.set(Parser.EXTENSIONS, extensions)
1071 - // set GFM table parsing options
1072 - options.set(TablesExtension.WITH_CAPTION, false)
1073 - options.set(TablesExtension.COLUMN_SPANS, false)
1074 - options.set(TablesExtension.MIN_HEADER_ROWS, 1)
1075 - options.set(TablesExtension.MAX_HEADER_ROWS, 1)
1076 - options.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
1077 - options.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
1078 - options.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
1079 - // GFM anchor links
1080 - options.set(AnchorLinkExtension.ANCHORLINKS_SET_ID, false)
1081 - options.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "anchor")
1082 - options.set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true)
1083 - options.set(AnchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, "<span class=\"octicon octicon-link\"></span>")
1085 - Parser parser = Parser.builder(options).build()
1086 - HtmlRenderer renderer = HtmlRenderer.builder(options).build()
1088 - mdFiles.each { mdFile ->
1089 - // add table of contents
1090 - def mdText = "[TOC]\n"+mdFile.text
1092 - // grab the first top-level title
1094 - def titleRegex = /(?m)^#(\s+|([^#]))(.*)/
1095 - def matcher = mdText =~ titleRegex
1096 - if (matcher.size() > 0) {
1097 - // matcher[0][2] is the first character of the title if there wasn't any whitespace after the #
1098 - title = (matcher[0][2] != null ? matcher[0][2] : "")+matcher[0][3]
1100 - // or use the filename if none found
1101 - if (title == null) {
1102 - title = mdFile.getName()
1105 - Node document = parser.parse(mdText)
1106 - String htmlBody = renderer.render(document)
1107 - def htmlText = '''<html>
1108 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1109 -<html xmlns="http://www.w3.org/1999/xhtml">
1111 - <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1112 - <meta http-equiv="Content-Style-Type" content="text/css" />
1113 - <meta name="generator" content="flexmark" />
1115 - htmlText += ((title != null) ? " <title>${title}</title>" : '' )
1117 - <style type="text/css">code{white-space: pre;}</style>
1119 - htmlText += ((cssFile != null) ? cssFile.text : '')
1120 - htmlText += '''</head>
1123 - htmlText += htmlBody
1129 - def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html")
1130 - def htmlFile = file(htmlFilePath)
1131 - println("Creating ${htmlFilePath}")
1132 - htmlFile.text = htmlText
1137 task copyDocs(type: Copy) {
1138 def inputDir = "${jalviewDir}/${doc_dir}"
1139 def outputDir = "${docBuildDir}/${doc_dir}"
1140 @@ -1213,235 +266,6 @@ task copyDocs(type: Copy) {
1144 -task convertMdFiles {
1145 - dependsOn copyDocs
1146 - def mdFiles = fileTree(dir: docBuildDir, include: "**/*.md")
1147 - def cssFile = file("${jalviewDir}/${flexmark_css}")
1150 - convertMdToHtml(mdFiles, cssFile)
1153 - inputs.files(mdFiles)
1154 - inputs.file(cssFile)
1156 - def htmlFiles = []
1157 - mdFiles.each { mdFile ->
1158 - def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html")
1159 - htmlFiles.add(file(htmlFilePath))
1161 - outputs.files(htmlFiles)
1165 -def hugoTemplateSubstitutions(String input, Map extras=null) {
1166 - def replacements = [
1167 - DATE: getDate("yyyy-MM-dd"),
1168 - CHANNEL: propertiesChannelName,
1169 - APPLICATION_NAME: applicationName,
1170 - GIT_HASH: gitHash,
1171 - GIT_BRANCH: gitBranch,
1172 - VERSION: JALVIEW_VERSION,
1173 - JAVA_VERSION: JAVA_VERSION,
1174 - VERSION_UNDERSCORES: JALVIEW_VERSION_UNDERSCORES,
1178 - def output = input
1179 - if (extras != null) {
1180 - extras.each{ k, v ->
1181 - output = output.replaceAll("__${k}__", ((v == null)?"":v))
1184 - replacements.each{ k, v ->
1185 - output = output.replaceAll("__${k}__", ((v == null)?"":v))
1190 -def mdFileComponents(File mdFile, def dateOnly=false) {
1193 - if (mdFile.exists()) {
1194 - def inFrontMatter = false
1195 - def firstLine = true
1196 - mdFile.eachLine { line ->
1197 - if (line.matches("---")) {
1198 - def prev = inFrontMatter
1199 - inFrontMatter = firstLine
1200 - if (inFrontMatter != prev)
1203 - if (inFrontMatter) {
1205 - if (m = line =~ /^date:\s*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/) {
1206 - map["date"] = new Date().parse("yyyy-MM-dd HH:mm:ss", m[0][1])
1207 - } else if (m = line =~ /^date:\s*(\d{4}-\d{2}-\d{2})/) {
1208 - map["date"] = new Date().parse("yyyy-MM-dd", m[0][1])
1209 - } else if (m = line =~ /^channel:\s*(\S+)/) {
1210 - map["channel"] = m[0][1]
1211 - } else if (m = line =~ /^version:\s*(\S+)/) {
1212 - map["version"] = m[0][1]
1213 - } else if (m = line =~ /^\s*([^:]+)\s*:\s*(\S.*)/) {
1214 - map[ m[0][1] ] = m[0][2]
1216 - if (dateOnly && map["date"] != null) {
1222 - content += line+"\n"
1227 - return dateOnly ? map["date"] : [map, content]
1230 -task hugoTemplates {
1232 - description "Create partially populated md pages for hugo website build"
1234 - def hugoTemplatesDir = file("${jalviewDir}/${hugo_templates_dir}")
1235 - def hugoBuildDir = "${jalviewDir}/${hugo_build_dir}"
1236 - def templateFiles = fileTree(dir: hugoTemplatesDir)
1237 - def releaseMdFile = file("${jalviewDir}/${releases_dir}/release-${JALVIEW_VERSION_UNDERSCORES}.md")
1238 - def whatsnewMdFile = file("${jalviewDir}/${whatsnew_dir}/whatsnew-${JALVIEW_VERSION_UNDERSCORES}.md")
1239 - def oldJvlFile = file("${jalviewDir}/${hugo_old_jvl}")
1240 - def jalviewjsFile = file("${jalviewDir}/${hugo_jalviewjs}")
1243 - // specific release template for version archive
1245 - def whatsnew = null
1246 - def givenDate = null
1247 - def givenChannel = null
1248 - def givenVersion = null
1249 - if (CHANNEL == "RELEASE") {
1250 - def (map, content) = mdFileComponents(releaseMdFile)
1251 - givenDate = map.date
1252 - givenChannel = map.channel
1253 - givenVersion = map.version
1255 - if (givenVersion != null && givenVersion != JALVIEW_VERSION) {
1256 - throw new GradleException("'version' header (${givenVersion}) found in ${releaseMdFile} does not match JALVIEW_VERSION (${JALVIEW_VERSION})")
1259 - if (whatsnewMdFile.exists())
1260 - whatsnew = whatsnewMdFile.text
1263 - def oldJvl = oldJvlFile.exists() ? oldJvlFile.collect{it} : []
1264 - def jalviewjsLink = jalviewjsFile.exists() ? jalviewjsFile.collect{it} : []
1266 - def changesHugo = null
1267 - if (changes != null) {
1268 - changesHugo = '<div class="release_notes">\n\n'
1269 - def inSection = false
1270 - changes.eachLine { line ->
1272 - if (m = line =~ /^##([^#].*)$/) {
1274 - changesHugo += "</div>\n\n"
1276 - def section = m[0][1].trim()
1277 - section = section.toLowerCase()
1278 - section = section.replaceAll(/ +/, "_")
1279 - section = section.replaceAll(/[^a-z0-9_\-]/, "")
1280 - changesHugo += "<div class=\"${section}\">\n\n"
1282 - } else if (m = line =~ /^(\s*-\s*)<!--([^>]+)-->(.*?)(<br\/?>)?\s*$/) {
1283 - def comment = m[0][2].trim()
1284 - if (comment != "") {
1285 - comment = comment.replaceAll('"', """)
1286 - def issuekeys = []
1287 - comment.eachMatch(/JAL-\d+/) { jal -> issuekeys += jal }
1288 - def newline = m[0][1]
1289 - if (comment.trim() != "")
1290 - newline += "{{<comment>}}${comment}{{</comment>}} "
1291 - newline += m[0][3].trim()
1292 - if (issuekeys.size() > 0)
1293 - newline += " {{< jal issue=\"${issuekeys.join(",")}\" alt=\"${comment}\" >}}"
1294 - if (m[0][4] != null)
1295 - newline += m[0][4]
1299 - changesHugo += line+"\n"
1302 - changesHugo += "\n</div>\n\n"
1304 - changesHugo += '</div>'
1307 - templateFiles.each{ templateFile ->
1308 - def newFileName = string(hugoTemplateSubstitutions(templateFile.getName()))
1309 - def relPath = hugoTemplatesDir.toPath().relativize(templateFile.toPath()).getParent()
1310 - def newRelPathName = hugoTemplateSubstitutions( relPath.toString() )
1312 - def outPathName = string("${hugoBuildDir}/$newRelPathName")
1316 - rename(templateFile.getName(), newFileName)
1320 - def newFile = file("${outPathName}/${newFileName}".toString())
1321 - def content = newFile.text
1322 - newFile.text = hugoTemplateSubstitutions(content,
1324 - WHATSNEW: whatsnew,
1325 - CHANGES: changesHugo,
1326 - DATE: givenDate == null ? "" : givenDate.format("yyyy-MM-dd"),
1327 - DRAFT: givenDate == null ? "true" : "false",
1328 - JALVIEWJSLINK: jalviewjsLink.contains(JALVIEW_VERSION) ? "true" : "false",
1329 - JVL_HEADER: oldJvl.contains(JALVIEW_VERSION) ? "jvl: true" : ""
1336 - inputs.file(oldJvlFile)
1337 - inputs.dir(hugoTemplatesDir)
1338 - inputs.property("JALVIEW_VERSION", { JALVIEW_VERSION })
1339 - inputs.property("CHANNEL", { CHANNEL })
1342 -def getMdDate(File mdFile) {
1343 - return mdFileComponents(mdFile, true)
1346 -def getMdSections(String content) {
1347 - def sections = [:]
1348 - def sectionContent = ""
1349 - def sectionName = null
1350 - content.eachLine { line ->
1352 - if (m = line =~ /^##([^#].*)$/) {
1353 - if (sectionName != null) {
1354 - sections[sectionName] = sectionContent
1355 - sectionName = null
1356 - sectionContent = ""
1358 - sectionName = m[0][1].trim()
1359 - sectionName = sectionName.toLowerCase()
1360 - sectionName = sectionName.replaceAll(/ +/, "_")
1361 - sectionName = sectionName.replaceAll(/[^a-z0-9_\-]/, "")
1362 - } else if (sectionName != null) {
1363 - sectionContent += line+"\n"
1366 - if (sectionContent != null) {
1367 - sections[sectionName] = sectionContent
1373 task copyHelp(type: Copy) {
1374 def inputDir = helpSourceDir
1375 def outputDir = "${helpBuildDir}/${help_dir}"
1376 @@ -1476,7 +300,6 @@ task copyHelp(type: Copy) {
1377 outputs.dir(outputDir)
1381 task releasesTemplates {
1383 description "Recreate whatsNew.html and releases.html from markdown files and templates in help"
1384 @@ -1491,6 +314,7 @@ task releasesTemplates {
1385 def whatsnewMdDir = "${jalviewDir}/${whatsnew_dir}"
1388 + def JALVIEW_VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
1389 def releaseMdFile = file("${releasesMdDir}/release-${JALVIEW_VERSION_UNDERSCORES}.md")
1390 def whatsnewMdFile = file("${whatsnewMdDir}/whatsnew-${JALVIEW_VERSION_UNDERSCORES}.md")
1392 @@ -1505,7 +329,7 @@ task releasesTemplates {
1394 def releaseFiles = fileTree(dir: releasesMdDir, include: "release-*.md")
1395 def releaseFilesDates = releaseFiles.collectEntries {
1396 - [(it): getMdDate(it)]
1397 + [(it): getDate("")]
1399 releaseFiles = releaseFiles.sort { a,b -> releaseFilesDates[a].compareTo(releaseFilesDates[b]) }
1401 @@ -1513,96 +337,13 @@ task releasesTemplates {
1402 def m = releasesTemplate =~ /(?s)__VERSION_LOOP_START__(.*)__VERSION_LOOP_END__/
1403 def versionTemplate = m[0][1]
1405 - MutableDataSet options = new MutableDataSet()
1407 - def extensions = new ArrayList<>()
1408 - options.set(Parser.EXTENSIONS, extensions)
1409 - options.set(Parser.HTML_BLOCK_COMMENT_ONLY_FULL_LINE, true)
1411 - Parser parser = Parser.builder(options).build()
1412 - HtmlRenderer renderer = HtmlRenderer.builder(options).build()
1414 - def actualVersions = releaseFiles.collect { rf ->
1415 - def (rfMap, rfContent) = mdFileComponents(rf)
1416 - return rfMap.version
1418 def versionsHtml = ""
1419 def linkedVersions = []
1420 - releaseFiles.reverse().each { rFile ->
1421 - def (rMap, rContent) = mdFileComponents(rFile)
1423 - def versionLink = ""
1424 - def partialVersion = ""
1425 - def firstPart = true
1426 - rMap.version.split("\\.").each { part ->
1427 - def displayPart = ( firstPart ? "" : "." ) + part
1428 - partialVersion += displayPart
1430 - linkedVersions.contains(partialVersion)
1431 - || ( actualVersions.contains(partialVersion) && partialVersion != rMap.version )
1433 - versionLink += displayPart
1435 - versionLink += "<a id=\"Jalview.${partialVersion}\">${displayPart}</a>"
1436 - linkedVersions += partialVersion
1440 - def displayDate = releaseFilesDates[rFile].format("dd/MM/yyyy")
1443 - def rContentProcessed = ""
1444 - rContent.eachLine { line ->
1445 - if (lm = line =~ /^(\s*-)(\s*<!--[^>]*?-->)(.*)$/) {
1446 - line = "${lm[0][1]}${lm[0][3]}${lm[0][2]}"
1447 - } else if (lm = line =~ /^###([^#]+.*)$/) {
1448 - line = "_${lm[0][1].trim()}_"
1450 - rContentProcessed += line + "\n"
1453 - def rContentSections = getMdSections(rContentProcessed)
1454 - def rVersion = versionTemplate
1455 - if (rVersion != "") {
1456 - def rNewFeatures = rContentSections["new_features"]
1457 - def rIssuesResolved = rContentSections["issues_resolved"]
1458 - Node newFeaturesNode = parser.parse(rNewFeatures)
1459 - String newFeaturesHtml = renderer.render(newFeaturesNode)
1460 - Node issuesResolvedNode = parser.parse(rIssuesResolved)
1461 - String issuesResolvedHtml = renderer.render(issuesResolvedNode)
1462 - rVersion = hugoTemplateSubstitutions(rVersion,
1464 - VERSION: rMap.version,
1465 - VERSION_LINK: versionLink,
1466 - DISPLAY_DATE: displayDate,
1467 - NEW_FEATURES: newFeaturesHtml,
1468 - ISSUES_RESOLVED: issuesResolvedHtml
1471 - versionsHtml += rVersion
1475 releasesTemplate = releasesTemplate.replaceAll("(?s)__VERSION_LOOP_START__.*__VERSION_LOOP_END__", versionsHtml)
1476 - releasesTemplate = hugoTemplateSubstitutions(releasesTemplate)
1477 releasesHtmlFile.text = releasesTemplate
1479 - if (whatsnewMdFile.exists()) {
1480 - def wnDisplayDate = releaseFilesDates[releaseMdFile] != null ? releaseFilesDates[releaseMdFile].format("dd MMMM yyyy") : ""
1481 - def whatsnewMd = hugoTemplateSubstitutions(whatsnewMdFile.text)
1482 - Node whatsnewNode = parser.parse(whatsnewMd)
1483 - String whatsnewHtml = renderer.render(whatsnewNode)
1484 - whatsnewHtml = whatsnewTemplateFile.text.replaceAll("__WHATS_NEW__", whatsnewHtml)
1485 - whatsnewHtmlFile.text = hugoTemplateSubstitutions(whatsnewHtml,
1487 - VERSION: JALVIEW_VERSION,
1488 - DISPLAY_DATE: wnDisplayDate
1491 - } else if (gradle.taskGraph.hasTask(":linkCheck")) {
1492 - whatsnewHtmlFile.text = "Development build " + getDate("yyyy-MM-dd HH:mm:ss")
1495 + whatsnewHtmlFile.text = "Debian build " + getDate("yyyy-MM-dd HH:mm:ss")
1498 inputs.file(releasesTemplateFile)
1499 @@ -1613,7 +354,6 @@ task releasesTemplates {
1500 outputs.file(whatsnewHtmlFile)
1504 task copyResources(type: Copy) {
1506 description = "Copy (and make text substitutions in) the resources dir to the build area"
1507 @@ -1653,44 +393,22 @@ task copyChannelResources(type: Copy) {
1509 def inputDir = "${channelDir}/${resource_dir}"
1510 def outputDir = resourcesBuildDir
1512 - include(channel_props)
1513 - filter(ReplaceTokens,
1517 - 'SUFFIX': channelSuffix
1522 - exclude(channel_props)
1527 inputs.dir(inputDir)
1528 outputs.dir(outputDir)
1531 -task createBuildProperties(type: WriteProperties) {
1532 - dependsOn copyResources
1534 - description = "Create the ${buildProperties} file"
1536 - inputs.dir(sourceDir)
1537 - inputs.dir(resourcesBuildDir)
1538 - outputFile (buildProperties)
1539 - // taking time specific comment out to allow better incremental builds
1540 - comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
1541 - //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
1542 - property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
1543 - property "VERSION", JALVIEW_VERSION
1544 - property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
1545 - property "JAVA_COMPILE_VERSION", JAVA_INTEGER_VERSION
1546 - if (getdownSetAppBaseProperty) {
1547 - property "GETDOWNAPPBASE", getdownAppBase
1548 - property "GETDOWNAPPDISTDIR", getdownAppDistDir
1550 +task createBuildProperties(type: Copy) {
1551 + // using the build_properties already included in the source tarball
1552 + def inputFile = "build_properties"
1553 + def outputFile = buildProperties
1555 + into file(outputFile).getParent()
1556 + rename(file(inputFile).getName(), file(outputFile).getName())
1558 + inputs.file(inputFile)
1559 outputs.file(outputFile)
1562 @@ -1725,123 +443,31 @@ task prepare {
1565 dependsOn releasesTemplates
1566 - dependsOn convertMdFiles
1567 dependsOn buildIndices
1571 compileJava.dependsOn prepare
1572 run.dependsOn compileJava
1573 -compileTestJava.dependsOn compileJava
1575 +//run.dependsOn prepare
1578 +//testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
1580 - group = "Verification"
1581 - description = "Runs all testTaskN tasks)"
1584 - dependsOn cloverClasses
1586 - dependsOn testClasses
1589 - // not running tests in this task
1592 -/* testTask0 is the main test task */
1593 -task testTask0(type: Test) {
1594 - group = "Verification"
1595 - description = "The main test task. Runs all non-testTaskN-labelled tests (unless excluded)"
1597 - includeGroups testng_groups.split(",")
1598 - excludeGroups testng_excluded_groups.split(",")
1599 - tasks.withType(Test).matching {it.name.startsWith("testTask") && it.name != name}.all {t -> excludeGroups t.name}
1600 - preserveOrder true
1601 - useDefaultListeners=true
1605 -/* separated tests */
1606 -task testTask1(type: Test) {
1607 - group = "Verification"
1608 - description = "Tests that need to be isolated from the main test run"
1610 - includeGroups name
1611 - excludeGroups testng_excluded_groups.split(",")
1612 - preserveOrder true
1613 - useDefaultListeners=true
1617 + dependsOn compileJava //?
1619 -/* insert more testTaskNs here -- change N to next digit or other string */
1621 -task testTaskN(type: Test) {
1622 - group = "Verification"
1623 - description = "Tests that need to be isolated from the main test run"
1625 - includeGroups name
1626 - excludeGroups testng_excluded_groups.split(",")
1627 + includeGroups testng_groups
1628 + excludeGroups testng_excluded_groups
1630 useDefaultListeners=true
1636 - * adapted from https://medium.com/@wasyl/pretty-tests-summary-in-gradle-744804dd676c
1637 - * to summarise test results from all Test tasks
1639 -/* START of test tasks results summary */
1640 -import groovy.time.TimeCategory
1641 -import org.gradle.api.tasks.testing.logging.TestExceptionFormat
1642 -import org.gradle.api.tasks.testing.logging.TestLogEvent
1643 -rootProject.ext.testsResults = [] // Container for tests summaries
1645 -tasks.withType(Test).matching {t -> t.getName().startsWith("testTask")}.all { testTask ->
1647 - // from original test task
1649 - dependsOn cloverClasses
1651 - dependsOn testClasses //?
1654 - // run main tests first
1655 - if (!testTask.name.equals("testTask0"))
1656 - testTask.mustRunAfter "testTask0"
1658 - testTask.testLogging { logging ->
1659 - events TestLogEvent.FAILED
1660 -// TestLogEvent.SKIPPED,
1661 -// TestLogEvent.STANDARD_OUT,
1662 -// TestLogEvent.STANDARD_ERROR
1664 - exceptionFormat TestExceptionFormat.FULL
1665 - showExceptions true
1667 - showStackTraces true
1669 - info.events = [ TestLogEvent.FAILED ]
1674 - ignoreFailures = true // Always try to run all tests for all modules
1676 - afterSuite { desc, result ->
1678 - return // Only summarize results for whole modules
1680 - def resultsInfo = [testTask.project.name, testTask.name, result, TimeCategory.minus(new Date(result.endTime), new Date(result.startTime)), testTask.reports.html.entryPoint]
1682 - rootProject.ext.testsResults.add(resultsInfo)
1685 - // from original test task
1686 maxHeapSize = "1024m"
1688 workingDir = jalviewDir
1689 + //systemProperties 'clover.jar' System.properties.clover.jar
1690 def testLaf = project.findProperty("test_laf")
1691 if (testLaf != null) {
1692 println("Setting Test LaF to '${testLaf}'")
1693 @@ -1857,143 +483,8 @@ tasks.withType(Test).matching {t -> t.getName().startsWith("testTask")}.all { te
1694 jvmArgs += additional_compiler_args
1697 - // this is not perfect yet -- we should only add the commandLineIncludePatterns to the
1698 - // testTasks that include the tests, and exclude all from the others.
1699 - // get --test argument
1700 - filter.commandLineIncludePatterns = test.filter.commandLineIncludePatterns
1701 - // do something with testTask.getCandidateClassFiles() to see if the test should silently finish because of the
1702 - // commandLineIncludePatterns not matching anything. Instead we are doing setFailOnNoMatchingTests(false) below
1706 - println("Running tests " + (useClover?"WITH":"WITHOUT") + " clover")
1711 - /* don't fail on no matching tests (so --tests will run across all testTasks) */
1712 - testTask.filter.setFailOnNoMatchingTests(false)
1714 - /* ensure the "test" task dependsOn all the testTasks */
1715 - test.dependsOn testTask
1718 -gradle.buildFinished {
1719 - def allResults = rootProject.ext.testsResults
1721 - if (!allResults.isEmpty()) {
1722 - printResults allResults
1723 - allResults.each {r ->
1724 - if (r[2].resultType == TestResult.ResultType.FAILURE)
1725 - throw new GradleException("Failed tests!")
1730 -private static String colString(styler, col, colour, text) {
1731 - return col?"${styler[colour](text)}":text
1734 -private static String getSummaryLine(s, pn, tn, rt, rc, rs, rf, rsk, t, col) {
1735 - def colour = 'black'
1743 - case TestResult.ResultType.SUCCESS:
1746 - case TestResult.ResultType.FAILURE:
1754 - StringBuilder sb = new StringBuilder()
1755 - sb.append("${pn}")
1757 - sb.append(":${tn}")
1758 - sb.append(" results: ")
1759 - sb.append(colString(s, col && !nocol, colour, text))
1761 - sb.append("${rc} tests, ")
1762 - sb.append(colString(s, col && rs > 0, 'green', rs))
1763 - sb.append(" successes, ")
1764 - sb.append(colString(s, col && rf > 0, 'red', rf))
1765 - sb.append(" failures, ")
1766 - sb.append("${rsk} skipped) in ${t}")
1767 - return sb.toString()
1770 -private static void printResults(allResults) {
1772 - // styler from https://stackoverflow.com/a/56139852
1773 - def styler = 'black red green yellow blue magenta cyan white'.split().toList().withIndex(30).collectEntries { key, val -> [(key) : { "\033[${val}m${it}\033[0m" }] }
1776 - def failedTests = false
1777 - def summaryLines = []
1778 - def totalcount = 0
1779 - def totalsuccess = 0
1782 - def totaltime = TimeCategory.getSeconds(0)
1783 - // sort on project name then task name
1784 - allResults.sort {a, b -> a[0] == b[0]? a[1]<=>b[1]:a[0] <=> b[0]}.each {
1785 - def projectName = it[0]
1786 - def taskName = it[1]
1787 - def result = it[2]
1789 - def report = it[4]
1790 - def summaryCol = getSummaryLine(styler, projectName, taskName, result.resultType, result.testCount, result.successfulTestCount, result.failedTestCount, result.skippedTestCount, time, true)
1791 - def summaryPlain = getSummaryLine(styler, projectName, taskName, result.resultType, result.testCount, result.successfulTestCount, result.failedTestCount, result.skippedTestCount, time, false)
1792 - def reportLine = "Report file: ${report}"
1793 - def ls = summaryPlain.length()
1794 - def lr = reportLine.length()
1795 - def m = [ls, lr].max()
1796 - if (m > maxLength)
1798 - def info = [ls, summaryCol, reportLine]
1799 - summaryLines.add(info)
1800 - failedTests |= result.resultType == TestResult.ResultType.FAILURE
1801 - totalcount += result.testCount
1802 - totalsuccess += result.successfulTestCount
1803 - totalfail += result.failedTestCount
1804 - totalskip += result.skippedTestCount
1807 - def totalSummaryCol = getSummaryLine(styler, "OVERALL", "", failedTests?TestResult.ResultType.FAILURE:TestResult.ResultType.SUCCESS, totalcount, totalsuccess, totalfail, totalskip, totaltime, true)
1808 - def totalSummaryPlain = getSummaryLine(styler, "OVERALL", "", failedTests?TestResult.ResultType.FAILURE:TestResult.ResultType.SUCCESS, totalcount, totalsuccess, totalfail, totalskip, totaltime, false)
1809 - def tls = totalSummaryPlain.length()
1810 - if (tls > maxLength)
1812 - def info = [tls, totalSummaryCol, null]
1813 - summaryLines.add(info)
1815 - def allSummaries = []
1816 - for(sInfo : summaryLines) {
1818 - def summary = sInfo[1]
1819 - def report = sInfo[2]
1821 - StringBuilder sb = new StringBuilder()
1822 - sb.append("│" + summary + " " * (maxLength - ls) + "│")
1823 - if (report != null) {
1824 - sb.append("\n│" + report + " " * (maxLength - report.length()) + "│")
1826 - allSummaries += sb.toString()
1829 - println "┌${"${"─" * maxLength}"}┐"
1830 - println allSummaries.join("\n├${"${"─" * maxLength}"}┤\n")
1831 - println "└${"${"─" * maxLength}"}┘"
1833 -/* END of test tasks results summary */
1836 task compileLinkCheck(type: JavaCompile) {
1837 @@ -2052,7 +543,7 @@ jar {
1839 attributes "Main-Class": main_class,
1840 "Permissions": "all-permissions",
1841 - "Application-Name": applicationName,
1842 + "Application-Name": install4jApplicationName,
1843 "Codebase": application_codebase,
1844 "Implementation-Version": JALVIEW_VERSION
1846 @@ -2060,8 +551,6 @@ jar {
1847 def outputDir = "${jalviewDir}/${package_dir}"
1848 destinationDirectory = file(outputDir)
1849 archiveFileName = rootProject.name+".jar"
1850 - duplicatesStrategy "EXCLUDE"
1855 @@ -2073,2137 +562,7 @@ jar {
1856 sourceSets.main.resources.srcDirs.each{ dir ->
1859 - outputs.file("${outputDir}/${archiveFileName}")
1863 -task copyJars(type: Copy) {
1864 - from fileTree(dir: classesDir, include: "**/*.jar").files
1865 - into "${jalviewDir}/${package_dir}"
1869 -// doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
1870 -task syncJars(type: Sync) {
1872 - from fileTree(dir: "${jalviewDir}/${libDistDir}", include: "**/*.jar").files
1873 - into "${jalviewDir}/${package_dir}"
1875 - include jar.archiveFileName.getOrNull()
1882 - description = "Put all required libraries in dist"
1883 - // order of "cleanPackageDir", "copyJars", "jar" important!
1884 - jar.mustRunAfter cleanPackageDir
1885 - syncJars.mustRunAfter cleanPackageDir
1886 - dependsOn cleanPackageDir
1887 - dependsOn syncJars
1889 - outputs.dir("${jalviewDir}/${package_dir}")
1894 - dependsOn cleanPackageDir
1895 - dependsOn cleanTest
1901 - group = "distribution"
1902 - description = "Create a single jar file with all dependency libraries merged. Can be run with java -jar"
1904 - dependsOn makeDist
1906 - from ("${jalviewDir}/${libDistDir}") {
1910 - attributes "Implementation-Version": JALVIEW_VERSION,
1911 - "Application-Name": applicationName
1914 - duplicatesStrategy "INCLUDE"
1916 - mainClassName = shadow_jar_main_class
1917 - mergeServiceFiles()
1918 - classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
1922 -task getdownImagesCopy() {
1923 - inputs.dir getdownImagesDir
1924 - outputs.dir getdownImagesBuildDir
1928 - from(getdownImagesDir) {
1929 - include("*getdown*.png")
1931 - into getdownImagesBuildDir
1936 -task getdownImagesProcess() {
1937 - dependsOn getdownImagesCopy
1940 - if (backgroundImageText) {
1941 - if (convertBinary == null) {
1942 - throw new StopExecutionException("No ImageMagick convert binary installed at '${convertBinaryExpectedLocation}'")
1944 - if (!project.hasProperty("getdown_background_image_text_suffix_cmd")) {
1945 - throw new StopExecutionException("No property 'getdown_background_image_text_suffix_cmd' defined. See channel_gradle.properties for channel ${CHANNEL}")
1947 - fileTree(dir: getdownImagesBuildDir, include: "*background*.png").getFiles().each { file ->
1949 - executable convertBinary
1952 - '-font', getdown_background_image_text_font,
1953 - '-fill', getdown_background_image_text_colour,
1954 - '-draw', sprintf(getdown_background_image_text_suffix_cmd, channelSuffix),
1955 - '-draw', sprintf(getdown_background_image_text_commit_cmd, "git-commit: ${gitHash}"),
1956 - '-draw', sprintf(getdown_background_image_text_date_cmd, getDate("yyyy-MM-dd HH:mm:ss")),
1965 -task getdownImages() {
1966 - dependsOn getdownImagesProcess
1969 -task getdownWebsite() {
1970 - group = "distribution"
1971 - description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
1973 - dependsOn getdownImages
1975 - dependsOn makeDist
1978 - def getdownWebsiteResourceFilenames = []
1979 - def getdownResourceDir = getdownResourceDir
1980 - def getdownResourceFilenames = []
1983 - // clean the getdown website and files dir before creating getdown folders
1984 - delete getdownAppBaseDir
1985 - delete getdownFilesDir
1988 - from buildProperties
1989 - rename(file(buildProperties).getName(), getdown_build_properties)
1990 - into getdownAppDir
1992 - getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
1995 - from channelPropsFile
1996 - filter(ReplaceTokens,
2000 - 'SUFFIX': channelSuffix
2003 - into getdownAppBaseDir
2005 - getdownWebsiteResourceFilenames += file(channelPropsFile).getName()
2007 - // set some getdownTxt_ properties then go through all properties looking for getdownTxt_...
2008 - def props = project.properties.sort { it.key }
2009 - if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) {
2010 - props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion)
2012 - if (getdownAltJavaMaxVersion != null && getdownAltJavaMaxVersion.length() > 0) {
2013 - props.put("getdown_txt_java_max_version", getdownAltJavaMaxVersion)
2015 - if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
2016 - props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
2018 - if (getdownImagesBuildDir != null && file(getdownImagesBuildDir).exists()) {
2019 - props.put("getdown_txt_ui.background_image", "${getdownImagesBuildDir}/${getdown_background_image}")
2020 - props.put("getdown_txt_ui.instant_background_image", "${getdownImagesBuildDir}/${getdown_instant_background_image}")
2021 - props.put("getdown_txt_ui.error_background", "${getdownImagesBuildDir}/${getdown_error_background}")
2022 - props.put("getdown_txt_ui.progress_image", "${getdownImagesBuildDir}/${getdown_progress_image}")
2023 - props.put("getdown_txt_ui.icon", "${getdownImagesDir}/${getdown_icon}")
2024 - props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesDir}/${getdown_mac_dock_icon}")
2027 - props.put("getdown_txt_title", jalview_name)
2028 - props.put("getdown_txt_ui.name", applicationName)
2030 - // start with appbase
2031 - getdownTextLines += "appbase = ${getdownAppBase}"
2032 - props.each{ prop, val ->
2033 - if (prop.startsWith("getdown_txt_") && val != null) {
2034 - if (prop.startsWith("getdown_txt_multi_")) {
2035 - def key = prop.substring(18)
2036 - val.split(",").each{ v ->
2037 - def line = "${key} = ${v}"
2038 - getdownTextLines += line
2041 - // file values rationalised
2042 - if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
2044 - if (val.indexOf('/') == 0) {
2047 - } else if (val.indexOf('/') > 0) {
2048 - // relative path (relative to jalviewDir)
2049 - r = file( "${jalviewDir}/${val}" )
2052 - val = "${getdown_resource_dir}/" + r.getName()
2053 - getdownWebsiteResourceFilenames += val
2054 - getdownResourceFilenames += r.getPath()
2057 - if (! prop.startsWith("getdown_txt_resource")) {
2058 - def line = prop.substring(12) + " = ${val}"
2059 - getdownTextLines += line
2065 - getdownWebsiteResourceFilenames.each{ filename ->
2066 - getdownTextLines += "resource = ${filename}"
2068 - getdownResourceFilenames.each{ filename ->
2071 - into getdownResourceDir
2075 - def getdownWrapperScripts = [ getdown_bash_wrapper_script, getdown_powershell_wrapper_script, getdown_batch_wrapper_script ]
2076 - getdownWrapperScripts.each{ script ->
2077 - def s = file( "${jalviewDir}/utils/getdown/${getdown_wrapper_script_dir}/${script}" )
2081 - into "${getdownAppBaseDir}/${getdown_wrapper_script_dir}"
2083 - getdownTextLines += "resource = ${getdown_wrapper_script_dir}/${script}"
2087 - def codeFiles = []
2088 - fileTree(file(package_dir)).each{ f ->
2089 - if (f.isDirectory()) {
2090 - def files = fileTree(dir: f, include: ["*"]).getFiles()
2091 - codeFiles += files
2092 - } else if (f.exists()) {
2096 - def jalviewJar = jar.archiveFileName.getOrNull()
2097 - // put jalview.jar first for CLASSPATH and .properties files reasons
2098 - codeFiles.sort{a, b -> ( a.getName() == jalviewJar ? -1 : ( b.getName() == jalviewJar ? 1 : a <=> b ) ) }.each{f ->
2099 - def name = f.getName()
2100 - def line = "code = ${getdownAppDistDir}/${name}"
2101 - getdownTextLines += line
2104 - into getdownAppDir
2108 - // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
2110 - if (JAVA_VERSION.equals("11")) {
2111 - def j11libFiles = fileTree(dir: "${jalviewDir}/${j11libDir}", include: ["*.jar"]).getFiles()
2112 - j11libFiles.sort().each{f ->
2113 - def name = f.getName()
2114 - def line = "code = ${getdown_j11lib_dir}/${name}"
2115 - getdownTextLines += line
2118 - into getdownJ11libDir
2124 - // 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.
2125 - //getdownTextLines += "class = " + file(getdownLauncher).getName()
2126 - getdownTextLines += "resource = ${getdown_launcher_new}"
2127 - getdownTextLines += "class = ${main_class}"
2128 - // Not setting these properties in general so that getdownappbase and getdowndistdir will default to release version in jalview.bin.Cache
2129 - if (getdownSetAppBaseProperty) {
2130 - getdownTextLines += "jvmarg = -Dgetdowndistdir=${getdownAppDistDir}"
2131 - getdownTextLines += "jvmarg = -Dgetdownappbase=${getdownAppBase}"
2134 - def getdownTxt = file("${getdownAppBaseDir}/getdown.txt")
2135 - getdownTxt.write(getdownTextLines.join("\n"))
2137 - getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl"
2138 - def launchJvl = file("${getdownAppBaseDir}/${getdownLaunchJvl}")
2139 - launchJvl.write("appbase=${getdownAppBase}")
2141 - // files going into the getdown website dir: getdown-launcher.jar
2143 - from getdownLauncher
2144 - rename(file(getdownLauncher).getName(), getdown_launcher_new)
2145 - into getdownAppBaseDir
2148 - // files going into the getdown website dir: getdown-launcher(-local).jar
2150 - from getdownLauncher
2151 - if (file(getdownLauncher).getName() != getdown_launcher) {
2152 - rename(file(getdownLauncher).getName(), getdown_launcher)
2154 - into getdownAppBaseDir
2157 - // files going into the getdown website dir: ./install dir and files
2158 - if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
2161 - from getdownLauncher
2162 - from "${getdownAppDir}/${getdown_build_properties}"
2163 - if (file(getdownLauncher).getName() != getdown_launcher) {
2164 - rename(file(getdownLauncher).getName(), getdown_launcher)
2166 - into getdownInstallDir
2169 - // and make a copy in the getdown files dir (these are not downloaded by getdown)
2171 - from getdownInstallDir
2172 - into getdownFilesInstallDir
2176 - // files going into the getdown files dir: getdown.txt, getdown-launcher.jar, channel-launch.jvl, build_properties
2180 - from getdownLauncher
2181 - from "${getdownAppBaseDir}/${getdown_build_properties}"
2182 - from "${getdownAppBaseDir}/${channel_props}"
2183 - if (file(getdownLauncher).getName() != getdown_launcher) {
2184 - rename(file(getdownLauncher).getName(), getdown_launcher)
2186 - into getdownFilesDir
2189 - // and ./resource (not all downloaded by getdown)
2191 - from getdownResourceDir
2192 - into "${getdownFilesDir}/${getdown_resource_dir}"
2197 - inputs.dir("${jalviewDir}/${package_dir}")
2199 - outputs.dir(getdownAppBaseDir)
2200 - outputs.dir(getdownFilesDir)
2204 -// a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
2205 -task getdownDigestDir(type: JavaExec) {
2207 - description "A task to run a getdown Digest on a dir with getdown.txt. Provide a DIGESTDIR property via -PDIGESTDIR=..."
2209 - def digestDirPropertyName = "DIGESTDIR"
2211 - classpath = files(getdownLauncher)
2212 - def digestDir = findProperty(digestDirPropertyName)
2213 - if (digestDir == null) {
2214 - throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
2218 - main = "com.threerings.getdown.tools.Digester"
2222 -task getdownDigest(type: JavaExec) {
2223 - group = "distribution"
2224 - description = "Digest the getdown website folder"
2225 - dependsOn getdownWebsite
2227 - classpath = files(getdownLauncher)
2229 - main = "com.threerings.getdown.tools.Digester"
2230 - args getdownAppBaseDir
2231 - inputs.dir(getdownAppBaseDir)
2232 - outputs.file("${getdownAppBaseDir}/digest2.txt")
2237 - group = "distribution"
2238 - description = "Create the minimal and full getdown app folder for installers and website and create digest file"
2239 - dependsOn getdownDigest
2241 - if (reportRsyncCommand) {
2242 - def fromDir = getdownAppBaseDir + (getdownAppBaseDir.endsWith('/')?'':'/')
2243 - def toDir = "${getdown_rsync_dest}/${getdownDir}" + (getdownDir.endsWith('/')?'':'/')
2244 - println "LIKELY RSYNC COMMAND:"
2245 - println "mkdir -p '$toDir'\nrsync -avh --delete '$fromDir' '$toDir'"
2246 - if (RUNRSYNC == "true") {
2248 - commandLine "mkdir", "-p", toDir
2251 - commandLine "rsync", "-avh", "--delete", fromDir, toDir
2259 -task getdownArchiveBuild() {
2260 - group = "distribution"
2261 - description = "Put files in the archive dir to go on the website"
2263 - dependsOn getdownWebsite
2265 - def v = "v${JALVIEW_VERSION_UNDERSCORES}"
2266 - def vDir = "${getdownArchiveDir}/${v}"
2267 - getdownFullArchiveDir = "${vDir}/getdown"
2268 - getdownVersionLaunchJvl = "${vDir}/jalview-${v}.jvl"
2270 - def vAltDir = "alt_${v}"
2271 - def archiveImagesDir = "${jalviewDir}/${channel_properties_dir}/old/images"
2274 - // cleanup old "old" dir
2275 - delete getdownArchiveDir
2277 - def getdownArchiveTxt = file("${getdownFullArchiveDir}/getdown.txt")
2278 - getdownArchiveTxt.getParentFile().mkdirs()
2279 - def getdownArchiveTextLines = []
2280 - def getdownFullArchiveAppBase = "${getdownArchiveAppBase}${getdownArchiveAppBase.endsWith("/")?"":"/"}${v}/getdown/"
2284 - from "${getdownAppBaseDir}/${getdownAppDistDir}"
2285 - into "${getdownFullArchiveDir}/${vAltDir}"
2288 - getdownTextLines.each { line ->
2289 - line = line.replaceAll("^(?<s>appbase\\s*=\\s*).*", '${s}'+getdownFullArchiveAppBase)
2290 - line = line.replaceAll("^(?<s>(resource|code)\\s*=\\s*)${getdownAppDistDir}/", '${s}'+vAltDir+"/")
2291 - line = line.replaceAll("^(?<s>ui.background_image\\s*=\\s*).*\\.png", '${s}'+"${getdown_resource_dir}/jalview_archive_getdown_background.png")
2292 - line = line.replaceAll("^(?<s>ui.instant_background_image\\s*=\\s*).*\\.png", '${s}'+"${getdown_resource_dir}/jalview_archive_getdown_background_initialising.png")
2293 - line = line.replaceAll("^(?<s>ui.error_background\\s*=\\s*).*\\.png", '${s}'+"${getdown_resource_dir}/jalview_archive_getdown_background_error.png")
2294 - line = line.replaceAll("^(?<s>ui.progress_image\\s*=\\s*).*\\.png", '${s}'+"${getdown_resource_dir}/jalview_archive_getdown_progress_bar.png")
2295 - // remove the existing resource = resource/ or bin/ lines
2296 - if (! line.matches("resource\\s*=\\s*(resource|bin)/.*")) {
2297 - getdownArchiveTextLines += line
2301 - // the resource dir -- add these files as resource lines in getdown.txt
2303 - from "${archiveImagesDir}"
2304 - into "${getdownFullArchiveDir}/${getdown_resource_dir}"
2305 - eachFile { file ->
2306 - getdownArchiveTextLines += "resource = ${getdown_resource_dir}/${file.getName()}"
2310 - getdownArchiveTxt.write(getdownArchiveTextLines.join("\n"))
2312 - def vLaunchJvl = file(getdownVersionLaunchJvl)
2313 - vLaunchJvl.getParentFile().mkdirs()
2314 - vLaunchJvl.write("appbase=${getdownFullArchiveAppBase}\n")
2315 - def vLaunchJvlPath = vLaunchJvl.toPath().toAbsolutePath()
2316 - def jvlLinkPath = file("${vDir}/jalview.jvl").toPath().toAbsolutePath()
2317 - // for some reason filepath.relativize(fileInSameDirPath) gives a path to "../" which is wrong
2318 - //java.nio.file.Files.createSymbolicLink(jvlLinkPath, jvlLinkPath.relativize(vLaunchJvlPath));
2319 - java.nio.file.Files.createSymbolicLink(jvlLinkPath, java.nio.file.Paths.get(".",vLaunchJvl.getName()));
2321 - // files going into the getdown files dir: getdown.txt, getdown-launcher.jar, channel-launch.jvl, build_properties
2323 - from getdownLauncher
2324 - from "${getdownAppBaseDir}/${getdownLaunchJvl}"
2325 - from "${getdownAppBaseDir}/${getdown_launcher_new}"
2326 - from "${getdownAppBaseDir}/${channel_props}"
2327 - if (file(getdownLauncher).getName() != getdown_launcher) {
2328 - rename(file(getdownLauncher).getName(), getdown_launcher)
2330 - into getdownFullArchiveDir
2336 -task getdownArchiveDigest(type: JavaExec) {
2337 - group = "distribution"
2338 - description = "Digest the getdown archive folder"
2340 - dependsOn getdownArchiveBuild
2343 - classpath = files(getdownLauncher)
2344 - args getdownFullArchiveDir
2346 - main = "com.threerings.getdown.tools.Digester"
2347 - inputs.dir(getdownFullArchiveDir)
2348 - outputs.file("${getdownFullArchiveDir}/digest2.txt")
2351 -task getdownArchive() {
2352 - group = "distribution"
2353 - description = "Build the website archive dir with getdown digest"
2355 - dependsOn getdownArchiveBuild
2356 - dependsOn getdownArchiveDigest
2359 -tasks.withType(JavaCompile) {
2360 - options.encoding = 'UTF-8'
2366 - delete getdownAppBaseDir
2367 - delete getdownFilesDir
2368 - delete getdownArchiveDir
2374 - if (file(install4jHomeDir).exists()) {
2376 - } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
2377 - install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
2378 - } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
2379 - install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
2381 - installDir(file(install4jHomeDir))
2383 - mediaTypes = Arrays.asList(install4j_media_types.split(","))
2387 -task copyInstall4jTemplate {
2388 - def install4jTemplateFile = file("${install4jDir}/${install4j_template}")
2389 - def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}")
2390 - inputs.file(install4jTemplateFile)
2391 - inputs.file(install4jFileAssociationsFile)
2392 - inputs.property("CHANNEL", { CHANNEL })
2393 - outputs.file(install4jConfFile)
2396 - def install4jConfigXml = new XmlParser().parse(install4jTemplateFile)
2398 - // turn off code signing if no OSX_KEYPASS
2399 - if (OSX_KEYPASS == "") {
2400 - install4jConfigXml.'**'.codeSigning.each { codeSigning ->
2401 - codeSigning.'@macEnabled' = "false"
2403 - install4jConfigXml.'**'.windows.each { windows ->
2404 - windows.'@runPostProcessor' = "false"
2408 - // disable install screen for OSX dmg (for 2.11.2.0)
2409 - install4jConfigXml.'**'.macosArchive.each { macosArchive ->
2410 - macosArchive.attributes().remove('executeSetupApp')
2411 - macosArchive.attributes().remove('setupAppId')
2414 - // turn off checksum creation for LOCAL channel
2415 - def e = install4jConfigXml.application[0]
2416 - e.'@createChecksums' = string(install4jCheckSums)
2418 - // put file association actions where placeholder action is
2419 - def install4jFileAssociationsText = install4jFileAssociationsFile.text
2420 - def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
2421 - install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true
2422 - if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') {
2423 - def parent = a.parent()
2425 - fileAssociationActions.each { faa ->
2426 - parent.append(faa)
2428 - // don't need to continue in .any loop once replacements have been made
2433 - // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else
2434 - // NB we're deleting the /other/ one!
2435 - // Also remove the examples subdir from non-release versions
2436 - def customizedIdToDelete = "PROGRAM_GROUP_RELEASE"
2437 - // 2.11.1.0 NOT releasing with the Examples folder in the Program Group
2438 - if (false && CHANNEL=="RELEASE") { // remove 'false && ' to include Examples folder in RELEASE channel
2439 - customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE"
2441 - // remove the examples subdir from Full File Set
2442 - def files = install4jConfigXml.files[0]
2443 - def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" }
2444 - def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' }
2445 - def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' }
2446 - def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" }
2447 - dirEntry.parent().remove(dirEntry)
2449 - install4jConfigXml.'**'.action.any { a ->
2450 - if (a.'@customizedId' == customizedIdToDelete) {
2451 - def parent = a.parent()
2457 - // write install4j file
2458 - install4jConfFile.text = XmlUtil.serialize(install4jConfigXml)
2465 - delete install4jConfFile
2469 -task cleanInstallersDataFiles {
2470 - def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt")
2471 - def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums")
2472 - def hugoDataJsonFile = file("${jalviewDir}/${install4jBuildDir}/installers-${JALVIEW_VERSION_UNDERSCORES}.json")
2474 - delete installersOutputTxt
2475 - delete installersSha256
2476 - delete hugoDataJsonFile
2480 -task install4jDMGBackgroundImageCopy {
2481 - inputs.file "${install4jDMGBackgroundImageDir}/${install4jDMGBackgroundImageFile}"
2482 - outputs.dir "${install4jDMGBackgroundImageBuildDir}"
2485 - from(install4jDMGBackgroundImageDir) {
2486 - include(install4jDMGBackgroundImageFile)
2488 - into install4jDMGBackgroundImageBuildDir
2493 -task install4jDMGBackgroundImageProcess {
2494 - dependsOn install4jDMGBackgroundImageCopy
2497 - if (backgroundImageText) {
2498 - if (convertBinary == null) {
2499 - throw new StopExecutionException("No ImageMagick convert binary installed at '${convertBinaryExpectedLocation}'")
2501 - if (!project.hasProperty("install4j_background_image_text_suffix_cmd")) {
2502 - throw new StopExecutionException("No property 'install4j_background_image_text_suffix_cmd' defined. See channel_gradle.properties for channel ${CHANNEL}")
2504 - fileTree(dir: install4jDMGBackgroundImageBuildDir, include: "*.png").getFiles().each { file ->
2506 - executable convertBinary
2509 - '-font', install4j_background_image_text_font,
2510 - '-fill', install4j_background_image_text_colour,
2511 - '-draw', sprintf(install4j_background_image_text_suffix_cmd, channelSuffix),
2512 - '-draw', sprintf(install4j_background_image_text_commit_cmd, "git-commit: ${gitHash}"),
2513 - '-draw', sprintf(install4j_background_image_text_date_cmd, getDate("yyyy-MM-dd HH:mm:ss")),
2522 -task install4jDMGBackgroundImage {
2523 - dependsOn install4jDMGBackgroundImageProcess
2526 -task installerFiles(type: com.install4j.gradle.Install4jTask) {
2527 - group = "distribution"
2528 - description = "Create the install4j installers"
2530 - dependsOn copyInstall4jTemplate
2531 - dependsOn cleanInstallersDataFiles
2532 - dependsOn install4jDMGBackgroundImage
2534 - projectFile = install4jConfFile
2536 - // create an md5 for the input files to use as version for install4j conf file
2537 - def digest = MessageDigest.getInstance("MD5")
2539 - (file("${install4jDir}/${install4j_template}").text +
2540 - file("${install4jDir}/${install4j_info_plist_file_associations}").text +
2541 - file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
2542 - def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
2543 - if (filesMd5.length() >= 8) {
2544 - filesMd5 = filesMd5.substring(0,8)
2546 - def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
2549 - 'JALVIEW_NAME': jalview_name,
2550 - 'JALVIEW_APPLICATION_NAME': applicationName,
2551 - 'JALVIEW_DIR': "../..",
2552 - 'OSX_KEYSTORE': OSX_KEYSTORE,
2553 - 'OSX_APPLEID': OSX_APPLEID,
2554 - 'OSX_ALTOOLPASS': OSX_ALTOOLPASS,
2555 - 'JSIGN_SH': JSIGN_SH,
2556 - 'JRE_DIR': getdown_app_dir_java,
2557 - 'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
2558 - 'JALVIEW_VERSION': JALVIEW_VERSION,
2559 - 'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
2560 - 'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
2561 - 'JAVA_VERSION': JAVA_VERSION,
2562 - 'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
2563 - 'VERSION': JALVIEW_VERSION,
2564 - 'COPYRIGHT_MESSAGE': install4j_copyright_message,
2565 - 'BUNDLE_ID': install4jBundleId,
2566 - 'INTERNAL_ID': install4jInternalId,
2567 - 'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
2568 - 'MACOS_DMG_DS_STORE': install4jDMGDSStore,
2569 - 'MACOS_DMG_BG_IMAGE': "${install4jDMGBackgroundImageBuildDir}/${install4jDMGBackgroundImageFile}",
2570 - 'WRAPPER_LINK': getdownWrapperLink,
2571 - 'BASH_WRAPPER_SCRIPT': getdown_bash_wrapper_script,
2572 - 'POWERSHELL_WRAPPER_SCRIPT': getdown_powershell_wrapper_script,
2573 - 'BATCH_WRAPPER_SCRIPT': getdown_batch_wrapper_script,
2574 - 'WRAPPER_SCRIPT_BIN_DIR': getdown_wrapper_script_dir,
2575 - 'INSTALLER_NAME': install4jInstallerName,
2576 - 'INSTALL4J_UTILS_DIR': install4j_utils_dir,
2577 - 'GETDOWN_CHANNEL_DIR': getdownChannelDir,
2578 - 'GETDOWN_FILES_DIR': getdown_files_dir,
2579 - 'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
2580 - 'GETDOWN_DIST_DIR': getdownAppDistDir,
2581 - 'GETDOWN_ALT_DIR': getdown_app_dir_alt,
2582 - 'GETDOWN_INSTALL_DIR': getdown_install_dir,
2583 - 'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
2584 - 'BUILD_DIR': install4jBuildDir,
2585 - 'APPLICATION_CATEGORIES': install4j_application_categories,
2586 - 'APPLICATION_FOLDER': install4jApplicationFolder,
2587 - 'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
2588 - 'EXECUTABLE_NAME': install4jExecutableName,
2589 - 'EXTRA_SCHEME': install4jExtraScheme,
2590 - 'MAC_ICONS_FILE': install4jMacIconsFile,
2591 - 'WINDOWS_ICONS_FILE': install4jWindowsIconsFile,
2592 - 'PNG_ICON_FILE': install4jPngIconFile,
2593 - 'BACKGROUND': install4jBackground,
2596 - def varNameMap = [
2598 - 'windows': 'WINDOWS',
2602 - // these are the bundled OS/architecture VMs needed by install4j
2605 - [ "mac", "aarch64" ],
2606 - [ "windows", "x64" ],
2607 - [ "linux", "x64" ],
2608 - [ "linux", "aarch64" ]
2610 - osArch.forEach { os, arch ->
2611 - variables[ sprintf("%s_%s_JAVA_VM_DIR", varNameMap[os], arch.toUpperCase(Locale.ROOT)) ] = sprintf("%s/jre-%s-%s-%s/jre", jreInstallsDir, JAVA_INTEGER_VERSION, os, arch)
2612 - // N.B. For some reason install4j requires the below filename to have underscores and not hyphens
2613 - // otherwise running `gradle installers` generates a non-useful error:
2614 - // `install4j: compilation failed. Reason: java.lang.NumberFormatException: For input string: "windows"`
2615 - variables[ sprintf("%s_%s_JAVA_VM_TGZ", varNameMap[os], arch.toUpperCase(Locale.ROOT)) ] = sprintf("%s/tgz/jre_%s_%s_%s.tar.gz", jreInstallsDir, JAVA_INTEGER_VERSION, os, arch)
2618 - //println("INSTALL4J VARIABLES:")
2619 - //variables.each{k,v->println("${k}=${v}")}
2621 - destination = "${jalviewDir}/${install4jBuildDir}"
2622 - buildSelected = true
2624 - if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
2626 - disableSigning = true
2627 - disableNotarization = true
2630 - if (OSX_KEYPASS) {
2631 - macKeystorePassword = OSX_KEYPASS
2634 - if (OSX_ALTOOLPASS) {
2635 - appleIdPassword = OSX_ALTOOLPASS
2636 - disableNotarization = false
2638 - disableNotarization = true
2642 - println("Using projectFile "+projectFile)
2643 - if (!disableNotarization) { println("Will notarize OSX App DMG") }
2647 - inputs.dir(getdownAppBaseDir)
2648 - inputs.file(install4jConfFile)
2649 - inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
2650 - outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
2653 -def getDataHash(File myFile) {
2654 - HashCode hash = Files.asByteSource(myFile).hash(Hashing.sha256())
2655 - return myFile.exists()
2657 - "file" : myFile.getName(),
2658 - "filesize" : myFile.length(),
2659 - "sha256" : hash.toString()
2664 -def writeDataJsonFile(File installersOutputTxt, File installersSha256, File dataJsonFile) {
2666 - "channel" : getdownChannelName,
2667 - "date" : getDate("yyyy-MM-dd HH:mm:ss"),
2668 - "git-commit" : "${gitHash} [${gitBranch}]",
2669 - "version" : JALVIEW_VERSION
2671 - // install4j installer files
2672 - if (installersOutputTxt.exists()) {
2674 - installersOutputTxt.readLines().each { def line ->
2675 - if (line.startsWith("#")) {
2678 - line.replaceAll("\n","")
2679 - def vals = line.split("\t")
2680 - def filename = vals[3]
2681 - def filesize = file(filename).length()
2682 - filename = filename.replaceAll(/^.*\//, "")
2683 - hash[vals[0]] = [ "id" : vals[0], "os" : vals[1], "name" : vals[2], "file" : filename, "filesize" : filesize ]
2684 - idHash."${filename}" = vals[0]
2686 - if (install4jCheckSums && installersSha256.exists()) {
2687 - installersSha256.readLines().each { def line ->
2688 - if (line.startsWith("#")) {
2691 - line.replaceAll("\n","")
2692 - def vals = line.split(/\s+\*?/)
2693 - def filename = vals[1]
2694 - def innerHash = (hash.(idHash."${filename}"))."sha256" = vals[0]
2700 - "JAR": shadowJar.archiveFile, // executable JAR
2701 - "JVL": getdownVersionLaunchJvl, // version JVL
2702 - "SOURCE": sourceDist.archiveFile // source TGZ
2703 - ].each { key, value ->
2704 - def file = file(value)
2705 - if (file.exists()) {
2706 - def fileHash = getDataHash(file)
2707 - if (fileHash != null) {
2708 - hash."${key}" = fileHash;
2712 - return dataJsonFile.write(new JsonBuilder(hash).toPrettyString())
2715 -task staticMakeInstallersJsonFile {
2717 - def output = findProperty("i4j_output")
2718 - def sha256 = findProperty("i4j_sha256")
2719 - def json = findProperty("i4j_json")
2720 - if (output == null || sha256 == null || json == null) {
2721 - throw new GradleException("Must provide paths to all of output.txt, sha256sums, and output.json with '-Pi4j_output=... -Pi4j_sha256=... -Pi4j_json=...")
2723 - writeDataJsonFile(file(output), file(sha256), file(json))
2728 - dependsOn installerFiles
2734 - eclipse().configFile(eclipse_codestyle_file)
2738 -task createSourceReleaseProperties(type: WriteProperties) {
2739 - group = "distribution"
2740 - description = "Create the source RELEASE properties file"
2742 - def sourceTarBuildDir = "${buildDir}/sourceTar"
2743 - def sourceReleasePropertiesFile = "${sourceTarBuildDir}/RELEASE"
2744 - outputFile (sourceReleasePropertiesFile)
2747 - releaseProps.each{ key, val -> property key, val }
2748 - property "git.branch", gitBranch
2749 - property "git.hash", gitHash
2752 - outputs.file(outputFile)
2755 -task sourceDist(type: Tar) {
2756 - group "distribution"
2757 - description "Create a source .tar.gz file for distribution"
2759 - dependsOn createBuildProperties
2760 - dependsOn convertMdFiles
2761 - dependsOn eclipseAllPreferences
2762 - dependsOn createSourceReleaseProperties
2765 - def outputFileName = "${project.name}_${JALVIEW_VERSION_UNDERSCORES}.tar.gz"
2766 - archiveFileName = outputFileName
2768 - compression Compression.GZIP
2772 - def EXCLUDE_FILES=[
2783 - "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales",
2785 - "utils/InstallAnywhere",
2789 - def PROCESS_FILES=[
2800 - "gradle.properties",
2806 - "**/*.properties",
2810 - def INCLUDE_FILES=[
2812 - ".settings/org.eclipse.buildship.core.prefs",
2813 - ".settings/org.eclipse.jdt.core.prefs"
2816 - from(jalviewDir) {
2817 - exclude (EXCLUDE_FILES)
2818 - include (PROCESS_FILES)
2819 - filter(ReplaceTokens,
2823 - 'Version-Rel': JALVIEW_VERSION,
2824 - 'Year-Rel': getDate("yyyy")
2828 - from(jalviewDir) {
2829 - exclude (EXCLUDE_FILES)
2830 - exclude (PROCESS_FILES)
2831 - exclude ("appletlib")
2832 - exclude ("**/*locales")
2833 - exclude ("*locales/**")
2834 - exclude ("utils/InstallAnywhere")
2836 - exclude (getdown_files_dir)
2837 - // getdown_website_dir and getdown_archive_dir moved to build/website/docroot/getdown
2838 - //exclude (getdown_website_dir)
2839 - //exclude (getdown_archive_dir)
2841 - // exluding these as not using jars as modules yet
2842 - exclude ("${j11modDir}/**/*.jar")
2844 - from(jalviewDir) {
2845 - include(INCLUDE_FILES)
2847 -// from (jalviewDir) {
2848 -// // explicit includes for stuff that seemed to not get included
2849 -// include(fileTree("test/**/*."))
2850 -// exclude(EXCLUDE_FILES)
2851 -// exclude(PROCESS_FILES)
2854 - from(file(buildProperties).getParent()) {
2855 - include(file(buildProperties).getName())
2856 - rename(file(buildProperties).getName(), "build_properties")
2858 - line.replaceAll("^INSTALLATION=.*\$","INSTALLATION=Source Release"+" git-commit\\\\:"+gitHash+" ["+gitBranch+"]")
2862 - def sourceTarBuildDir = "${buildDir}/sourceTar"
2863 - from(sourceTarBuildDir) {
2864 - // this includes the appended RELEASE properties file
2868 -task dataInstallersJson {
2870 - description "Create the installers-VERSION.json data file for installer files created"
2872 - mustRunAfter installers
2873 - mustRunAfter shadowJar
2874 - mustRunAfter sourceDist
2875 - mustRunAfter getdownArchive
2877 - def installersOutputTxt = file("${jalviewDir}/${install4jBuildDir}/output.txt")
2878 - def installersSha256 = file("${jalviewDir}/${install4jBuildDir}/sha256sums")
2880 - if (installersOutputTxt.exists()) {
2881 - inputs.file(installersOutputTxt)
2883 - if (install4jCheckSums && installersSha256.exists()) {
2884 - inputs.file(installersSha256)
2887 - shadowJar.archiveFile, // executable JAR
2888 - getdownVersionLaunchJvl, // version JVL
2889 - sourceDist.archiveFile // source TGZ
2890 - ].each { fileName ->
2891 - if (file(fileName).exists()) {
2892 - inputs.file(fileName)
2896 - outputs.file(hugoDataJsonFile)
2899 - writeDataJsonFile(installersOutputTxt, installersSha256, hugoDataJsonFile)
2905 - description "Copies all help pages to build dir. Runs ant task 'pubhtmlhelp'."
2907 - dependsOn copyHelp
2908 - dependsOn pubhtmlhelp
2910 - inputs.dir("${helpBuildDir}/${help_dir}")
2911 - outputs.dir("${buildDir}/distributions/${help_dir}")
2915 -task j2sSetHeadlessBuild {
2917 - IN_ECLIPSE = false
2922 -task jalviewjsEnableAltFileProperty(type: WriteProperties) {
2924 - description "Enable the alternative J2S Config file for headless build"
2926 - outputFile = jalviewjsJ2sSettingsFileName
2927 - def j2sPropsFile = file(jalviewjsJ2sSettingsFileName)
2928 - def j2sProps = new Properties()
2929 - if (j2sPropsFile.exists()) {
2931 - def j2sPropsFileFIS = new FileInputStream(j2sPropsFile)
2932 - j2sProps.load(j2sPropsFileFIS)
2933 - j2sPropsFileFIS.close()
2935 - j2sProps.each { prop, val ->
2936 - property(prop, val)
2938 - } catch (Exception e) {
2939 - println("Exception reading ${jalviewjsJ2sSettingsFileName}")
2940 - e.printStackTrace()
2943 - if (! j2sProps.stringPropertyNames().contains(jalviewjs_j2s_alt_file_property_config)) {
2944 - property(jalviewjs_j2s_alt_file_property_config, jalviewjs_j2s_alt_file_property)
2949 -task jalviewjsSetEclipseWorkspace {
2950 - def propKey = "jalviewjs_eclipse_workspace"
2951 - def propVal = null
2952 - if (project.hasProperty(propKey)) {
2953 - propVal = project.getProperty(propKey)
2954 - if (propVal.startsWith("~/")) {
2955 - propVal = System.getProperty("user.home") + propVal.substring(1)
2958 - def propsFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_workspace_location_file}"
2959 - def propsFile = file(propsFileName)
2960 - def eclipseWsDir = propVal
2961 - def props = new Properties()
2963 - def writeProps = true
2964 - if (( eclipseWsDir == null || !file(eclipseWsDir).exists() ) && propsFile.exists()) {
2965 - def ins = new FileInputStream(propsFileName)
2968 - if (props.getProperty(propKey, null) != null) {
2969 - eclipseWsDir = props.getProperty(propKey)
2970 - writeProps = false
2974 - if (eclipseWsDir == null || !file(eclipseWsDir).exists()) {
2975 - def tempDir = File.createTempDir()
2976 - eclipseWsDir = tempDir.getAbsolutePath()
2979 - eclipseWorkspace = file(eclipseWsDir)
2982 - // do not run a headless transpile when we claim to be in Eclipse
2984 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2985 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
2987 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2991 - props.setProperty(propKey, eclipseWsDir)
2992 - propsFile.parentFile.mkdirs()
2993 - def bytes = new ByteArrayOutputStream()
2994 - props.store(bytes, null)
2995 - def propertiesString = bytes.toString()
2996 - propsFile.text = propertiesString
2999 - print("EXISTING ")
3002 - println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
3005 - //inputs.property(propKey, eclipseWsDir) // eclipseWsDir only gets set once this task runs, so will be out-of-date
3006 - outputs.file(propsFileName)
3007 - outputs.upToDateWhen { eclipseWorkspace.exists() && propsFile.exists() }
3011 -task jalviewjsEclipsePaths {
3012 - def eclipseProduct
3014 - def eclipseRoot = jalviewjs_eclipse_root
3015 - if (eclipseRoot.startsWith("~/")) {
3016 - eclipseRoot = System.getProperty("user.home") + eclipseRoot.substring(1)
3018 - if (OperatingSystem.current().isMacOsX()) {
3019 - eclipseRoot += "/Eclipse.app"
3020 - eclipseBinary = "${eclipseRoot}/Contents/MacOS/eclipse"
3021 - eclipseProduct = "${eclipseRoot}/Contents/Eclipse/.eclipseproduct"
3022 - } else if (OperatingSystem.current().isWindows()) { // check these paths!!
3023 - if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
3024 - eclipseRoot += "/eclipse"
3026 - eclipseBinary = "${eclipseRoot}/eclipse.exe"
3027 - eclipseProduct = "${eclipseRoot}/.eclipseproduct"
3028 - } else { // linux or unix
3029 - if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
3030 - eclipseRoot += "/eclipse"
3031 -println("eclipseDir exists")
3033 - eclipseBinary = "${eclipseRoot}/eclipse"
3034 - eclipseProduct = "${eclipseRoot}/.eclipseproduct"
3037 - eclipseVersion = "4.13" // default
3038 - def assumedVersion = true
3039 - if (file(eclipseProduct).exists()) {
3040 - def fis = new FileInputStream(eclipseProduct)
3041 - def props = new Properties()
3043 - eclipseVersion = props.getProperty("version")
3045 - assumedVersion = false
3048 - def propKey = "eclipse_debug"
3049 - eclipseDebug = (project.hasProperty(propKey) && project.getProperty(propKey).equals("true"))
3052 - // do not run a headless transpile when we claim to be in Eclipse
3054 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3055 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
3057 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3060 - if (!assumedVersion) {
3061 - println("ECLIPSE VERSION=${eclipseVersion}")
3067 -task printProperties {
3069 - description "Output to console all System.properties"
3071 - System.properties.each { key, val -> System.out.println("Property: ${key}=${val}") }
3076 -task eclipseSetup {
3077 - dependsOn eclipseProject
3078 - dependsOn eclipseClasspath
3079 - dependsOn eclipseJdt
3083 -// this version (type: Copy) will delete anything in the eclipse dropins folder that isn't in fromDropinsDir
3084 -task jalviewjsEclipseCopyDropins(type: Copy) {
3085 - dependsOn jalviewjsEclipsePaths
3087 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_eclipse_dropins_dir}", include: "*.jar")
3088 - inputFiles += file("${jalviewDir}/${jalviewjsJ2sPlugin}")
3089 - def outputDir = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}"
3096 -// this eclipse -clean doesn't actually work
3097 -task jalviewjsCleanEclipse(type: Exec) {
3098 - dependsOn eclipseSetup
3099 - dependsOn jalviewjsEclipsePaths
3100 - dependsOn jalviewjsEclipseCopyDropins
3102 - executable(eclipseBinary)
3103 - args(["-nosplash", "--launcher.suppressErrors", "-data", eclipseWorkspace.getPath(), "-clean", "-console", "-consoleLog"])
3104 - if (eclipseDebug) {
3109 - def inputString = """exit
3112 - def inputByteStream = new ByteArrayInputStream(inputString.getBytes())
3113 - standardInput = inputByteStream
3116 -/* not really working yet
3117 -jalviewjsEclipseCopyDropins.finalizedBy jalviewjsCleanEclipse
3121 -task jalviewjsTransferUnzipSwingJs {
3122 - def file_zip = "${jalviewDir}/${jalviewjs_swingjs_zip}"
3126 - from zipTree(file_zip)
3127 - into "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
3131 - inputs.file file_zip
3132 - outputs.dir "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
3136 -task jalviewjsTransferUnzipLib {
3137 - def zipFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_libjs_dir}", include: "*.zip")
3140 - zipFiles.each { file_zip ->
3142 - from zipTree(file_zip)
3143 - into "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
3148 - inputs.files zipFiles
3149 - outputs.dir "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
3153 -task jalviewjsTransferUnzipAllLibs {
3154 - dependsOn jalviewjsTransferUnzipSwingJs
3155 - dependsOn jalviewjsTransferUnzipLib
3159 -task jalviewjsCreateJ2sSettings(type: WriteProperties) {
3161 - description "Create the alternative j2s file from the j2s.* properties"
3163 - jalviewjsJ2sProps = project.properties.findAll { it.key.startsWith("j2s.") }.sort { it.key }
3164 - def siteDirProperty = "j2s.site.directory"
3165 - def setSiteDir = false
3166 - jalviewjsJ2sProps.each { prop, val ->
3167 - if (val != null) {
3168 - if (prop == siteDirProperty) {
3169 - if (!(val.startsWith('/') || val.startsWith("file://") )) {
3170 - val = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${val}"
3174 - property(prop,val)
3176 - if (!setSiteDir) { // default site location, don't override specifically set property
3177 - property(siteDirProperty,"${jalviewDirRelativePath}/${jalviewjsTransferSiteJsDir}")
3180 - outputFile = jalviewjsJ2sAltSettingsFileName
3182 - if (! IN_ECLIPSE) {
3183 - inputs.properties(jalviewjsJ2sProps)
3184 - outputs.file(jalviewjsJ2sAltSettingsFileName)
3189 -task jalviewjsEclipseSetup {
3190 - dependsOn jalviewjsEclipseCopyDropins
3191 - dependsOn jalviewjsSetEclipseWorkspace
3192 - dependsOn jalviewjsCreateJ2sSettings
3196 -task jalviewjsSyncAllLibs (type: Sync) {
3197 - dependsOn jalviewjsTransferUnzipAllLibs
3198 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteLibDir}")
3199 - inputFiles += fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}")
3200 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
3204 - def outputFiles = []
3205 - rename { filename ->
3206 - outputFiles += "${outputDir}/${filename}"
3213 - // should this be exclude really ?
3214 - duplicatesStrategy "INCLUDE"
3216 - outputs.files outputFiles
3217 - inputs.files inputFiles
3221 -task jalviewjsSyncResources (type: Sync) {
3222 - dependsOn buildResources
3224 - def inputFiles = fileTree(dir: resourcesBuildDir)
3225 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
3229 - def outputFiles = []
3230 - rename { filename ->
3231 - outputFiles += "${outputDir}/${filename}"
3237 - outputs.files outputFiles
3238 - inputs.files inputFiles
3242 -task jalviewjsSyncSiteResources (type: Sync) {
3243 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_site_resource_dir}")
3244 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
3248 - def outputFiles = []
3249 - rename { filename ->
3250 - outputFiles += "${outputDir}/${filename}"
3256 - outputs.files outputFiles
3257 - inputs.files inputFiles
3261 -task jalviewjsSyncBuildProperties (type: Sync) {
3262 - dependsOn createBuildProperties
3263 - def inputFiles = [file(buildProperties)]
3264 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
3268 - def outputFiles = []
3269 - rename { filename ->
3270 - outputFiles += "${outputDir}/${filename}"
3276 - outputs.files outputFiles
3277 - inputs.files inputFiles
3281 -task jalviewjsProjectImport(type: Exec) {
3282 - dependsOn eclipseSetup
3283 - dependsOn jalviewjsEclipsePaths
3284 - dependsOn jalviewjsEclipseSetup
3287 - // do not run a headless import when we claim to be in Eclipse
3289 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3290 - throw new StopExecutionException("Not running headless import whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
3292 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3296 - //def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview/org.eclipse.jdt.core"
3297 - def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview"
3298 - executable(eclipseBinary)
3299 - args(["-nosplash", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", eclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath])
3300 - if (eclipseDebug) {
3303 - args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
3304 - if (!IN_ECLIPSE) {
3305 - args += [ "-D${j2sHeadlessBuildProperty}=true" ]
3306 - args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
3309 - inputs.file("${jalviewDir}/.project")
3310 - outputs.upToDateWhen {
3311 - file(projdir).exists()
3316 -task jalviewjsTranspile(type: Exec) {
3317 - dependsOn jalviewjsEclipseSetup
3318 - dependsOn jalviewjsProjectImport
3319 - dependsOn jalviewjsEclipsePaths
3320 - if (!IN_ECLIPSE) {
3321 - dependsOn jalviewjsEnableAltFileProperty
3325 - // do not run a headless transpile when we claim to be in Eclipse
3327 - println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3328 - throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
3330 - println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
3334 - executable(eclipseBinary)
3335 - args(["-nosplash", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", eclipseWorkspace, "-${jalviewjs_eclipse_build_arg}", eclipse_project_name ])
3336 - if (eclipseDebug) {
3339 - args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
3340 - if (!IN_ECLIPSE) {
3341 - args += [ "-D${j2sHeadlessBuildProperty}=true" ]
3342 - args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
3348 - stdout = new ByteArrayOutputStream()
3349 - stderr = new ByteArrayOutputStream()
3351 - def logOutFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}"
3352 - def logOutFile = file(logOutFileName)
3353 - logOutFile.createNewFile()
3354 - logOutFile.text = """ROOT: ${jalviewjs_eclipse_root}
3355 -BINARY: ${eclipseBinary}
3356 -VERSION: ${eclipseVersion}
3357 -WORKSPACE: ${eclipseWorkspace}
3358 -DEBUG: ${eclipseDebug}
3361 - def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
3362 - // combine stdout and stderr
3363 - def logErrFOS = logOutFOS
3365 - if (jalviewjs_j2s_to_console.equals("true")) {
3366 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
3367 - new org.apache.tools.ant.util.TeeOutputStream(
3371 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
3372 - new org.apache.tools.ant.util.TeeOutputStream(
3377 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
3380 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
3387 - if (stdout.toString().contains("Error processing ")) {
3388 - // j2s did not complete transpile
3389 - //throw new TaskExecutionException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
3390 - if (jalviewjs_ignore_transpile_errors.equals("true")) {
3391 - println("IGNORING TRANSPILE ERRORS")
3392 - println("See eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
3394 - throw new GradleException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
3399 - inputs.dir("${jalviewDir}/${sourceDir}")
3400 - outputs.dir("${jalviewDir}/${jalviewjsTransferSiteJsDir}")
3401 - outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteJsDir}${jalviewjs_server_resource}").exists() } )
3405 -def jalviewjsCallCore(String name, FileCollection list, String prefixFile, String suffixFile, String jsfile, String zjsfile, File logOutFile, Boolean logOutConsole) {
3407 - def stdout = new ByteArrayOutputStream()
3408 - def stderr = new ByteArrayOutputStream()
3410 - def coreFile = file(jsfile)
3412 - msg = "Creating core for ${name}...\nGenerating ${jsfile}"
3414 - logOutFile.createNewFile()
3415 - logOutFile.append(msg+"\n")
3417 - def coreTop = file(prefixFile)
3418 - def coreBottom = file(suffixFile)
3419 - coreFile.getParentFile().mkdirs()
3420 - coreFile.createNewFile()
3421 - coreFile.write( coreTop.getText("UTF-8") )
3425 - def t = f.getText("UTF-8")
3426 - t.replaceAll("Clazz\\.([^_])","Clazz_${1}")
3427 - coreFile.append( t )
3429 - msg = "...file '"+f.getPath()+"' does not exist, skipping"
3431 - logOutFile.append(msg+"\n")
3434 - coreFile.append( coreBottom.getText("UTF-8") )
3436 - msg = "Generating ${zjsfile}"
3438 - logOutFile.append(msg+"\n")
3439 - def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
3440 - def logErrFOS = logOutFOS
3443 - classpath = files(["${jalviewDir}/${jalviewjs_closure_compiler}"])
3444 - main = "com.google.javascript.jscomp.CommandLineRunner"
3445 - jvmArgs = [ "-Dfile.encoding=UTF-8" ]
3446 - args = [ "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--charset", "UTF-8", "--js", jsfile, "--js_output_file", zjsfile ]
3447 - maxHeapSize = "2g"
3449 - msg = "\nRunning '"+commandLine.join(' ')+"'\n"
3451 - logOutFile.append(msg+"\n")
3453 - if (logOutConsole) {
3454 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
3455 - new org.apache.tools.ant.util.TeeOutputStream(
3459 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
3460 - new org.apache.tools.ant.util.TeeOutputStream(
3465 - standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
3468 - errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
3475 - logOutFile.append(msg+"\n")
3479 -task jalviewjsBuildAllCores {
3481 - description "Build the core js lib closures listed in the classlists dir"
3482 - dependsOn jalviewjsTranspile
3483 - dependsOn jalviewjsTransferUnzipSwingJs
3485 - def j2sDir = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${jalviewjs_j2s_subdir}"
3486 - def swingJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_j2s_subdir}"
3487 - def libJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteLibDir}/${jalviewjs_j2s_subdir}"
3488 - def jsDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_js_subdir}"
3489 - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}/${jalviewjs_j2s_subdir}/core"
3490 - def prefixFile = "${jsDir}/core/coretop2.js"
3491 - def suffixFile = "${jsDir}/core/corebottom2.js"
3493 - inputs.file prefixFile
3494 - inputs.file suffixFile
3496 - def classlistFiles = []
3497 - // add the classlists found int the jalviewjs_classlists_dir
3498 - fileTree(dir: "${jalviewDir}/${jalviewjs_classlists_dir}", include: "*.txt").each {
3500 - def name = file.getName() - ".txt"
3501 - classlistFiles += [
3507 - // _jmol and _jalview cores. Add any other peculiar classlist.txt files here
3508 - //classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jmol}"), 'name': "_jvjmol" ]
3509 - classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jalview}"), 'name': jalviewjsJalviewCoreName ]
3511 - jalviewjsCoreClasslists = []
3513 - classlistFiles.each {
3516 - def file = hash['file']
3517 - if (! file.exists()) {
3518 - //println("...classlist file '"+file.getPath()+"' does not exist, skipping")
3519 - return false // this is a "continue" in groovy .each closure
3521 - def name = hash['name']
3522 - if (name == null) {
3523 - name = file.getName() - ".txt"
3531 - def list = fileTree(dir: j2sDir, includes: filelist)
3533 - def jsfile = "${outputDir}/core${name}.js"
3534 - def zjsfile = "${outputDir}/core${name}.z.js"
3536 - jalviewjsCoreClasslists += [
3538 - 'zjsfile': zjsfile,
3544 - inputs.files(list)
3545 - outputs.file(jsfile)
3546 - outputs.file(zjsfile)
3549 - // _stevesoft core. add any cores without a classlist here (and the inputs and outputs)
3550 - def stevesoftClasslistName = "_stevesoft"
3551 - def stevesoftClasslist = [
3552 - 'jsfile': "${outputDir}/core${stevesoftClasslistName}.js",
3553 - 'zjsfile': "${outputDir}/core${stevesoftClasslistName}.z.js",
3554 - 'list': fileTree(dir: j2sDir, include: "com/stevesoft/pat/**/*.js"),
3555 - 'name': stevesoftClasslistName
3557 - jalviewjsCoreClasslists += stevesoftClasslist
3558 - inputs.files(stevesoftClasslist['list'])
3559 - outputs.file(stevesoftClasslist['jsfile'])
3560 - outputs.file(stevesoftClasslist['zjsfile'])
3563 - def allClasslistName = "_all"
3564 - def allJsFiles = fileTree(dir: j2sDir, include: "**/*.js")
3565 - allJsFiles += fileTree(
3567 - include: "**/*.js",
3569 - // these exlusions are files that the closure-compiler produces errors for. Should fix them
3570 - "**/org/jmol/jvxl/readers/IsoIntersectFileReader.js",
3571 - "**/org/jmol/export/JSExporter.js"
3574 - allJsFiles += fileTree(
3576 - include: "**/*.js",
3578 - // these exlusions are files that the closure-compiler produces errors for. Should fix them
3579 - "**/sun/misc/Unsafe.js",
3580 - "**/swingjs/jquery/jquery-editable-select.js",
3581 - "**/swingjs/jquery/j2sComboBox.js",
3582 - "**/sun/misc/FloatingDecimal.js"
3585 - def allClasslist = [
3586 - 'jsfile': "${outputDir}/core${allClasslistName}.js",
3587 - 'zjsfile': "${outputDir}/core${allClasslistName}.z.js",
3588 - 'list': allJsFiles,
3589 - 'name': allClasslistName
3591 - // not including this version of "all" core at the moment
3592 - //jalviewjsCoreClasslists += allClasslist
3593 - inputs.files(allClasslist['list'])
3594 - outputs.file(allClasslist['jsfile'])
3595 - outputs.file(allClasslist['zjsfile'])
3598 - def logOutFile = file("${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_closure_stdout}")
3599 - logOutFile.getParentFile().mkdirs()
3600 - logOutFile.createNewFile()
3601 - logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildAllCores\n----\n")
3603 - jalviewjsCoreClasslists.each {
3604 - jalviewjsCallCore(it.name, it.list, prefixFile, suffixFile, it.jsfile, it.zjsfile, logOutFile, jalviewjs_j2s_to_console.equals("true"))
3611 -def jalviewjsPublishCoreTemplate(String coreName, String templateName, File inputFile, String outputFile) {
3614 - into file(outputFile).getParentFile()
3615 - rename { filename ->
3616 - if (filename.equals(inputFile.getName())) {
3617 - return file(outputFile).getName()
3621 - filter(ReplaceTokens,
3625 - 'MAIN': '"'+main_class+'"',
3627 - 'NAME': jalviewjsJalviewTemplateName+" [core ${coreName}]",
3628 - 'COREKEY': jalviewjs_core_key,
3629 - 'CORENAME': coreName
3636 -task jalviewjsPublishCoreTemplates {
3637 - dependsOn jalviewjsBuildAllCores
3638 - def inputFileName = "${jalviewDir}/${j2s_coretemplate_html}"
3639 - def inputFile = file(inputFileName)
3640 - def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
3642 - def outputFiles = []
3643 - jalviewjsCoreClasslists.each { cl ->
3644 - def outputFile = "${outputDir}/${jalviewjsJalviewTemplateName}_${cl.name}.html"
3645 - cl['outputfile'] = outputFile
3646 - outputFiles += outputFile
3650 - jalviewjsCoreClasslists.each { cl ->
3651 - jalviewjsPublishCoreTemplate(cl.name, jalviewjsJalviewTemplateName, inputFile, cl.outputfile)
3654 - inputs.file(inputFile)
3655 - outputs.files(outputFiles)
3659 -task jalviewjsSyncCore (type: Sync) {
3660 - dependsOn jalviewjsBuildAllCores
3661 - dependsOn jalviewjsPublishCoreTemplates
3662 - def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteCoreDir}")
3663 - def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
3667 - def outputFiles = []
3668 - rename { filename ->
3669 - outputFiles += "${outputDir}/${filename}"
3675 - outputs.files outputFiles
3676 - inputs.files inputFiles
3680 -// this Copy version of TransferSiteJs will delete anything else in the target dir
3681 -task jalviewjsCopyTransferSiteJs(type: Copy) {
3682 - dependsOn jalviewjsTranspile
3683 - from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
3684 - into "${jalviewDir}/${jalviewjsSiteDir}"
3688 -// this Sync version of TransferSite is used by buildship to keep the website automatically up to date when a file changes
3689 -task jalviewjsSyncTransferSiteJs(type: Sync) {
3690 - from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
3692 - into "${jalviewDir}/${jalviewjsSiteDir}"
3699 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsCopyTransferSiteJs
3700 -jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSiteJs
3701 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSiteJs
3702 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsCopyTransferSiteJs
3704 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsSyncTransferSiteJs
3705 -jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSiteJs
3706 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSiteJs
3707 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsSyncTransferSiteJs
3710 -task jalviewjsPrepareSite {
3712 - description "Prepares the website folder including unzipping files and copying resources"
3713 - dependsOn jalviewjsSyncAllLibs
3714 - dependsOn jalviewjsSyncResources
3715 - dependsOn jalviewjsSyncSiteResources
3716 - dependsOn jalviewjsSyncBuildProperties
3717 - dependsOn jalviewjsSyncCore
3721 -task jalviewjsBuildSite {
3723 - description "Builds the whole website including transpiled code"
3724 - dependsOn jalviewjsCopyTransferSiteJs
3725 - dependsOn jalviewjsPrepareSite
3729 -task cleanJalviewjsTransferSite {
3731 - delete "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
3732 - delete "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
3733 - delete "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
3734 - delete "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
3739 -task cleanJalviewjsSite {
3740 - dependsOn cleanJalviewjsTransferSite
3742 - delete "${jalviewDir}/${jalviewjsSiteDir}"
3747 -task jalviewjsSiteTar(type: Tar) {
3749 - description "Creates a tar.gz file for the website"
3750 - dependsOn jalviewjsBuildSite
3751 - def outputFilename = "jalviewjs-site-${JALVIEW_VERSION}.tar.gz"
3752 - archiveFileName = outputFilename
3754 - compression Compression.GZIP
3756 - from "${jalviewDir}/${jalviewjsSiteDir}"
3757 - into jalviewjs_site_dir // this is inside the tar file
3759 - inputs.dir("${jalviewDir}/${jalviewjsSiteDir}")
3763 -task jalviewjsServer {
3765 - def filename = "jalviewjsTest.html"
3766 - description "Starts a webserver on localhost to test the website. See ${filename} to access local site on most recently used port."
3767 - def htmlFile = "${jalviewDirAbsolutePath}/${filename}"
3772 - def f = Class.forName("org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory")
3773 - factory = f.newInstance()
3774 - } catch (ClassNotFoundException e) {
3775 - throw new GradleException("Unable to create SimpleHttpFileServerFactory")
3777 - def port = Integer.valueOf(jalviewjs_server_port)
3779 - def running = false
3781 - def jalviewjsServer
3782 - while(port < start+1000 && !running) {
3784 - def doc_root = new File("${jalviewDirAbsolutePath}/${jalviewjsSiteDir}")
3785 - jalviewjsServer = factory.start(doc_root, port)
3787 - url = jalviewjsServer.getResourceUrl(jalviewjs_server_resource)
3788 - println("SERVER STARTED with document root ${doc_root}.")
3789 - println("Go to "+url+" . Run gradle --stop to stop (kills all gradle daemons).")
3790 - println("For debug: "+url+"?j2sdebug")
3791 - println("For verbose: "+url+"?j2sverbose")
3792 - } catch (Exception e) {
3796 - def htmlText = """
3797 - <p><a href="${url}">JalviewJS Test. <${url}></a></p>
3798 - <p><a href="${url}?j2sdebug">JalviewJS Test with debug. <${url}?j2sdebug></a></p>
3799 - <p><a href="${url}?j2sverbose">JalviewJS Test with verbose. <${url}?j2sdebug></a></p>
3801 - jalviewjsCoreClasslists.each { cl ->
3802 - def urlcore = jalviewjsServer.getResourceUrl(file(cl.outputfile).getName())
3804 - <p><a href="${urlcore}">${jalviewjsJalviewTemplateName} [core ${cl.name}]. <${urlcore}></a></p>
3806 - println("For core ${cl.name}: "+urlcore)
3809 - file(htmlFile).text = htmlText
3812 - outputs.file(htmlFile)
3813 - outputs.upToDateWhen({false})
3817 -task cleanJalviewjsAll {
3819 - description "Delete all configuration and build artifacts to do with JalviewJS build"
3820 - dependsOn cleanJalviewjsSite
3821 - dependsOn jalviewjsEclipsePaths
3824 - delete "${jalviewDir}/${jalviewjsBuildDir}"
3825 - delete "${jalviewDir}/${eclipse_bin_dir}"
3826 - if (eclipseWorkspace != null && file(eclipseWorkspace.getAbsolutePath()+"/.metadata").exists()) {
3827 - delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata")
3829 - delete jalviewjsJ2sAltSettingsFileName
3832 - outputs.upToDateWhen( { false } )
3836 -task jalviewjsIDE_checkJ2sPlugin {
3837 - group "00 JalviewJS in Eclipse"
3838 - description "Compare the swingjs/net.sf.j2s.core(-j11)?.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)"
3841 - def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
3842 - def j2sPluginFile = file(j2sPlugin)
3843 - def eclipseHome = System.properties["eclipse.home.location"]
3844 - if (eclipseHome == null || ! IN_ECLIPSE) {
3845 - throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
3847 - def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ]
3848 - def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"]
3849 - if (altPluginsDir != null && file(altPluginsDir).exists()) {
3850 - eclipseJ2sPluginDirs += altPluginsDir
3852 - def foundPlugin = false
3853 - def j2sPluginFileName = j2sPluginFile.getName()
3854 - def eclipseJ2sPlugin
3855 - def eclipseJ2sPluginFile
3856 - eclipseJ2sPluginDirs.any { dir ->
3857 - eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}"
3858 - eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
3859 - if (eclipseJ2sPluginFile.exists()) {
3860 - foundPlugin = true
3864 - if (!foundPlugin) {
3865 - def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin"
3866 - System.err.println(msg)
3867 - throw new StopExecutionException(msg)
3870 - def digest = MessageDigest.getInstance("MD5")
3872 - digest.update(j2sPluginFile.text.bytes)
3873 - def j2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
3875 - digest.update(eclipseJ2sPluginFile.text.bytes)
3876 - def eclipseJ2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
3878 - if (j2sPluginMd5 != eclipseJ2sPluginMd5) {
3879 - def msg = "WARNING! Eclipse J2S Plugin '${eclipseJ2sPlugin}' is different to this commit's version '${j2sPlugin}'"
3880 - System.err.println(msg)
3881 - throw new StopExecutionException(msg)
3883 - def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)"
3889 -task jalviewjsIDE_copyJ2sPlugin {
3890 - group "00 JalviewJS in Eclipse"
3891 - description "Copy the swingjs/net.sf.j2s.core(-j11)?.jar file into the Eclipse IDE's 'dropins' dir"
3894 - def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
3895 - def j2sPluginFile = file(j2sPlugin)
3896 - def eclipseHome = System.properties["eclipse.home.location"]
3897 - if (eclipseHome == null || ! IN_ECLIPSE) {
3898 - throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. NOT copying J2S Plugin.")
3900 - def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}"
3901 - def eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
3902 - def msg = "WARNING! Copying this commit's j2s plugin '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n* May require an Eclipse restart"
3903 - System.err.println(msg)
3906 - eclipseJ2sPluginFile.getParentFile().mkdirs()
3907 - into eclipseJ2sPluginFile.getParent()
3913 -task jalviewjsIDE_j2sFile {
3914 - group "00 JalviewJS in Eclipse"
3915 - description "Creates the .j2s file"
3916 - dependsOn jalviewjsCreateJ2sSettings
3920 -task jalviewjsIDE_SyncCore {
3921 - group "00 JalviewJS in Eclipse"
3922 - description "Build the core js lib closures listed in the classlists dir and publish core html from template"
3923 - dependsOn jalviewjsSyncCore
3927 -task jalviewjsIDE_SyncSiteAll {
3928 - dependsOn jalviewjsSyncAllLibs
3929 - dependsOn jalviewjsSyncResources
3930 - dependsOn jalviewjsSyncSiteResources
3931 - dependsOn jalviewjsSyncBuildProperties
3935 -cleanJalviewjsTransferSite.mustRunAfter jalviewjsIDE_SyncSiteAll
3938 -task jalviewjsIDE_PrepareSite {
3939 - group "00 JalviewJS in Eclipse"
3940 - description "Sync libs and resources to site dir, but not closure cores"
3942 - dependsOn jalviewjsIDE_SyncSiteAll
3943 - //dependsOn cleanJalviewjsTransferSite // not sure why this clean is here -- will slow down a re-run of this task
3947 -task jalviewjsIDE_AssembleSite {
3948 - group "00 JalviewJS in Eclipse"
3949 - description "Assembles unzipped supporting zipfiles, resources, site resources and closure cores into the Eclipse transpiled site"
3950 - dependsOn jalviewjsPrepareSite
3954 -task jalviewjsIDE_SiteClean {
3955 - group "00 JalviewJS in Eclipse"
3956 - description "Deletes the Eclipse transpiled site"
3957 - dependsOn cleanJalviewjsSite
3961 -task jalviewjsIDE_Server {
3962 - group "00 JalviewJS in Eclipse"
3963 - description "Starts a webserver on localhost to test the website"
3964 - dependsOn jalviewjsServer
3968 -// buildship runs this at import or gradle refresh
3969 -task eclipseSynchronizationTask {
3970 - //dependsOn eclipseSetup
3971 - dependsOn createBuildProperties
3972 - if (J2S_ENABLED) {
3973 - dependsOn jalviewjsIDE_j2sFile
3974 - dependsOn jalviewjsIDE_checkJ2sPlugin
3975 - dependsOn jalviewjsIDE_PrepareSite
3980 -// buildship runs this at build time or project refresh
3981 -task eclipseAutoBuildTask {
3982 - //dependsOn jalviewjsIDE_checkJ2sPlugin
3983 - //dependsOn jalviewjsIDE_PrepareSite
3989 - description "Build the site"
3990 - dependsOn jalviewjsBuildSite
3991 + outputs.file("${outputDir}/${archiveFileName}")