JAL-4020 class formatting
[jalview.git] / utils / debian / build_gradle.patch
1 --- a/build.gradle      2021-09-21 09:52:04.653972716 +0100
2 +++ b/build.gradle      2021-09-21 09:52:18.117985307 +0100
3 @@ -2,56 +2,12 @@
4   * For properties set within build.gradle, use camelCaseNoSpace.
5   */
6  import org.apache.tools.ant.filters.ReplaceTokens
7 -import org.gradle.internal.os.OperatingSystem
8 -import org.gradle.plugins.ide.internal.generator.PropertiesPersistableConfigurationObject
9 -import org.gradle.api.internal.PropertiesTransformer
10 -import org.gradle.util.ConfigureUtil
11 -import org.gradle.plugins.ide.eclipse.model.Output
12 -import org.gradle.plugins.ide.eclipse.model.Library
13 -import java.security.MessageDigest
14 -import groovy.transform.ExternalizeMethods
15 -import groovy.util.XmlParser
16 -import groovy.xml.XmlUtil
17 -import com.vladsch.flexmark.util.ast.Node
18 -import com.vladsch.flexmark.html.HtmlRenderer
19 -import com.vladsch.flexmark.parser.Parser
20 -import com.vladsch.flexmark.util.data.MutableDataSet
21 -import com.vladsch.flexmark.ext.gfm.tasklist.TaskListExtension
22 -import com.vladsch.flexmark.ext.tables.TablesExtension
23 -import com.vladsch.flexmark.ext.gfm.strikethrough.StrikethroughExtension
24 -import com.vladsch.flexmark.ext.autolink.AutolinkExtension
25 -import com.vladsch.flexmark.ext.anchorlink.AnchorLinkExtension
26 -import com.vladsch.flexmark.ext.toc.TocExtension
27 -
28 -buildscript {
29 -  repositories {
30 -    mavenCentral()
31 -    mavenLocal()
32 -  }
33 -  dependencies {
34 -    classpath "com.vladsch.flexmark:flexmark-all:0.62.0"
35 -  }
36 -}
37 -
38  
39  plugins {
40    id 'java'
41    id 'application'
42 -  id 'eclipse'
43 -  id "com.diffplug.gradle.spotless" version "3.28.0"
44 -  id 'com.github.johnrengelman.shadow' version '4.0.3'
45 -  id 'com.install4j.gradle' version '8.0.10'
46 -  id 'com.dorongold.task-tree' version '1.5' // only needed to display task dependency tree with  gradle task1 [task2 ...] taskTree
47 -  id 'com.palantir.git-version' version '0.12.3'
48 -}
49 -
50 -repositories {
51 -  jcenter()
52 -  mavenCentral()
53 -  mavenLocal()
54  }
55  
56 -
57  // in ext the values are cast to Object. Ensure string values are cast as String (and not GStringImpl) for later use
58  def string(Object o) {
59    return o == null ? "" : o.toString()
60 @@ -92,23 +48,15 @@
61    }
62  }
63  
64 -ext {
65 +project.ext {
66    jalviewDirAbsolutePath = file(jalviewDir).getAbsolutePath()
67    jalviewDirRelativePath = jalviewDir
68  
69 -  getdownChannelName = CHANNEL.toLowerCase()
70 -  // default to "default". Currently only has different cosmetics for "develop", "release", "default"
71 -  propertiesChannelName = ["develop", "release", "test-release", "jalviewjs", "jalviewjs-release" ].contains(getdownChannelName) ? getdownChannelName : "default"
72 -  // Import channel_properties
73 +  propertiesChannelName = "release"
74    channelDir = string("${jalviewDir}/${channel_properties_dir}/${propertiesChannelName}")
75    channelGradleProperties = string("${channelDir}/channel_gradle.properties")
76    overrideProperties(channelGradleProperties, false)
77 -  // local build environment properties
78 -  // can be "projectDir/local.properties"
79 -  overrideProperties("${projectDir}/local.properties", true)
80 -  // or "../projectDir_local.properties"
81 -  overrideProperties(projectDir.getParent() + "/" + projectDir.getName() + "_local.properties", true)
82 -
83 +  
84    ////  
85    // Import releaseProps from the RELEASE file
86    // or a file specified via JALVIEW_RELEASE_FILE if defined
87 @@ -128,41 +76,6 @@
88    if (findProperty("JALVIEW_VERSION")==null || "".equals(JALVIEW_VERSION)) {
89      JALVIEW_VERSION = releaseProps.get("jalview.version")
90    }
91 -  
92 -  // this property set when running Eclipse headlessly
93 -  j2sHeadlessBuildProperty = string("net.sf.j2s.core.headlessbuild")
94 -  // this property set by Eclipse
95 -  eclipseApplicationProperty = string("eclipse.application")
96 -  // CHECK IF RUNNING FROM WITHIN ECLIPSE
97 -  def eclipseApplicationPropertyVal = System.properties[eclipseApplicationProperty]
98 -  IN_ECLIPSE = eclipseApplicationPropertyVal != null && eclipseApplicationPropertyVal.startsWith("org.eclipse.ui.")
99 -  // BUT WITHOUT THE HEADLESS BUILD PROPERTY SET
100 -  if (System.properties[j2sHeadlessBuildProperty].equals("true")) {
101 -    println("Setting IN_ECLIPSE to ${IN_ECLIPSE} as System.properties['${j2sHeadlessBuildProperty}'] == '${System.properties[j2sHeadlessBuildProperty]}'")
102 -    IN_ECLIPSE = false
103 -  }
104 -  if (IN_ECLIPSE) {
105 -    println("WITHIN ECLIPSE IDE")
106 -  } else {
107 -    println("HEADLESS BUILD")
108 -  }
109 -  
110 -  J2S_ENABLED = (project.hasProperty('j2s.compiler.status') && project['j2s.compiler.status'] != null && project['j2s.compiler.status'] == "enable")
111 -  if (J2S_ENABLED) {
112 -    println("J2S ENABLED")
113 -  } 
114 -  /* *-/
115 -  System.properties.sort { it.key }.each {
116 -    key, val -> println("SYSTEM PROPERTY ${key}='${val}'")
117 -  }
118 -  /-* *-/
119 -  if (false && IN_ECLIPSE) {
120 -    jalviewDir = jalviewDirAbsolutePath
121 -  }
122 -  */
123 -
124 -  // datestamp
125 -  buildDate = new Date().format("yyyyMMdd")
126  
127    // essentials
128    bareSourceDir = string(source_dir)
129 @@ -173,218 +86,18 @@
130  
131    classesDir = string("${jalviewDir}/${classes_dir}")
132  
133 -  // clover
134 -  useClover = clover.equals("true")
135 -  cloverBuildDir = "${buildDir}/clover"
136 -  cloverInstrDir = file("${cloverBuildDir}/clover-instr")
137 -  cloverClassesDir = file("${cloverBuildDir}/clover-classes")
138 -  cloverReportDir = file("${buildDir}/reports/clover")
139 -  cloverTestInstrDir = file("${cloverBuildDir}/clover-test-instr")
140 -  cloverTestClassesDir = file("${cloverBuildDir}/clover-test-classes")
141 -  //cloverTestClassesDir = cloverClassesDir
142 -  cloverDb = string("${cloverBuildDir}/clover.db")
143 -
144 -  testSourceDir = useClover ? cloverTestInstrDir : testDir
145 -  testClassesDir = useClover ? cloverTestClassesDir : "${jalviewDir}/${test_output_dir}"
146 -
147 -  getdownWebsiteDir = string("${jalviewDir}/${getdown_website_dir}/${JAVA_VERSION}")
148 -  buildDist = true
149 -  buildProperties = null
150 -
151 -  // the following values might be overridden by the CHANNEL switch
152 -  getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
153 -  getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
154 -  getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher}")
155 -  getdownAppDistDir = getdown_app_dir_alt
156 -  getdownImagesDir = string("${jalviewDir}/${getdown_images_dir}")
157 -  getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application
158 -  reportRsyncCommand = false
159 -  jvlChannelName = CHANNEL.toLowerCase()
160 -  install4jSuffix = CHANNEL.substring(0, 1).toUpperCase() + CHANNEL.substring(1).toLowerCase(); // BUILD -> Build
161 -  install4jDMGDSStore = "${install4j_images_dir}/${install4j_dmg_ds_store}"
162 -  install4jDMGBackgroundImage = "${install4j_images_dir}/${install4j_dmg_background}"
163 -  install4jInstallerName = "${jalview_name} Non-Release Installer"
164 -  install4jExecutableName = install4j_executable_name
165 -  install4jExtraScheme = "jalviewx"
166 -  install4jMacIconsFile = string("${install4j_images_dir}/${install4j_mac_icons_file}")
167 -  install4jWindowsIconsFile = string("${install4j_images_dir}/${install4j_windows_icons_file}")
168 -  install4jPngIconFile = string("${install4j_images_dir}/${install4j_png_icon_file}")
169 -  install4jBackground = string("${install4j_images_dir}/${install4j_background}")
170 -  switch (CHANNEL) {
171 -
172 -    case "BUILD":
173 -    // TODO: get bamboo build artifact URL for getdown artifacts
174 -    getdown_channel_base = bamboo_channelbase
175 -    getdownChannelName = string("${bamboo_planKey}/${JAVA_VERSION}")
176 -    getdownAppBase = string("${bamboo_channelbase}/${bamboo_planKey}${bamboo_getdown_channel_suffix}/${JAVA_VERSION}")
177 -    jvlChannelName += "_${getdownChannelName}"
178 -    // automatically add the test group Not-bamboo for exclusion 
179 -    if ("".equals(testng_excluded_groups)) { 
180 -      testng_excluded_groups = "Not-bamboo"
181 -    }
182 -    install4jExtraScheme = "jalviewb"
183 -    break
184 +  useClover = false
185  
186 -    case [ "RELEASE", "JALVIEWJS-RELEASE" ]:
187 -    getdownAppDistDir = getdown_app_dir_release
188 -    reportRsyncCommand = true
189 -    install4jSuffix = ""
190 -    install4jInstallerName = "${jalview_name} Installer"
191 -    break
192 -
193 -    case "ARCHIVE":
194 -    getdownChannelName = CHANNEL.toLowerCase()+"/${JALVIEW_VERSION}"
195 -    getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
196 -    getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
197 -    if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
198 -      throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
199 -    } else {
200 -      package_dir = string("${ARCHIVEDIR}/${package_dir}")
201 -      buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
202 -      buildDist = false
203 -    }
204 -    reportRsyncCommand = true
205 -    install4jExtraScheme = "jalviewa"
206 -    break
207 -
208 -    case "ARCHIVELOCAL":
209 -    getdownChannelName = string("archive/${JALVIEW_VERSION}")
210 -    getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
211 -    getdownAppBase = file(getdownWebsiteDir).toURI().toString()
212 -    if (!file("${ARCHIVEDIR}/${package_dir}").exists()) {
213 -      throw new GradleException("Must provide an ARCHIVEDIR value to produce an archive distribution")
214 -    } else {
215 -      package_dir = string("${ARCHIVEDIR}/${package_dir}")
216 -      buildProperties = string("${ARCHIVEDIR}/${classes_dir}/${build_properties_file}")
217 -      buildDist = false
218 -    }
219 -    reportRsyncCommand = true
220 -    getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
221 -    install4jSuffix = "Archive"
222 -    install4jExtraScheme = "jalviewa"
223 -    break
224 -
225 -    case "DEVELOP":
226 -    reportRsyncCommand = true
227 -    getdownSetAppBaseProperty = true
228 -    // DEVELOP-RELEASE is usually associated with a Jalview release series so set the version
229 -    JALVIEW_VERSION=JALVIEW_VERSION+"-d${buildDate}"
230 -    
231 -    install4jSuffix = "Develop"
232 -    install4jExtraScheme = "jalviewd"
233 -    install4jInstallerName = "${jalview_name} Develop Installer"
234 -    break
235 -
236 -    case "TEST-RELEASE":
237 -    reportRsyncCommand = true
238 -    // Don't ignore transpile errors for release build
239 -    if (jalviewjs_ignore_transpile_errors.equals("true")) {
240 -      jalviewjs_ignore_transpile_errors = "false"
241 -      println("Setting jalviewjs_ignore_transpile_errors to 'false'")
242 -    }
243 -    JALVIEW_VERSION = JALVIEW_VERSION+"-test"
244 -    install4jSuffix = "Test"
245 -    install4jExtraScheme = "jalviewt"
246 -    install4jInstallerName = "${jalview_name} Test Installer"
247 -    break
248 -
249 -    case ~/^SCRATCH(|-[-\w]*)$/:
250 -    getdownChannelName = CHANNEL
251 -    JALVIEW_VERSION = JALVIEW_VERSION+"-"+CHANNEL
252 -    
253 -    getdownDir = string("${getdownChannelName}/${JAVA_VERSION}")
254 -    getdownAppBase = string("${getdown_channel_base}/${getdownDir}")
255 -    reportRsyncCommand = true
256 -    install4jSuffix = "Scratch"
257 -    break
258 -
259 -    case "TEST-LOCAL":
260 -    if (!file("${LOCALDIR}").exists()) {
261 -      throw new GradleException("Must provide a LOCALDIR value to produce a local distribution")
262 -    } else {
263 -      getdownAppBase = file(file("${LOCALDIR}").getAbsolutePath()).toURI().toString()
264 -      getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
265 -    }
266 -    JALVIEW_VERSION = "TEST"
267 -    install4jSuffix = "Test-Local"
268 -    install4jExtraScheme = "jalviewt"
269 -    install4jInstallerName = "${jalview_name} Test Installer"
270 -    break
271 -
272 -    case [ "LOCAL", "JALVIEWJS" ]:
273 -    JALVIEW_VERSION = "TEST"
274 -    getdownAppBase = file(getdownWebsiteDir).toURI().toString()
275 -    getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
276 -    install4jExtraScheme = "jalviewl"
277 -    break
278 -
279 -    default: // something wrong specified
280 -    throw new GradleException("CHANNEL must be one of BUILD, RELEASE, ARCHIVE, DEVELOP, TEST-RELEASE, SCRATCH-..., LOCAL [default]")
281 -    break
282 -
283 -  }
284 -  // override getdownAppBase if requested
285 -  if (findProperty("getdown_appbase_override") != null) {
286 -    // revert to LOCAL if empty string
287 -    if (string(getdown_appbase_override) == "") {
288 -      getdownAppBase = file(getdownWebsiteDir).toURI().toString()
289 -      getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
290 -    } else if (string(getdown_appbase_override).startsWith("file://")) {
291 -      getdownAppBase = string(getdown_appbase_override)
292 -      getdownLauncher = string("${jalviewDir}/${getdown_lib_dir}/${getdown_launcher_local}")
293 -    } else {
294 -      getdownAppBase = string(getdown_appbase_override)
295 -    }
296 -    println("Overriding getdown appbase with '${getdownAppBase}'")
297 -  }
298 -  // sanitise file name for jalview launcher file for this channel
299 -  jvlChannelName = jvlChannelName.replaceAll("[^\\w\\-]+", "_")
300 -  // install4j application and folder names
301 -  if (install4jSuffix == "") {
302 -    install4jApplicationName = "${jalview_name}"
303 -    install4jBundleId = "${install4j_bundle_id}"
304 -    install4jWinApplicationId = install4j_release_win_application_id
305 -  } else {
306 -    install4jApplicationName = "${jalview_name} ${install4jSuffix}"
307 -    install4jBundleId = "${install4j_bundle_id}-" + install4jSuffix.toLowerCase()
308 -    // add int hash of install4jSuffix to the last part of the application_id
309 -    def id = install4j_release_win_application_id
310 -    def idsplitreverse = id.split("-").reverse()
311 -    idsplitreverse[0] = idsplitreverse[0].toInteger() + install4jSuffix.hashCode()
312 -    install4jWinApplicationId = idsplitreverse.reverse().join("-")
313 -  }
314 -  // sanitise folder and id names
315 -  // install4jApplicationFolder = e.g. "Jalview Build"
316 -  install4jApplicationFolder = install4jApplicationName
317 -                                    .replaceAll("[\"'~:/\\\\\\s]", "_") // replace all awkward filename chars " ' ~ : / \
318 -                                    .replaceAll("_+", "_") // collapse __
319 -  install4jInternalId = install4jApplicationName
320 -                                    .replaceAll(" ","_")
321 -                                    .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
322 -                                    .replaceAll("_+", "") // collapse __
323 -                                    //.replaceAll("_*-_*", "-") // collapse _-_
324 -  install4jUnixApplicationFolder = install4jApplicationName
325 -                                    .replaceAll(" ","_")
326 -                                    .replaceAll("[^\\w\\-\\.]", "_") // replace other non [alphanumeric,_,-,.]
327 -                                    .replaceAll("_+", "_") // collapse __
328 -                                    .replaceAll("_*-_*", "-") // collapse _-_
329 -                                    .toLowerCase()
330 -
331 -  getdownWrapperLink = install4jUnixApplicationFolder // e.g. "jalview_local"
332 -  getdownAppDir = string("${getdownWebsiteDir}/${getdownAppDistDir}")
333 -  //getdownJ11libDir = "${getdownWebsiteDir}/${getdown_j11lib_dir}"
334 -  getdownResourceDir = string("${getdownWebsiteDir}/${getdown_resource_dir}")
335 -  getdownInstallDir = string("${getdownWebsiteDir}/${getdown_install_dir}")
336 -  getdownFilesDir = string("${jalviewDir}/${getdown_files_dir}/${JAVA_VERSION}/")
337 -  getdownFilesInstallDir = string("${getdownFilesDir}/${getdown_install_dir}")
338 -  /* compile without modules -- using classpath libraries
339 -  modules_compileClasspath = fileTree(dir: "${jalviewDir}/${j11modDir}", include: ["*.jar"])
340 -  modules_runtimeClasspath = modules_compileClasspath
341 -  */
342 -  def details = versionDetails()
343 -  gitHash = details.gitHash
344 -  gitBranch = details.branchName
345 +  resourceClassesDir = classesDir
346 +
347 +  testSourceDir = testDir
348 +  testClassesDir = "${jalviewDir}/${test_output_dir}"
349  
350 +  buildProperties = string("${classesDir}/${build_properties_file}")
351 +  getdownSetAppBaseProperty = false // whether to pass the appbase and appdistdir to the application
352 +
353 +  install4jApplicationName = "${jalview_name}"
354 +  
355    println("Using a ${CHANNEL} profile.")
356  
357    additional_compiler_args = []
358 @@ -396,71 +109,16 @@
359      libDistDir = j8libDir
360      compile_source_compatibility = 1.8
361      compile_target_compatibility = 1.8
362 -    // these are getdown.txt properties defined dependent on the JAVA_VERSION
363 -    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java8_min_version"))
364 -    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java8_max_version"))
365 -    // this property is assigned below and expanded to multiple lines in the getdown task
366 -    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java8_txt_multi_java_location"))
367 -    // this property is for the Java library used in eclipse
368 -    eclipseJavaRuntimeName = string("JavaSE-1.8")
369    } else if (JAVA_VERSION.equals("11")) {
370      JAVA_INTEGER_VERSION = string("11")
371      libDir = j11libDir
372      libDistDir = j11libDir
373      compile_source_compatibility = 11
374      compile_target_compatibility = 11
375 -    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
376 -    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
377 -    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
378 -    eclipseJavaRuntimeName = string("JavaSE-11")
379 -    /* compile without modules -- using classpath libraries
380 -    additional_compiler_args += [
381 -    '--module-path', modules_compileClasspath.asPath,
382 -    '--add-modules', j11modules
383 -    ]
384 -     */
385 -  } else if (JAVA_VERSION.equals("12") || JAVA_VERSION.equals("13")) {
386 -    JAVA_INTEGER_VERSION = JAVA_VERSION
387 -    libDir = j11libDir
388 -    libDistDir = j11libDir
389 -    compile_source_compatibility = JAVA_VERSION
390 -    compile_target_compatibility = JAVA_VERSION
391 -    getdownAltJavaMinVersion = string(findProperty("getdown_alt_java11_min_version"))
392 -    getdownAltJavaMaxVersion = string(findProperty("getdown_alt_java11_max_version"))
393 -    getdownAltMultiJavaLocation = string(findProperty("getdown_alt_java11_txt_multi_java_location"))
394 -    eclipseJavaRuntimeName = string("JavaSE-11")
395 -    /* compile without modules -- using classpath libraries
396 -    additional_compiler_args += [
397 -    '--module-path', modules_compileClasspath.asPath,
398 -    '--add-modules', j11modules
399 -    ]
400 -     */
401    } else {
402      throw new GradleException("JAVA_VERSION=${JAVA_VERSION} not currently supported by Jalview")
403    }
404  
405 -
406 -  // for install4j
407 -  JAVA_MIN_VERSION = JAVA_VERSION
408 -  JAVA_MAX_VERSION = JAVA_VERSION
409 -  def jreInstallsDir = string(jre_installs_dir)
410 -  if (jreInstallsDir.startsWith("~/")) {
411 -    jreInstallsDir = System.getProperty("user.home") + jreInstallsDir.substring(1)
412 -  }
413 -  macosJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-mac-x64/jre")
414 -  macosJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-mac-x64.tar.gz")
415 -  windowsJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-windows-x64/jre")
416 -  windowsJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-windows-x64.tar.gz")
417 -  linuxJavaVMDir = string("${jreInstallsDir}/jre-${JAVA_INTEGER_VERSION}-linux-x64/jre")
418 -  linuxJavaVMTgz = string("${jreInstallsDir}/tgz/jre-${JAVA_INTEGER_VERSION}-linux-x64.tar.gz")
419 -  install4jDir = string("${jalviewDir}/${install4j_utils_dir}")
420 -  install4jConfFileName = string("jalview-install4j-conf.install4j")
421 -  install4jConfFile = file("${install4jDir}/${install4jConfFileName}")
422 -  install4jHomeDir = install4j_home_dir
423 -  if (install4jHomeDir.startsWith("~/")) {
424 -    install4jHomeDir = System.getProperty("user.home") + install4jHomeDir.substring(1)
425 -  }
426 -
427    resourceBuildDir = string("${buildDir}/resources")
428    resourcesBuildDir = string("${resourceBuildDir}/resources_build")
429    helpBuildDir = string("${resourceBuildDir}/help_build")
430 @@ -474,31 +132,6 @@
431    helpSourceDir = string("${helpParentDir}/${help_dir}")
432    helpFile = string("${helpBuildDir}/${help_dir}/help.jhm")
433  
434 -
435 -  relativeBuildDir = file(jalviewDirAbsolutePath).toPath().relativize(buildDir.toPath())
436 -  jalviewjsBuildDir = string("${relativeBuildDir}/jalviewjs")
437 -  jalviewjsSiteDir = string("${jalviewjsBuildDir}/${jalviewjs_site_dir}")
438 -  if (IN_ECLIPSE) {
439 -    jalviewjsTransferSiteJsDir = string(jalviewjsSiteDir)
440 -  } else {
441 -    jalviewjsTransferSiteJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_js")
442 -  }
443 -  jalviewjsTransferSiteLibDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_lib")
444 -  jalviewjsTransferSiteSwingJsDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_swingjs")
445 -  jalviewjsTransferSiteCoreDir = string("${jalviewjsBuildDir}/tmp/${jalviewjs_site_dir}_core")
446 -  jalviewjsJalviewCoreHtmlFile = string("")
447 -  jalviewjsJalviewCoreName = string(jalviewjs_core_name)
448 -  jalviewjsCoreClasslists = []
449 -  jalviewjsJalviewTemplateName = string(jalviewjs_name)
450 -  jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}")
451 -  jalviewjsJ2sAltSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_alt_settings}")
452 -  jalviewjsJ2sProps = null
453 -  jalviewjsJ2sPlugin = jalviewjs_j2s_plugin
454 -
455 -  eclipseWorkspace = null
456 -  eclipseBinary = string("")
457 -  eclipseVersion = string("")
458 -  eclipseDebug = false
459    // ENDEXT
460  }
461  
462 @@ -517,27 +150,12 @@
463      compileClasspath = files(sourceSets.main.java.outputDir)
464      compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
465  
466 -    runtimeClasspath = compileClasspath
467 -    runtimeClasspath += files(sourceSets.main.resources.srcDirs)
468 -  }
469 -
470 -  clover {
471 -    java {
472 -      srcDirs cloverInstrDir
473 -      outputDir = cloverClassesDir
474 -    }
475 -
476 -    resources {
477 -      srcDirs = sourceSets.main.resources.srcDirs
478 -    }
479  
480 -    compileClasspath = files( sourceSets.clover.java.outputDir )
481 -    //compileClasspath += files( testClassesDir )
482 +    compileClasspath = files(sourceSets.main.java.outputDir)
483      compileClasspath += fileTree(dir: "${jalviewDir}/${libDir}", include: ["*.jar"])
484 -    compileClasspath += fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
485 -    compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**/*.jar"])
486  
487      runtimeClasspath = compileClasspath
488 +    runtimeClasspath += files(sourceSets.main.resources.srcDirs)
489    }
490  
491    test {
492 @@ -557,453 +175,41 @@
493      runtimeClasspath = compileClasspath
494      runtimeClasspath += files(sourceSets.test.resources.srcDirs)
495    }
496 -
497 -}
498 -
499 -
500 -// eclipse project and settings files creation, also used by buildship
501 -eclipse {
502 -  project {
503 -    name = eclipse_project_name
504 -
505 -    natures 'org.eclipse.jdt.core.javanature',
506 -    'org.eclipse.jdt.groovy.core.groovyNature',
507 -    'org.eclipse.buildship.core.gradleprojectnature'
508 -
509 -    buildCommand 'org.eclipse.jdt.core.javabuilder'
510 -    buildCommand 'org.eclipse.buildship.core.gradleprojectbuilder'
511 -  }
512 -
513 -  classpath {
514 -    //defaultOutputDir = sourceSets.main.java.outputDir
515 -    configurations.each{ c->
516 -      if (c.isCanBeResolved()) {
517 -        minusConfigurations += [c]
518 -      }
519 -    }
520 -
521 -    plusConfigurations = [ ]
522 -    file {
523 -
524 -      whenMerged { cp ->
525 -        def removeTheseToo = []
526 -        HashMap<String, Boolean> alreadyAddedSrcPath = new HashMap<>();
527 -        cp.entries.each { entry ->
528 -          // This conditional removes all src classpathentries that a) have already been added or b) aren't "src" or "test".
529 -          // e.g. this removes the resources dir being copied into bin/main, bin/test AND bin/clover
530 -          // we add the resources and help/help dirs in as libs afterwards (see below)
531 -          if (entry.kind == 'src') {
532 -            if (alreadyAddedSrcPath.getAt(entry.path) || !(entry.path == bareSourceDir || entry.path == bareTestSourceDir)) {
533 -              removeTheseToo += entry
534 -            } else {
535 -              alreadyAddedSrcPath.putAt(entry.path, true)
536 -            }
537 -          }
538 -
539 -        }
540 -        cp.entries.removeAll(removeTheseToo)
541 -
542 -        //cp.entries += new Output("${eclipse_bin_dir}/main")
543 -        if (file(helpParentDir).isDirectory()) {
544 -          cp.entries += new Library(fileReference(helpParentDir))
545 -        }
546 -        if (file(resourceDir).isDirectory()) {
547 -          cp.entries += new Library(fileReference(resourceDir))
548 -        }
549 -
550 -        HashMap<String, Boolean> alreadyAddedLibPath = new HashMap<>();
551 -
552 -        sourceSets.main.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
553 -          //don't want to add outputDir as eclipse is using its own output dir in bin/main
554 -          if (it.isDirectory() || ! it.exists()) {
555 -            // don't add dirs to classpath, especially if they don't exist
556 -            return false // groovy "continue" in .any closure
557 -          }
558 -          def itPath = it.toString()
559 -          if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
560 -            // make relative path
561 -            itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
562 -          }
563 -          if (alreadyAddedLibPath.get(itPath)) {
564 -            //println("Not adding duplicate entry "+itPath)
565 -          } else {
566 -            //println("Adding entry "+itPath)
567 -            cp.entries += new Library(fileReference(itPath))
568 -            alreadyAddedLibPath.put(itPath, true)
569 -          }
570 -        }
571 -
572 -        sourceSets.test.compileClasspath.findAll { it.name.endsWith(".jar") }.any {
573 -          //no longer want to add outputDir as eclipse is using its own output dir in bin/main
574 -          if (it.isDirectory() || ! it.exists()) {
575 -            // don't add dirs to classpath
576 -            return false // groovy "continue" in .any closure
577 -          }
578 -
579 -          def itPath = it.toString()
580 -          if (itPath.startsWith("${jalviewDirAbsolutePath}/")) {
581 -            itPath = itPath.substring(jalviewDirAbsolutePath.length()+1)
582 -          }
583 -          if (alreadyAddedLibPath.get(itPath)) {
584 -            // don't duplicate
585 -          } else {
586 -            def lib = new Library(fileReference(itPath))
587 -            lib.entryAttributes["test"] = "true"
588 -            cp.entries += lib
589 -            alreadyAddedLibPath.put(itPath, true)
590 -          }
591 -        }
592 -
593 -      } // whenMerged
594 -
595 -    } // file
596 -
597 -    containers 'org.eclipse.buildship.core.gradleclasspathcontainer'
598 -
599 -  } // classpath
600 -
601 -  jdt {
602 -    // for the IDE, use java 11 compatibility
603 -    sourceCompatibility = compile_source_compatibility
604 -    targetCompatibility = compile_target_compatibility
605 -    javaRuntimeName = eclipseJavaRuntimeName
606 -
607 -    // add in jalview project specific properties/preferences into eclipse core preferences
608 -    file {
609 -      withProperties { props ->
610 -        def jalview_prefs = new Properties()
611 -        def ins = new FileInputStream("${jalviewDirAbsolutePath}/${eclipse_extra_jdt_prefs_file}")
612 -        jalview_prefs.load(ins)
613 -        ins.close()
614 -        jalview_prefs.forEach { t, v ->
615 -          if (props.getAt(t) == null) {
616 -            props.putAt(t, v)
617 -          }
618 -        }
619 -        // codestyle file -- overrides previous formatter prefs
620 -        def csFile = file("${jalviewDirAbsolutePath}/${eclipse_codestyle_file}")
621 -        if (csFile.exists()) {
622 -          XmlParser parser = new XmlParser()
623 -          def profiles = parser.parse(csFile)
624 -          def profile = profiles.'profile'.find { p -> (p.'@kind' == "CodeFormatterProfile" && p.'@name' == "Jalview") }
625 -          if (profile != null) {
626 -            profile.'setting'.each { s ->
627 -              def id = s.'@id'
628 -              def value = s.'@value'
629 -              if (id != null && value != null) {
630 -                props.putAt(id, value)
631 -              }
632 -            }
633 -          }
634 -        }
635 -      }
636 -    }
637 -
638 -  } // jdt
639 -
640 -  if (IN_ECLIPSE) {
641 -    // Don't want these to be activated if in headless build
642 -    synchronizationTasks "eclipseSynchronizationTask"
643 -    //autoBuildTasks "eclipseAutoBuildTask"
644 -
645 -  }
646 -}
647 -
648 -
649 -/* hack to change eclipse prefs in .settings files other than org.eclipse.jdt.core.prefs */
650 -// Class to allow updating arbitrary properties files
651 -class PropertiesFile extends PropertiesPersistableConfigurationObject {
652 -  public PropertiesFile(PropertiesTransformer t) { super(t); }
653 -  @Override protected void load(Properties properties) { }
654 -  @Override protected void store(Properties properties) { }
655 -  @Override protected String getDefaultResourceName() { return ""; }
656 -  // This is necessary, because PropertiesPersistableConfigurationObject fails
657 -  // if no default properties file exists.
658 -  @Override public void loadDefaults() { load(new StringBufferInputStream("")); }
659 -}
660 -
661 -// Task to update arbitrary properties files (set outputFile)
662 -class PropertiesFileTask extends PropertiesGeneratorTask<PropertiesFile> {
663 -  private final PropertiesFileContentMerger file;
664 -  public PropertiesFileTask() { file = new PropertiesFileContentMerger(getTransformer()); }
665 -  protected PropertiesFile create() { return new PropertiesFile(getTransformer()); }
666 -  protected void configure(PropertiesFile props) {
667 -    file.getBeforeMerged().execute(props); file.getWhenMerged().execute(props);
668 -  }
669 -  public void file(Closure closure) { ConfigureUtil.configure(closure, file); }
670 -}
671 -
672 -task eclipseUIPreferences(type: PropertiesFileTask) {
673 -  description = "Generate Eclipse additional settings"
674 -  def filename = "org.eclipse.jdt.ui.prefs"
675 -  outputFile = "$projectDir/.settings/${filename}" as File
676 -  file {
677 -    withProperties {
678 -      it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
679 + /*  test {
680 +    java {
681 +      srcDirs testSourceDir
682 +      outputDir = file(testClassesDir)
683      }
684 -  }
685 -}
686  
687 -task eclipseGroovyCorePreferences(type: PropertiesFileTask) {
688 -  description = "Generate Eclipse additional settings"
689 -  def filename = "org.eclipse.jdt.groovy.core.prefs"
690 -  outputFile = "$projectDir/.settings/${filename}" as File
691 -  file {
692 -    withProperties {
693 -      it.load new FileInputStream("$projectDir/utils/eclipse/${filename}" as String)
694 +    resources {
695 +      srcDirs = sourceSets.main.resources.srcDirs
696      }
697 -  }
698 -}
699 -
700 -task eclipseAllPreferences {
701 -  dependsOn eclipseJdt
702 -  dependsOn eclipseUIPreferences
703 -  dependsOn eclipseGroovyCorePreferences
704 -}
705 -
706 -eclipseUIPreferences.mustRunAfter eclipseJdt
707 -eclipseGroovyCorePreferences.mustRunAfter eclipseJdt
708 -
709 -/* end of eclipse preferences hack */
710 -
711 -
712 -// clover bits
713 -
714 -
715 -task cleanClover {
716 -  doFirst {
717 -    delete cloverBuildDir
718 -    delete cloverReportDir
719 -  }
720 -}
721 -
722 -
723 -task cloverInstrJava(type: JavaExec) {
724 -  group = "Verification"
725 -  description = "Create clover instrumented source java files"
726 -
727 -  dependsOn cleanClover
728 -
729 -  inputs.files(sourceSets.main.allJava)
730 -  outputs.dir(cloverInstrDir)
731 -
732 -  //classpath = fileTree(dir: "${jalviewDir}/${clover_lib_dir}", include: ["*.jar"])
733 -  classpath = sourceSets.clover.compileClasspath
734 -  main = "com.atlassian.clover.CloverInstr"
735 -
736 -  def argsList = [
737 -    "--encoding",
738 -    "UTF-8",
739 -    "--initstring",
740 -    cloverDb,
741 -    "--destdir",
742 -    cloverInstrDir.getPath(),
743 -  ]
744 -  def srcFiles = sourceSets.main.allJava.files
745 -  argsList.addAll(
746 -    srcFiles.collect(
747 -      { file -> file.absolutePath }
748 -    )
749 -  )
750 -  args argsList.toArray()
751 -
752 -  doFirst {
753 -    delete cloverInstrDir
754 -    println("Clover: About to instrument "+srcFiles.size() +" files")
755 -  }
756 -}
757 -
758 -
759 -task cloverInstrTests(type: JavaExec) {
760 -  group = "Verification"
761 -  description = "Create clover instrumented source test files"
762 -
763 -  dependsOn cleanClover
764 -
765 -  inputs.files(testDir)
766 -  outputs.dir(cloverTestInstrDir)
767 -
768 -  classpath = sourceSets.clover.compileClasspath
769 -  main = "com.atlassian.clover.CloverInstr"
770 -
771 -  def argsList = [
772 -    "--encoding",
773 -    "UTF-8",
774 -    "--initstring",
775 -    cloverDb,
776 -    "--srcdir",
777 -    testDir,
778 -    "--destdir",
779 -    cloverTestInstrDir.getPath(),
780 -  ]
781 -  args argsList.toArray()
782 -
783 -  doFirst {
784 -    delete cloverTestInstrDir
785 -    println("Clover: About to instrument test files")
786 -  }
787 -}
788 -
789 -
790 -task cloverInstr {
791 -  group = "Verification"
792 -  description = "Create clover instrumented all source files"
793 -
794 -  dependsOn cloverInstrJava
795 -  dependsOn cloverInstrTests
796 -}
797 -
798 -
799 -cloverClasses.dependsOn cloverInstr
800 -
801 -
802 -task cloverConsoleReport(type: JavaExec) {
803 -  group = "Verification"
804 -  description = "Creates clover console report"
805 -
806 -  onlyIf {
807 -    file(cloverDb).exists()
808 -  }
809 -
810 -  inputs.dir cloverClassesDir
811 -
812 -  classpath = sourceSets.clover.runtimeClasspath
813 -  main = "com.atlassian.clover.reporters.console.ConsoleReporter"
814 -
815 -  if (cloverreport_mem.length() > 0) {
816 -    maxHeapSize = cloverreport_mem
817 -  }
818 -  if (cloverreport_jvmargs.length() > 0) {
819 -    jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
820 -  }
821 -
822 -  def argsList = [
823 -    "--alwaysreport",
824 -    "--initstring",
825 -    cloverDb,
826 -    "--unittests"
827 -  ]
828 -
829 -  args argsList.toArray()
830 -}
831 -
832 -
833 -task cloverHtmlReport(type: JavaExec) {
834 -  group = "Verification"
835 -  description = "Creates clover HTML report"
836 -
837 -  onlyIf {
838 -    file(cloverDb).exists()
839 -  }
840 -
841 -  def cloverHtmlDir = cloverReportDir
842 -  inputs.dir cloverClassesDir
843 -  outputs.dir cloverHtmlDir
844 -
845 -  classpath = sourceSets.clover.runtimeClasspath
846 -  main = "com.atlassian.clover.reporters.html.HtmlReporter"
847 -
848 -  if (cloverreport_mem.length() > 0) {
849 -    maxHeapSize = cloverreport_mem
850 -  }
851 -  if (cloverreport_jvmargs.length() > 0) {
852 -    jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
853 -  }
854 -
855 -  def argsList = [
856 -    "--alwaysreport",
857 -    "--initstring",
858 -    cloverDb,
859 -    "--outputdir",
860 -    cloverHtmlDir
861 -  ]
862 -
863 -  if (cloverreport_html_options.length() > 0) {
864 -    argsList += cloverreport_html_options.split(" ")
865 -  }
866 -
867 -  args argsList.toArray()
868 -}
869 -
870 -
871 -task cloverXmlReport(type: JavaExec) {
872 -  group = "Verification"
873 -  description = "Creates clover XML report"
874 -
875 -  onlyIf {
876 -    file(cloverDb).exists()
877 -  }
878 -
879 -  def cloverXmlFile = "${cloverReportDir}/clover.xml"
880 -  inputs.dir cloverClassesDir
881 -  outputs.file cloverXmlFile
882 -
883 -  classpath = sourceSets.clover.runtimeClasspath
884 -  main = "com.atlassian.clover.reporters.xml.XMLReporter"
885 -
886 -  if (cloverreport_mem.length() > 0) {
887 -    maxHeapSize = cloverreport_mem
888 -  }
889 -  if (cloverreport_jvmargs.length() > 0) {
890 -    jvmArgs Arrays.asList(cloverreport_jvmargs.split(" "))
891 -  }
892 -
893 -  def argsList = [
894 -    "--alwaysreport",
895 -    "--initstring",
896 -    cloverDb,
897 -    "--outfile",
898 -    cloverXmlFile
899 -  ]
900 -
901 -  if (cloverreport_xml_options.length() > 0) {
902 -    argsList += cloverreport_xml_options.split(" ")
903 -  }
904 -
905 -  args argsList.toArray()
906 -}
907  
908 +    compileClasspath = files( sourceSets.test.java.outputDir )
909 +    compileClasspath += sourceSets.main.compileClasspath
910 +    compileClasspath += fileTree(dir: "${jalviewDir}/${utils_dir}/testnglibs", include: ["**   REMOVE_THIS_GAP  /*.jar"])
911  
912 -task cloverReport {
913 -  group = "Verification"
914 -  description = "Creates clover reports"
915 -
916 -  dependsOn cloverXmlReport
917 -  dependsOn cloverHtmlReport
918 -}
919 -
920 -
921 -compileCloverJava {
922 -
923 -  doFirst {
924 -    sourceCompatibility = compile_source_compatibility
925 -    targetCompatibility = compile_target_compatibility
926 -    options.compilerArgs += additional_compiler_args
927 -    print ("Setting target compatibility to "+targetCompatibility+"\n")
928 +    runtimeClasspath = compileClasspath
929    }
930 -  //classpath += configurations.cloverRuntime
931 +*/
932  }
933 -// end clover bits
934  
935  
936  compileJava {
937 -  // JBP->BS should the print statement in doFirst refer to compile_target_compatibility ?
938    sourceCompatibility = compile_source_compatibility
939    targetCompatibility = compile_target_compatibility
940    options.compilerArgs = additional_compiler_args
941 -  options.encoding = "UTF-8"
942    doFirst {
943      print ("Setting target compatibility to "+compile_target_compatibility+"\n")
944    }
945 -
946  }
947  
948  
949  compileTestJava {
950 -  sourceCompatibility = compile_source_compatibility
951 -  targetCompatibility = compile_target_compatibility
952 -  options.compilerArgs = additional_compiler_args
953    doFirst {
954 +    sourceCompatibility = compile_source_compatibility
955 +    targetCompatibility = compile_target_compatibility
956 +    options.compilerArgs = additional_compiler_args
957      print ("Setting target compatibility to "+targetCompatibility+"\n")
958    }
959  }
960 @@ -1017,7 +223,6 @@
961  
962  
963  cleanTest {
964 -  dependsOn cleanClover
965    doFirst {
966      delete sourceSets.test.java.outputDir
967    }
968 @@ -1031,85 +236,6 @@
969  }
970  
971  
972 -def convertMdToHtml (FileTree mdFiles, File cssFile) {
973 -  MutableDataSet options = new MutableDataSet()
974 -
975 -  def extensions = new ArrayList<>()
976 -  extensions.add(AnchorLinkExtension.create()) 
977 -  extensions.add(AutolinkExtension.create())
978 -  extensions.add(StrikethroughExtension.create())
979 -  extensions.add(TaskListExtension.create())
980 -  extensions.add(TablesExtension.create())
981 -  extensions.add(TocExtension.create())
982 -  
983 -  options.set(Parser.EXTENSIONS, extensions)
984 -
985 -  // set GFM table parsing options
986 -  options.set(TablesExtension.WITH_CAPTION, false)
987 -  options.set(TablesExtension.COLUMN_SPANS, false)
988 -  options.set(TablesExtension.MIN_HEADER_ROWS, 1)
989 -  options.set(TablesExtension.MAX_HEADER_ROWS, 1)
990 -  options.set(TablesExtension.APPEND_MISSING_COLUMNS, true)
991 -  options.set(TablesExtension.DISCARD_EXTRA_COLUMNS, true)
992 -  options.set(TablesExtension.HEADER_SEPARATOR_COLUMN_MATCH, true)
993 -  // GFM anchor links
994 -  options.set(AnchorLinkExtension.ANCHORLINKS_SET_ID, false)
995 -  options.set(AnchorLinkExtension.ANCHORLINKS_ANCHOR_CLASS, "anchor")
996 -  options.set(AnchorLinkExtension.ANCHORLINKS_SET_NAME, true)
997 -  options.set(AnchorLinkExtension.ANCHORLINKS_TEXT_PREFIX, "<span class=\"octicon octicon-link\"></span>")
998 -
999 -  Parser parser = Parser.builder(options).build()
1000 -  HtmlRenderer renderer = HtmlRenderer.builder(options).build()
1001 -
1002 -  mdFiles.each { mdFile ->
1003 -    // add table of contents
1004 -    def mdText = "[TOC]\n"+mdFile.text
1005 -
1006 -    // grab the first top-level title
1007 -    def title = null
1008 -    def titleRegex = /(?m)^#(\s+|([^#]))(.*)/
1009 -    def matcher = mdText =~ titleRegex
1010 -    if (matcher.size() > 0) {
1011 -      // matcher[0][2] is the first character of the title if there wasn't any whitespace after the #
1012 -      title = (matcher[0][2] != null ? matcher[0][2] : "")+matcher[0][3]
1013 -    }
1014 -    // or use the filename if none found
1015 -    if (title == null) {
1016 -      title = mdFile.getName()
1017 -    }
1018 -
1019 -    Node document = parser.parse(mdText)
1020 -    String htmlBody = renderer.render(document)
1021 -    def htmlText = '''<html>
1022 -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
1023 -<html xmlns="http://www.w3.org/1999/xhtml">
1024 -  <head>
1025 -    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1026 -    <meta http-equiv="Content-Style-Type" content="text/css" />
1027 -    <meta name="generator" content="flexmark" />
1028 -'''
1029 -    htmlText += ((title != null) ? "  <title>${title}</title>" : '' )
1030 -    htmlText += '''
1031 -    <style type="text/css">code{white-space: pre;}</style>
1032 -'''
1033 -    htmlText += ((cssFile != null) ? cssFile.text : '')
1034 -    htmlText += '''</head>
1035 -  <body>
1036 -'''
1037 -    htmlText += htmlBody
1038 -    htmlText += '''
1039 -  </body>
1040 -</html>
1041 -'''
1042 -
1043 -    def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html")
1044 -    def htmlFile = file(htmlFilePath)
1045 -    println("Creating ${htmlFilePath}")
1046 -    htmlFile.text = htmlText
1047 -  }
1048 -}
1049 -
1050 -
1051  task copyDocs(type: Copy) {
1052    def inputDir = "${jalviewDir}/${doc_dir}"
1053    def outputDir = "${docBuildDir}/${doc_dir}"
1054 @@ -1140,27 +266,6 @@
1055  }
1056  
1057  
1058 -task convertMdFiles {
1059 -  dependsOn copyDocs
1060 -  def mdFiles = fileTree(dir: docBuildDir, include: "**/*.md")
1061 -  def cssFile = file("${jalviewDir}/${flexmark_css}")
1062 -
1063 -  doLast {
1064 -    convertMdToHtml(mdFiles, cssFile)
1065 -  }
1066 -
1067 -  inputs.files(mdFiles)
1068 -  inputs.file(cssFile)
1069 -
1070 -  def htmlFiles = []
1071 -  mdFiles.each { mdFile ->
1072 -    def htmlFilePath = mdFile.getPath().replaceAll(/\..*?$/, ".html")
1073 -    htmlFiles.add(file(htmlFilePath))
1074 -  }
1075 -  outputs.files(htmlFiles)
1076 -}
1077 -
1078 -
1079  task copyHelp(type: Copy) {
1080    def inputDir = helpSourceDir
1081    def outputDir = "${helpBuildDir}/${help_dir}"
1082 @@ -1242,24 +347,15 @@
1083    outputs.dir(outputDir)
1084  }
1085  
1086 -task createBuildProperties(type: WriteProperties) {
1087 -  dependsOn copyResources
1088 -  group = "build"
1089 -  description = "Create the ${buildProperties} file"
1090 -  
1091 -  inputs.dir(sourceDir)
1092 -  inputs.dir(resourcesBuildDir)
1093 -  outputFile (buildProperties)
1094 -  // taking time specific comment out to allow better incremental builds
1095 -  comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd HH:mm:ss")
1096 -  //comment "--Jalview Build Details--\n"+getDate("yyyy-MM-dd")
1097 -  property "BUILD_DATE", getDate("HH:mm:ss dd MMMM yyyy")
1098 -  property "VERSION", JALVIEW_VERSION
1099 -  property "INSTALLATION", INSTALLATION+" git-commit:"+gitHash+" ["+gitBranch+"]"
1100 -  if (getdownSetAppBaseProperty) {
1101 -    property "GETDOWNAPPBASE", getdownAppBase
1102 -    property "GETDOWNAPPDISTDIR", getdownAppDistDir
1103 -  }
1104 +task createBuildProperties(type: Copy) {
1105 +  // using the build_properties already included in the source tarball
1106 +  def inputFile = "build_properties"
1107 +  def outputFile = buildProperties
1108 +  from inputFile
1109 +  into file(outputFile).getParent()
1110 +  rename(file(inputFile).getName(), file(outputFile).getName())
1111 +
1112 +  inputs.file(inputFile)
1113    outputs.file(outputFile)
1114  }
1115  
1116 @@ -1293,7 +389,6 @@
1117    dependsOn buildResources
1118    dependsOn copyDocs
1119    dependsOn copyHelp
1120 -  dependsOn convertMdFiles
1121    dependsOn buildIndices
1122  }
1123  
1124 @@ -1306,12 +401,7 @@
1125  //testReportDirName = "test-reports" // note that test workingDir will be $jalviewDir
1126  test {
1127    dependsOn prepare
1128 -
1129 -  if (useClover) {
1130 -    dependsOn cloverClasses
1131 -   } else { //?
1132 -    dependsOn compileJava //?
1133 -  }
1134 +  dependsOn compileJava //?
1135  
1136    useTestNG() {
1137      includeGroups testng_groups
1138 @@ -1323,6 +413,7 @@
1139    maxHeapSize = "1024m"
1140  
1141    workingDir = jalviewDir
1142 +  //systemProperties 'clover.jar' System.properties.clover.jar
1143    def testLaf = project.findProperty("test_laf")
1144    if (testLaf != null) {
1145      println("Setting Test LaF to '${testLaf}'")
1146 @@ -1338,9 +429,6 @@
1147    jvmArgs += additional_compiler_args
1148  
1149    doFirst {
1150 -    if (useClover) {
1151 -      println("Running tests " + (useClover?"WITH":"WITHOUT") + " clover")
1152 -    }
1153    }
1154  }
1155  
1156 @@ -1420,1752 +508,7 @@
1157    sourceSets.main.resources.srcDirs.each{ dir ->
1158      inputs.dir(dir)
1159    }
1160 -  outputs.file("${outputDir}/${archiveFileName}")
1161 -}
1162 -
1163 -
1164 -task copyJars(type: Copy) {
1165 -  from fileTree(dir: classesDir, include: "**/*.jar").files
1166 -  into "${jalviewDir}/${package_dir}"
1167 -}
1168 -
1169 -
1170 -// doing a Sync instead of Copy as Copy doesn't deal with "outputs" very well
1171 -task syncJars(type: Sync) {
1172 -  dependsOn jar
1173 -  from fileTree(dir: "${jalviewDir}/${libDistDir}", include: "**/*.jar").files
1174 -  into "${jalviewDir}/${package_dir}"
1175 -  preserve {
1176 -    include jar.archiveFileName.getOrNull()
1177 -  }
1178 -}
1179 -
1180 -
1181 -task makeDist {
1182 -  group = "build"
1183 -  description = "Put all required libraries in dist"
1184 -  // order of "cleanPackageDir", "copyJars", "jar" important!
1185 -  jar.mustRunAfter cleanPackageDir
1186 -  syncJars.mustRunAfter cleanPackageDir
1187 -  dependsOn cleanPackageDir
1188 -  dependsOn syncJars
1189 -  dependsOn jar
1190 -  outputs.dir("${jalviewDir}/${package_dir}")
1191 -}
1192 -
1193 -
1194 -task cleanDist {
1195 -  dependsOn cleanPackageDir
1196 -  dependsOn cleanTest
1197 -  dependsOn clean
1198 -}
1199 -
1200 -
1201 -shadowJar {
1202 -  group = "distribution"
1203 -  description = "Create a single jar file with all dependency libraries merged. Can be run with java -jar"
1204 -  if (buildDist) {
1205 -    dependsOn makeDist
1206 -  }
1207 -  from ("${jalviewDir}/${libDistDir}") {
1208 -    include("*.jar")
1209 -  }
1210 -  manifest {
1211 -    attributes "Implementation-Version": JALVIEW_VERSION,
1212 -    "Application-Name": install4jApplicationName
1213 -  }
1214 -  mainClassName = shadow_jar_main_class
1215 -  mergeServiceFiles()
1216 -  classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
1217 -  minimize()
1218 -}
1219 -
1220 -
1221 -task getdownWebsite() {
1222 -  group = "distribution"
1223 -  description = "Create the getdown minimal app folder, and website folder for this version of jalview. Website folder also used for offline app installer"
1224 -  if (buildDist) {
1225 -    dependsOn makeDist
1226 -  }
1227 -
1228 -  def getdownWebsiteResourceFilenames = []
1229 -  def getdownTextString = ""
1230 -  def getdownResourceDir = getdownResourceDir
1231 -  def getdownResourceFilenames = []
1232 -
1233 -  doFirst {
1234 -    // clean the getdown website and files dir before creating getdown folders
1235 -    delete getdownWebsiteDir
1236 -    delete getdownFilesDir
1237 -
1238 -    copy {
1239 -      from buildProperties
1240 -      rename(file(buildProperties).getName(), getdown_build_properties)
1241 -      into getdownAppDir
1242 -    }
1243 -    getdownWebsiteResourceFilenames += "${getdownAppDistDir}/${getdown_build_properties}"
1244 -
1245 -    // set some getdown_txt_ properties then go through all properties looking for getdown_txt_...
1246 -    def props = project.properties.sort { it.key }
1247 -    if (getdownAltJavaMinVersion != null && getdownAltJavaMinVersion.length() > 0) {
1248 -      props.put("getdown_txt_java_min_version", getdownAltJavaMinVersion)
1249 -    }
1250 -    if (getdownAltJavaMaxVersion != null && getdownAltJavaMaxVersion.length() > 0) {
1251 -      props.put("getdown_txt_java_max_version", getdownAltJavaMaxVersion)
1252 -    }
1253 -    if (getdownAltMultiJavaLocation != null && getdownAltMultiJavaLocation.length() > 0) {
1254 -      props.put("getdown_txt_multi_java_location", getdownAltMultiJavaLocation)
1255 -    }
1256 -    if (getdownImagesDir != null && file(getdownImagesDir).exists()) {
1257 -      props.put("getdown_txt_ui.background_image", "${getdownImagesDir}/${getdown_background_image}")
1258 -      props.put("getdown_txt_ui.instant_background_image", "${getdownImagesDir}/${getdown_instant_background_image}")
1259 -      props.put("getdown_txt_ui.error_background", "${getdownImagesDir}/${getdown_error_background}")
1260 -      props.put("getdown_txt_ui.progress_image", "${getdownImagesDir}/${getdown_progress_image}")
1261 -      props.put("getdown_txt_ui.icon", "${getdownImagesDir}/${getdown_icon}")
1262 -      props.put("getdown_txt_ui.mac_dock_icon", "${getdownImagesDir}/${getdown_mac_dock_icon}")
1263 -    }
1264 -
1265 -    props.put("getdown_txt_title", jalview_name)
1266 -    props.put("getdown_txt_ui.name", install4jApplicationName)
1267 -
1268 -    // start with appbase
1269 -    getdownTextString += "appbase = ${getdownAppBase}\n"
1270 -    props.each{ prop, val ->
1271 -      if (prop.startsWith("getdown_txt_") && val != null) {
1272 -        if (prop.startsWith("getdown_txt_multi_")) {
1273 -          def key = prop.substring(18)
1274 -          val.split(",").each{ v ->
1275 -            def line = "${key} = ${v}\n"
1276 -            getdownTextString += line
1277 -          }
1278 -        } else {
1279 -          // file values rationalised
1280 -          if (val.indexOf('/') > -1 || prop.startsWith("getdown_txt_resource")) {
1281 -            def r = null
1282 -            if (val.indexOf('/') == 0) {
1283 -              // absolute path
1284 -              r = file(val)
1285 -            } else if (val.indexOf('/') > 0) {
1286 -              // relative path (relative to jalviewDir)
1287 -              r = file( "${jalviewDir}/${val}" )
1288 -            }
1289 -            if (r.exists()) {
1290 -              val = "${getdown_resource_dir}/" + r.getName()
1291 -              getdownWebsiteResourceFilenames += val
1292 -              getdownResourceFilenames += r.getPath()
1293 -            }
1294 -          }
1295 -          if (! prop.startsWith("getdown_txt_resource")) {
1296 -            def line = prop.substring(12) + " = ${val}\n"
1297 -            getdownTextString += line
1298 -          }
1299 -        }
1300 -      }
1301 -    }
1302 -
1303 -    getdownWebsiteResourceFilenames.each{ filename ->
1304 -      getdownTextString += "resource = ${filename}\n"
1305 -    }
1306 -    getdownResourceFilenames.each{ filename ->
1307 -      copy {
1308 -        from filename
1309 -        into getdownResourceDir
1310 -      }
1311 -    }
1312 -    
1313 -    def getdownWrapperScripts = [ getdown_bash_wrapper_script, getdown_powershell_wrapper_script, getdown_batch_wrapper_script ]
1314 -    getdownWrapperScripts.each{ script ->
1315 -      def s = file( "${jalviewDir}/utils/getdown/${getdown_wrapper_script_dir}/${script}" )
1316 -      if (s.exists()) {
1317 -        copy {
1318 -          from s
1319 -          into "${getdownWebsiteDir}/${getdown_wrapper_script_dir}"
1320 -        }
1321 -        getdownTextString += "resource = ${getdown_wrapper_script_dir}/${script}\n"
1322 -      }
1323 -    }
1324 -
1325 -    def codeFiles = []
1326 -    fileTree(file(package_dir)).each{ f ->
1327 -      if (f.isDirectory()) {
1328 -        def files = fileTree(dir: f, include: ["*"]).getFiles()
1329 -        codeFiles += files
1330 -      } else if (f.exists()) {
1331 -        codeFiles += f
1332 -      }
1333 -    }
1334 -    codeFiles.sort().each{f ->
1335 -      def name = f.getName()
1336 -      def line = "code = ${getdownAppDistDir}/${name}\n"
1337 -      getdownTextString += line
1338 -      copy {
1339 -        from f.getPath()
1340 -        into getdownAppDir
1341 -      }
1342 -    }
1343 -
1344 -    // NOT USING MODULES YET, EVERYTHING SHOULD BE IN dist
1345 -    /*
1346 -    if (JAVA_VERSION.equals("11")) {
1347 -    def j11libFiles = fileTree(dir: "${jalviewDir}/${j11libDir}", include: ["*.jar"]).getFiles()
1348 -    j11libFiles.sort().each{f ->
1349 -    def name = f.getName()
1350 -    def line = "code = ${getdown_j11lib_dir}/${name}\n"
1351 -    getdownTextString += line
1352 -    copy {
1353 -    from f.getPath()
1354 -    into getdownJ11libDir
1355 -    }
1356 -    }
1357 -    }
1358 -     */
1359 -
1360 -    // 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.
1361 -    //getdownTextString += "class = " + file(getdownLauncher).getName() + "\n"
1362 -    getdownTextString += "resource = ${getdown_launcher_new}\n"
1363 -    getdownTextString += "class = ${main_class}\n"
1364 -    // Not setting these properties in general so that getdownappbase and getdowndistdir will default to release version in jalview.bin.Cache
1365 -    if (getdownSetAppBaseProperty) {
1366 -      getdownTextString += "jvmarg = -Dgetdowndistdir=${getdownAppDistDir}\n"
1367 -      getdownTextString += "jvmarg = -Dgetdownappbase=${getdownAppBase}\n"
1368 -    }
1369 -
1370 -    def getdown_txt = file("${getdownWebsiteDir}/getdown.txt")
1371 -    getdown_txt.write(getdownTextString)
1372 -
1373 -    def getdownLaunchJvl = getdown_launch_jvl_name + ( (jvlChannelName != null && jvlChannelName.length() > 0)?"-${jvlChannelName}":"" ) + ".jvl"
1374 -    def launchJvl = file("${getdownWebsiteDir}/${getdownLaunchJvl}")
1375 -    launchJvl.write("appbase=${getdownAppBase}")
1376 -
1377 -    // files going into the getdown website dir: getdown-launcher.jar
1378 -    copy {
1379 -      from getdownLauncher
1380 -      rename(file(getdownLauncher).getName(), getdown_launcher_new)
1381 -      into getdownWebsiteDir
1382 -    }
1383 -
1384 -    // files going into the getdown website dir: getdown-launcher(-local).jar
1385 -    copy {
1386 -      from getdownLauncher
1387 -      if (file(getdownLauncher).getName() != getdown_launcher) {
1388 -        rename(file(getdownLauncher).getName(), getdown_launcher)
1389 -      }
1390 -      into getdownWebsiteDir
1391 -    }
1392 -
1393 -    // files going into the getdown website dir: ./install dir and files
1394 -    if (! (CHANNEL.startsWith("ARCHIVE") || CHANNEL.startsWith("DEVELOP"))) {
1395 -      copy {
1396 -        from getdown_txt
1397 -        from getdownLauncher
1398 -        from "${getdownAppDir}/${getdown_build_properties}"
1399 -        if (file(getdownLauncher).getName() != getdown_launcher) {
1400 -          rename(file(getdownLauncher).getName(), getdown_launcher)
1401 -        }
1402 -        into getdownInstallDir
1403 -      }
1404 -
1405 -      // and make a copy in the getdown files dir (these are not downloaded by getdown)
1406 -      copy {
1407 -        from getdownInstallDir
1408 -        into getdownFilesInstallDir
1409 -      }
1410 -    }
1411 -
1412 -    // files going into the getdown files dir: getdown.txt, getdown-launcher.jar, channel-launch.jvl, build_properties
1413 -    copy {
1414 -      from getdown_txt
1415 -      from launchJvl
1416 -      from getdownLauncher
1417 -      from "${getdownWebsiteDir}/${getdown_build_properties}"
1418 -      if (file(getdownLauncher).getName() != getdown_launcher) {
1419 -        rename(file(getdownLauncher).getName(), getdown_launcher)
1420 -      }
1421 -      into getdownFilesDir
1422 -    }
1423 -
1424 -    // and ./resources (not all downloaded by getdown)
1425 -    copy {
1426 -      from getdownResourceDir
1427 -      into "${getdownFilesDir}/${getdown_resource_dir}"
1428 -    }
1429 -  }
1430 -
1431 -  if (buildDist) {
1432 -    inputs.dir("${jalviewDir}/${package_dir}")
1433 -  }
1434 -  outputs.dir(getdownWebsiteDir)
1435 -  outputs.dir(getdownFilesDir)
1436 -}
1437 -
1438 -
1439 -// a helper task to allow getdown digest of any dir: `gradle getdownDigestDir -PDIGESTDIR=/path/to/my/random/getdown/dir
1440 -task getdownDigestDir(type: JavaExec) {
1441 -  group "Help"
1442 -  description "A task to run a getdown Digest on a dir with getdown.txt. Provide a DIGESTDIR property via -PDIGESTDIR=..."
1443 -
1444 -  def digestDirPropertyName = "DIGESTDIR"
1445 -  doFirst {
1446 -    classpath = files(getdownLauncher)
1447 -    def digestDir = findProperty(digestDirPropertyName)
1448 -    if (digestDir == null) {
1449 -      throw new GradleException("Must provide a DIGESTDIR value to produce an alternative getdown digest")
1450 -    }
1451 -    args digestDir
1452 -  }
1453 -  main = "com.threerings.getdown.tools.Digester"
1454 -}
1455 -
1456 -
1457 -task getdownDigest(type: JavaExec) {
1458 -  group = "distribution"
1459 -  description = "Digest the getdown website folder"
1460 -  dependsOn getdownWebsite
1461 -  doFirst {
1462 -    classpath = files(getdownLauncher)
1463 -  }
1464 -  main = "com.threerings.getdown.tools.Digester"
1465 -  args getdownWebsiteDir
1466 -  inputs.dir(getdownWebsiteDir)
1467 -  outputs.file("${getdownWebsiteDir}/digest2.txt")
1468 -}
1469 -
1470 -
1471 -task getdown() {
1472 -  group = "distribution"
1473 -  description = "Create the minimal and full getdown app folder for installers and website and create digest file"
1474 -  dependsOn getdownDigest
1475 -  doLast {
1476 -    if (reportRsyncCommand) {
1477 -      def fromDir = getdownWebsiteDir + (getdownWebsiteDir.endsWith('/')?'':'/')
1478 -      def toDir = "${getdown_rsync_dest}/${getdownDir}" + (getdownDir.endsWith('/')?'':'/')
1479 -      println "LIKELY RSYNC COMMAND:"
1480 -      println "mkdir -p '$toDir'\nrsync -avh --delete '$fromDir' '$toDir'"
1481 -      if (RUNRSYNC == "true") {
1482 -        exec {
1483 -          commandLine "mkdir", "-p", toDir
1484 -        }
1485 -        exec {
1486 -          commandLine "rsync", "-avh", "--delete", fromDir, toDir
1487 -        }
1488 -      }
1489 -    }
1490 -  }
1491 -}
1492 -
1493 -
1494 -tasks.withType(JavaCompile) {
1495 -       options.encoding = 'UTF-8'
1496 -}
1497 -
1498 -
1499 -clean {
1500 -  doFirst {
1501 -    delete getdownWebsiteDir
1502 -    delete getdownFilesDir
1503 -  }
1504 -}
1505 -
1506 -
1507 -install4j {
1508 -  if (file(install4jHomeDir).exists()) {
1509 -    // good to go!
1510 -  } else if (file(System.getProperty("user.home")+"/buildtools/install4j").exists()) {
1511 -    install4jHomeDir = System.getProperty("user.home")+"/buildtools/install4j"
1512 -  } else if (file("/Applications/install4j.app/Contents/Resources/app").exists()) {
1513 -    install4jHomeDir = "/Applications/install4j.app/Contents/Resources/app"
1514 -  }
1515 -  installDir(file(install4jHomeDir))
1516 -
1517 -  mediaTypes = Arrays.asList(install4j_media_types.split(","))
1518 -}
1519 -
1520 -
1521 -task copyInstall4jTemplate {
1522 -  def install4jTemplateFile = file("${install4jDir}/${install4j_template}")
1523 -  def install4jFileAssociationsFile = file("${install4jDir}/${install4j_installer_file_associations}")
1524 -  inputs.file(install4jTemplateFile)
1525 -  inputs.file(install4jFileAssociationsFile)
1526 -  inputs.property("CHANNEL", { CHANNEL })
1527 -  outputs.file(install4jConfFile)
1528 -
1529 -  doLast {
1530 -    def install4jConfigXml = new XmlParser().parse(install4jTemplateFile)
1531 -
1532 -    // turn off code signing if no OSX_KEYPASS
1533 -    if (OSX_KEYPASS == "") {
1534 -      install4jConfigXml.'**'.codeSigning.each { codeSigning ->
1535 -        codeSigning.'@macEnabled' = "false"
1536 -      }
1537 -      install4jConfigXml.'**'.windows.each { windows ->
1538 -        windows.'@runPostProcessor' = "false"
1539 -      }
1540 -    }
1541 -
1542 -    // turn off checksum creation for LOCAL channel
1543 -    def e = install4jConfigXml.application[0]
1544 -    if (CHANNEL == "LOCAL") {
1545 -      e.'@createChecksums' = "false"
1546 -    } else {
1547 -      e.'@createChecksums' = "true"
1548 -    }
1549 -
1550 -    // put file association actions where placeholder action is
1551 -    def install4jFileAssociationsText = install4jFileAssociationsFile.text
1552 -    def fileAssociationActions = new XmlParser().parseText("<actions>${install4jFileAssociationsText}</actions>")
1553 -    install4jConfigXml.'**'.action.any { a -> // .any{} stops after the first one that returns true
1554 -      if (a.'@name' == 'EXTENSIONS_REPLACED_BY_GRADLE') {
1555 -        def parent = a.parent()
1556 -        parent.remove(a)
1557 -        fileAssociationActions.each { faa ->
1558 -            parent.append(faa)
1559 -        }
1560 -        // don't need to continue in .any loop once replacements have been made
1561 -        return true
1562 -      }
1563 -    }
1564 -
1565 -    // use Windows Program Group with Examples folder for RELEASE, and Program Group without Examples for everything else
1566 -    // NB we're deleting the /other/ one!
1567 -    // Also remove the examples subdir from non-release versions
1568 -    def customizedIdToDelete = "PROGRAM_GROUP_RELEASE"
1569 -    // 2.11.1.0 NOT releasing with the Examples folder in the Program Group
1570 -    if (false && CHANNEL=="RELEASE") { // remove 'false && ' to include Examples folder in RELEASE channel
1571 -      customizedIdToDelete = "PROGRAM_GROUP_NON_RELEASE"
1572 -    } else {
1573 -      // remove the examples subdir from Full File Set
1574 -      def files = install4jConfigXml.files[0]
1575 -      def fileset = files.filesets.fileset.find { fs -> fs.'@customizedId' == "FULL_FILE_SET" }
1576 -      def root = files.roots.root.find { r -> r.'@fileset' == fileset.'@id' }
1577 -      def mountPoint = files.mountPoints.mountPoint.find { mp -> mp.'@root' == root.'@id' }
1578 -      def dirEntry = files.entries.dirEntry.find { de -> de.'@mountPoint' == mountPoint.'@id' && de.'@subDirectory' == "examples" }
1579 -      dirEntry.parent().remove(dirEntry)
1580 -    }
1581 -    install4jConfigXml.'**'.action.any { a ->
1582 -      if (a.'@customizedId' == customizedIdToDelete) {
1583 -        def parent = a.parent()
1584 -        parent.remove(a)
1585 -        return true
1586 -      }
1587 -    }
1588 -
1589 -    // write install4j file
1590 -    install4jConfFile.text = XmlUtil.serialize(install4jConfigXml)
1591 -  }
1592 -}
1593 -
1594 -
1595 -clean {
1596 -  doFirst {
1597 -    delete install4jConfFile
1598 -  }
1599 -}
1600 -
1601 -
1602 -task installers(type: com.install4j.gradle.Install4jTask) {
1603 -  group = "distribution"
1604 -  description = "Create the install4j installers"
1605 -  dependsOn getdown
1606 -  dependsOn copyInstall4jTemplate
1607 -
1608 -  projectFile = install4jConfFile
1609 -
1610 -  // create an md5 for the input files to use as version for install4j conf file
1611 -  def digest = MessageDigest.getInstance("MD5")
1612 -  digest.update(
1613 -    (file("${install4jDir}/${install4j_template}").text + 
1614 -    file("${install4jDir}/${install4j_info_plist_file_associations}").text +
1615 -    file("${install4jDir}/${install4j_installer_file_associations}").text).bytes)
1616 -  def filesMd5 = new BigInteger(1, digest.digest()).toString(16)
1617 -  if (filesMd5.length() >= 8) {
1618 -    filesMd5 = filesMd5.substring(0,8)
1619 -  }
1620 -  def install4jTemplateVersion = "${JALVIEW_VERSION}_F${filesMd5}_C${gitHash}"
1621 -  // make install4jBuildDir relative to jalviewDir
1622 -  def install4jBuildDir = "${install4j_build_dir}/${JAVA_VERSION}"
1623 -
1624 -  variables = [
1625 -    'JALVIEW_NAME': jalview_name,
1626 -    'JALVIEW_APPLICATION_NAME': install4jApplicationName,
1627 -    'JALVIEW_DIR': "../..",
1628 -    'OSX_KEYSTORE': OSX_KEYSTORE,
1629 -    'OSX_APPLEID': OSX_APPLEID,
1630 -    'OSX_ALTOOLPASS': OSX_ALTOOLPASS,
1631 -    'JSIGN_SH': JSIGN_SH,
1632 -    'JRE_DIR': getdown_app_dir_java,
1633 -    'INSTALLER_TEMPLATE_VERSION': install4jTemplateVersion,
1634 -    'JALVIEW_VERSION': JALVIEW_VERSION,
1635 -    'JAVA_MIN_VERSION': JAVA_MIN_VERSION,
1636 -    'JAVA_MAX_VERSION': JAVA_MAX_VERSION,
1637 -    'JAVA_VERSION': JAVA_VERSION,
1638 -    'JAVA_INTEGER_VERSION': JAVA_INTEGER_VERSION,
1639 -    'VERSION': JALVIEW_VERSION,
1640 -    'MACOS_JAVA_VM_DIR': macosJavaVMDir,
1641 -    'WINDOWS_JAVA_VM_DIR': windowsJavaVMDir,
1642 -    'LINUX_JAVA_VM_DIR': linuxJavaVMDir,
1643 -    'MACOS_JAVA_VM_TGZ': macosJavaVMTgz,
1644 -    'WINDOWS_JAVA_VM_TGZ': windowsJavaVMTgz,
1645 -    'LINUX_JAVA_VM_TGZ': linuxJavaVMTgz,
1646 -    'COPYRIGHT_MESSAGE': install4j_copyright_message,
1647 -    'BUNDLE_ID': install4jBundleId,
1648 -    'INTERNAL_ID': install4jInternalId,
1649 -    'WINDOWS_APPLICATION_ID': install4jWinApplicationId,
1650 -    'MACOS_DMG_DS_STORE': install4jDMGDSStore,
1651 -    'MACOS_DMG_BG_IMAGE': install4jDMGBackgroundImage,
1652 -    'WRAPPER_LINK': getdownWrapperLink,
1653 -    'BASH_WRAPPER_SCRIPT': getdown_bash_wrapper_script,
1654 -    'POWERSHELL_WRAPPER_SCRIPT': getdown_powershell_wrapper_script,
1655 -    'WRAPPER_SCRIPT_BIN_DIR': getdown_wrapper_script_dir,
1656 -    'INSTALLER_NAME': install4jInstallerName,
1657 -    'INSTALL4J_UTILS_DIR': install4j_utils_dir,
1658 -    'GETDOWN_WEBSITE_DIR': getdown_website_dir,
1659 -    'GETDOWN_FILES_DIR': getdown_files_dir,
1660 -    'GETDOWN_RESOURCE_DIR': getdown_resource_dir,
1661 -    'GETDOWN_DIST_DIR': getdownAppDistDir,
1662 -    'GETDOWN_ALT_DIR': getdown_app_dir_alt,
1663 -    'GETDOWN_INSTALL_DIR': getdown_install_dir,
1664 -    'INFO_PLIST_FILE_ASSOCIATIONS_FILE': install4j_info_plist_file_associations,
1665 -    'BUILD_DIR': install4jBuildDir,
1666 -    'APPLICATION_CATEGORIES': install4j_application_categories,
1667 -    'APPLICATION_FOLDER': install4jApplicationFolder,
1668 -    'UNIX_APPLICATION_FOLDER': install4jUnixApplicationFolder,
1669 -    'EXECUTABLE_NAME': install4jExecutableName,
1670 -    'EXTRA_SCHEME': install4jExtraScheme,
1671 -    'MAC_ICONS_FILE': install4jMacIconsFile,
1672 -    'WINDOWS_ICONS_FILE': install4jWindowsIconsFile,
1673 -    'PNG_ICON_FILE': install4jPngIconFile,
1674 -    'BACKGROUND': install4jBackground,
1675 -
1676 -  ]
1677 -
1678 -  //println("INSTALL4J VARIABLES:")
1679 -  //variables.each{k,v->println("${k}=${v}")}
1680 -
1681 -  destination = "${jalviewDir}/${install4jBuildDir}"
1682 -  buildSelected = true
1683 -
1684 -  if (install4j_faster.equals("true") || CHANNEL.startsWith("LOCAL")) {
1685 -    faster = true
1686 -    disableSigning = true
1687 -    disableNotarization = true
1688 -  }
1689 -
1690 -  if (OSX_KEYPASS) {
1691 -    macKeystorePassword = OSX_KEYPASS
1692 -  } 
1693 -  
1694 -  if (OSX_ALTOOLPASS) {
1695 -    appleIdPassword = OSX_ALTOOLPASS
1696 -    disableNotarization = false
1697 -  } else {
1698 -    disableNotarization = true
1699 -  }
1700 -
1701 -  doFirst {
1702 -    println("Using projectFile "+projectFile)
1703 -    if (!disableNotarization) { println("Will notarize OSX App DMG") }
1704 -  }
1705 -  //verbose=true
1706 -
1707 -  inputs.dir(getdownWebsiteDir)
1708 -  inputs.file(install4jConfFile)
1709 -  inputs.file("${install4jDir}/${install4j_info_plist_file_associations}")
1710 -  inputs.dir(macosJavaVMDir)
1711 -  inputs.dir(windowsJavaVMDir)
1712 -  outputs.dir("${jalviewDir}/${install4j_build_dir}/${JAVA_VERSION}")
1713 -}
1714 -
1715 -
1716 -spotless {
1717 -  java {
1718 -    eclipse().configFile(eclipse_codestyle_file)
1719 -  }
1720 -}
1721 -
1722 -
1723 -task sourceDist(type: Tar) {
1724 -  group "distribution"
1725 -  description "Create a source .tar.gz file for distribution"
1726 -
1727 -  dependsOn createBuildProperties
1728 -  dependsOn convertMdFiles
1729 -
1730 -  def VERSION_UNDERSCORES = JALVIEW_VERSION.replaceAll("\\.", "_")
1731 -  def outputFileName = "${project.name}_${VERSION_UNDERSCORES}.tar.gz"
1732 -  archiveFileName = outputFileName
1733 -  
1734 -  compression Compression.GZIP
1735 -  
1736 -  into project.name
1737 -
1738 -  def EXCLUDE_FILES=[
1739 -    "build/*",
1740 -    "bin/*",
1741 -    "test-output/",
1742 -    "test-reports",
1743 -    "tests",
1744 -    "clover*/*",
1745 -    ".*",
1746 -    "benchmarking/*",
1747 -    "**/.*",
1748 -    "*.class",
1749 -    "**/*.class","$j11modDir/**/*.jar","appletlib","**/*locales",
1750 -    "*locales/**",
1751 -    "utils/InstallAnywhere",
1752 -    "**/*.log",
1753 -  ] 
1754 -  def PROCESS_FILES=[
1755 -    "AUTHORS",
1756 -    "CITATION",
1757 -    "FEATURETODO",
1758 -    "JAVA-11-README",
1759 -    "FEATURETODO",
1760 -    "LICENSE",
1761 -    "**/README",
1762 -    "RELEASE",
1763 -    "THIRDPARTYLIBS",
1764 -    "TESTNG",
1765 -    "build.gradle",
1766 -    "gradle.properties",
1767 -    "**/*.java",
1768 -    "**/*.html",
1769 -    "**/*.xml",
1770 -    "**/*.gradle",
1771 -    "**/*.groovy",
1772 -    "**/*.properties",
1773 -    "**/*.perl",
1774 -    "**/*.sh",
1775 -  ]
1776 -  def INCLUDE_FILES=[
1777 -    ".settings/org.eclipse.jdt.core.jalview.prefs",
1778 -  ]
1779 -
1780 -  from(jalviewDir) {
1781 -    exclude (EXCLUDE_FILES)
1782 -    include (PROCESS_FILES)
1783 -    filter(ReplaceTokens,
1784 -      beginToken: '$$',
1785 -      endToken: '$$',
1786 -      tokens: [
1787 -        'Version-Rel': JALVIEW_VERSION,
1788 -        'Year-Rel': getDate("yyyy")
1789 -      ]
1790 -    )
1791 -  }
1792 -  from(jalviewDir) {
1793 -    exclude (EXCLUDE_FILES)
1794 -    exclude (PROCESS_FILES)
1795 -    exclude ("appletlib")
1796 -    exclude ("**/*locales")
1797 -    exclude ("*locales/**")
1798 -    exclude ("utils/InstallAnywhere")
1799 -
1800 -    exclude (getdown_files_dir)
1801 -    exclude (getdown_website_dir)
1802 -
1803 -    // exluding these as not using jars as modules yet
1804 -    exclude ("${j11modDir}/**/*.jar")
1805 -  }
1806 -  from(jalviewDir) {
1807 -    include(INCLUDE_FILES)
1808 -  }
1809 -//  from (jalviewDir) {
1810 -//    // explicit includes for stuff that seemed to not get included
1811 -//    include(fileTree("test/**/*."))
1812 -//    exclude(EXCLUDE_FILES)
1813 -//    exclude(PROCESS_FILES)
1814 -//  }
1815 -
1816 -  from(file(buildProperties).getParent()) {
1817 -    include(file(buildProperties).getName())
1818 -    rename(file(buildProperties).getName(), "build_properties")
1819 -    filter({ line ->
1820 -      line.replaceAll("^INSTALLATION=.*\$","INSTALLATION=Source Release"+" git-commit\\\\:"+gitHash+" ["+gitBranch+"]")
1821 -    })
1822 -  }
1823 -
1824 -}
1825 -
1826 -
1827 -task helppages {
1828 -  dependsOn copyHelp
1829 -  dependsOn pubhtmlhelp
1830 -  
1831 -  inputs.dir("${helpBuildDir}/${help_dir}")
1832 -  outputs.dir("${buildDir}/distributions/${help_dir}")
1833 -}
1834 -
1835 -
1836 -task j2sSetHeadlessBuild {
1837 -  doFirst {
1838 -    IN_ECLIPSE = false
1839 -  }
1840 -}
1841 -
1842 -
1843 -task jalviewjsEnableAltFileProperty(type: WriteProperties) {
1844 -  group "jalviewjs"
1845 -  description "Enable the alternative J2S Config file for headless build"
1846 -
1847 -  outputFile = jalviewjsJ2sSettingsFileName
1848 -  def j2sPropsFile = file(jalviewjsJ2sSettingsFileName)
1849 -  def j2sProps = new Properties()
1850 -  if (j2sPropsFile.exists()) {
1851 -    try {
1852 -      def j2sPropsFileFIS = new FileInputStream(j2sPropsFile)
1853 -      j2sProps.load(j2sPropsFileFIS)
1854 -      j2sPropsFileFIS.close()
1855 -
1856 -      j2sProps.each { prop, val ->
1857 -        property(prop, val)
1858 -      }
1859 -    } catch (Exception e) {
1860 -      println("Exception reading ${jalviewjsJ2sSettingsFileName}")
1861 -      e.printStackTrace()
1862 -    }
1863 -  }
1864 -  if (! j2sProps.stringPropertyNames().contains(jalviewjs_j2s_alt_file_property_config)) {
1865 -    property(jalviewjs_j2s_alt_file_property_config, jalviewjs_j2s_alt_file_property)
1866 -  }
1867 -}
1868 -
1869 -
1870 -task jalviewjsSetEclipseWorkspace {
1871 -  def propKey = "jalviewjs_eclipse_workspace"
1872 -  def propVal = null
1873 -  if (project.hasProperty(propKey)) {
1874 -    propVal = project.getProperty(propKey)
1875 -    if (propVal.startsWith("~/")) {
1876 -      propVal = System.getProperty("user.home") + propVal.substring(1)
1877 -    }
1878 -  }
1879 -  def propsFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_workspace_location_file}"
1880 -  def propsFile = file(propsFileName)
1881 -  def eclipseWsDir = propVal
1882 -  def props = new Properties()
1883 -
1884 -  def writeProps = true
1885 -  if (( eclipseWsDir == null || !file(eclipseWsDir).exists() ) && propsFile.exists()) {
1886 -    def ins = new FileInputStream(propsFileName)
1887 -    props.load(ins)
1888 -    ins.close()
1889 -    if (props.getProperty(propKey, null) != null) {
1890 -      eclipseWsDir = props.getProperty(propKey)
1891 -      writeProps = false
1892 -    }
1893 -  }
1894 -
1895 -  if (eclipseWsDir == null || !file(eclipseWsDir).exists()) {
1896 -    def tempDir = File.createTempDir()
1897 -    eclipseWsDir = tempDir.getAbsolutePath()
1898 -    writeProps = true
1899 -  }
1900 -  eclipseWorkspace = file(eclipseWsDir)
1901 -
1902 -  doFirst {
1903 -    // do not run a headless transpile when we claim to be in Eclipse
1904 -    if (IN_ECLIPSE) {
1905 -      println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1906 -      throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
1907 -    } else {
1908 -      println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1909 -    }
1910 -
1911 -    if (writeProps) {
1912 -      props.setProperty(propKey, eclipseWsDir)
1913 -      propsFile.parentFile.mkdirs()
1914 -      def bytes = new ByteArrayOutputStream()
1915 -      props.store(bytes, null)
1916 -      def propertiesString = bytes.toString()
1917 -      propsFile.text = propertiesString
1918 -      print("NEW ")
1919 -    } else {
1920 -      print("EXISTING ")
1921 -    }
1922 -
1923 -    println("ECLIPSE WORKSPACE: "+eclipseWorkspace.getPath())
1924 -  }
1925 -
1926 -  //inputs.property(propKey, eclipseWsDir) // eclipseWsDir only gets set once this task runs, so will be out-of-date
1927 -  outputs.file(propsFileName)
1928 -  outputs.upToDateWhen { eclipseWorkspace.exists() && propsFile.exists() }
1929 -}
1930 -
1931 -
1932 -task jalviewjsEclipsePaths {
1933 -  def eclipseProduct
1934 -
1935 -  def eclipseRoot = jalviewjs_eclipse_root
1936 -  if (eclipseRoot.startsWith("~/")) {
1937 -    eclipseRoot = System.getProperty("user.home") + eclipseRoot.substring(1)
1938 -  }
1939 -  if (OperatingSystem.current().isMacOsX()) {
1940 -    eclipseRoot += "/Eclipse.app"
1941 -    eclipseBinary = "${eclipseRoot}/Contents/MacOS/eclipse"
1942 -    eclipseProduct = "${eclipseRoot}/Contents/Eclipse/.eclipseproduct"
1943 -  } else if (OperatingSystem.current().isWindows()) { // check these paths!!
1944 -    if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
1945 -      eclipseRoot += "/eclipse"
1946 -    }
1947 -    eclipseBinary = "${eclipseRoot}/eclipse.exe"
1948 -    eclipseProduct = "${eclipseRoot}/.eclipseproduct"
1949 -  } else { // linux or unix
1950 -    if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) {
1951 -      eclipseRoot += "/eclipse"
1952 -println("eclipseDir exists")
1953 -    }
1954 -    eclipseBinary = "${eclipseRoot}/eclipse"
1955 -    eclipseProduct = "${eclipseRoot}/.eclipseproduct"
1956 -  }
1957 -
1958 -  eclipseVersion = "4.13" // default
1959 -  def assumedVersion = true
1960 -  if (file(eclipseProduct).exists()) {
1961 -    def fis = new FileInputStream(eclipseProduct)
1962 -    def props = new Properties()
1963 -    props.load(fis)
1964 -    eclipseVersion = props.getProperty("version")
1965 -    fis.close()
1966 -    assumedVersion = false
1967 -  }
1968 -  
1969 -  def propKey = "eclipse_debug"
1970 -  eclipseDebug = (project.hasProperty(propKey) && project.getProperty(propKey).equals("true"))
1971 -
1972 -  doFirst {
1973 -    // do not run a headless transpile when we claim to be in Eclipse
1974 -    if (IN_ECLIPSE) {
1975 -      println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1976 -      throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
1977 -    } else {
1978 -      println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
1979 -    }
1980 -
1981 -    if (!assumedVersion) {
1982 -      println("ECLIPSE VERSION=${eclipseVersion}")
1983 -    }
1984 -  }
1985 -}
1986 -
1987 -
1988 -task printProperties {
1989 -  group "Debug"
1990 -  description "Output to console all System.properties"
1991 -  doFirst {
1992 -    System.properties.each { key, val -> System.out.println("Property: ${key}=${val}") }
1993 -  }
1994 -}
1995 -
1996 -
1997 -task eclipseSetup {
1998 -  dependsOn eclipseProject
1999 -  dependsOn eclipseClasspath
2000 -  dependsOn eclipseJdt
2001 -}
2002 -
2003 -
2004 -// this version (type: Copy) will delete anything in the eclipse dropins folder that isn't in fromDropinsDir
2005 -task jalviewjsEclipseCopyDropins(type: Copy) {
2006 -  dependsOn jalviewjsEclipsePaths
2007 -
2008 -  def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_eclipse_dropins_dir}", include: "*.jar")
2009 -  inputFiles += file("${jalviewDir}/${jalviewjsJ2sPlugin}")
2010 -  def outputDir = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}"
2011 -
2012 -  from inputFiles
2013 -  into outputDir
2014 -}
2015 -
2016 -
2017 -// this eclipse -clean doesn't actually work
2018 -task jalviewjsCleanEclipse(type: Exec) {
2019 -  dependsOn eclipseSetup
2020 -  dependsOn jalviewjsEclipsePaths
2021 -  dependsOn jalviewjsEclipseCopyDropins
2022 -
2023 -  executable(eclipseBinary)
2024 -  args(["-nosplash", "--launcher.suppressErrors", "-data", eclipseWorkspace.getPath(), "-clean", "-console", "-consoleLog"])
2025 -  if (eclipseDebug) {
2026 -    args += "-debug"
2027 -  }
2028 -  args += "-l"
2029 -
2030 -  def inputString = """exit
2031 -y
2032 -"""
2033 -  def inputByteStream = new ByteArrayInputStream(inputString.getBytes())
2034 -  standardInput = inputByteStream
2035 -}
2036 -
2037 -/* not really working yet
2038 -jalviewjsEclipseCopyDropins.finalizedBy jalviewjsCleanEclipse
2039 -*/
2040 -
2041 -
2042 -task jalviewjsTransferUnzipSwingJs {
2043 -  def file_zip = "${jalviewDir}/${jalviewjs_swingjs_zip}"
2044 -
2045 -  doLast {
2046 -    copy {
2047 -      from zipTree(file_zip)
2048 -      into "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
2049 -    }
2050 -  }
2051 -
2052 -  inputs.file file_zip
2053 -  outputs.dir "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
2054 -}
2055 -
2056 -
2057 -task jalviewjsTransferUnzipLib {
2058 -  def zipFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_libjs_dir}", include: "*.zip")
2059 -
2060 -  doLast {
2061 -    zipFiles.each { file_zip -> 
2062 -      copy {
2063 -        from zipTree(file_zip)
2064 -        into "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
2065 -      }
2066 -    }
2067 -  }
2068 -
2069 -  inputs.files zipFiles
2070 -  outputs.dir "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
2071 -}
2072 -
2073 -
2074 -task jalviewjsTransferUnzipAllLibs {
2075 -  dependsOn jalviewjsTransferUnzipSwingJs
2076 -  dependsOn jalviewjsTransferUnzipLib
2077 -}
2078 -
2079 -
2080 -task jalviewjsCreateJ2sSettings(type: WriteProperties) {
2081 -  group "JalviewJS"
2082 -  description "Create the alternative j2s file from the j2s.* properties"
2083 -
2084 -  jalviewjsJ2sProps = project.properties.findAll { it.key.startsWith("j2s.") }.sort { it.key }
2085 -  def siteDirProperty = "j2s.site.directory"
2086 -  def setSiteDir = false
2087 -  jalviewjsJ2sProps.each { prop, val ->
2088 -    if (val != null) {
2089 -      if (prop == siteDirProperty) {
2090 -        if (!(val.startsWith('/') || val.startsWith("file://") )) {
2091 -          val = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${val}"
2092 -        }
2093 -        setSiteDir = true
2094 -      }
2095 -      property(prop,val)
2096 -    }
2097 -    if (!setSiteDir) { // default site location, don't override specifically set property
2098 -      property(siteDirProperty,"${jalviewDirRelativePath}/${jalviewjsTransferSiteJsDir}")
2099 -    }
2100 -  }
2101 -  outputFile = jalviewjsJ2sAltSettingsFileName
2102 -
2103 -  if (! IN_ECLIPSE) {
2104 -    inputs.properties(jalviewjsJ2sProps)
2105 -    outputs.file(jalviewjsJ2sAltSettingsFileName)
2106 -  }
2107 -}
2108 -
2109 -
2110 -task jalviewjsEclipseSetup {
2111 -  dependsOn jalviewjsEclipseCopyDropins
2112 -  dependsOn jalviewjsSetEclipseWorkspace
2113 -  dependsOn jalviewjsCreateJ2sSettings
2114 -}
2115 -
2116 -
2117 -task jalviewjsSyncAllLibs (type: Sync) {
2118 -  dependsOn jalviewjsTransferUnzipAllLibs
2119 -  def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteLibDir}")
2120 -  inputFiles += fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}")
2121 -  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
2122 -
2123 -  from inputFiles
2124 -  into outputDir
2125 -  def outputFiles = []
2126 -  rename { filename ->
2127 -    outputFiles += "${outputDir}/${filename}"
2128 -    null
2129 -  }
2130 -  preserve {
2131 -    include "**"
2132 -  }
2133 -  outputs.files outputFiles
2134 -  inputs.files inputFiles
2135 -}
2136 -
2137 -
2138 -task jalviewjsSyncResources (type: Sync) {
2139 -  dependsOn buildResources
2140 -
2141 -  def inputFiles = fileTree(dir: resourcesBuildDir)
2142 -  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
2143 -
2144 -  from inputFiles
2145 -  into outputDir
2146 -  def outputFiles = []
2147 -  rename { filename ->
2148 -    outputFiles += "${outputDir}/${filename}"
2149 -    null
2150 -  }
2151 -  preserve {
2152 -    include "**"
2153 -  }
2154 -  outputs.files outputFiles
2155 -  inputs.files inputFiles
2156 -}
2157 -
2158 -
2159 -task jalviewjsSyncSiteResources (type: Sync) {
2160 -  def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_site_resource_dir}")
2161 -  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
2162 -
2163 -  from inputFiles
2164 -  into outputDir
2165 -  def outputFiles = []
2166 -  rename { filename ->
2167 -    outputFiles += "${outputDir}/${filename}"
2168 -    null
2169 -  }
2170 -  preserve {
2171 -    include "**"
2172 -  }
2173 -  outputs.files outputFiles
2174 -  inputs.files inputFiles
2175 -}
2176 -
2177 -
2178 -task jalviewjsSyncBuildProperties (type: Sync) {
2179 -  dependsOn createBuildProperties
2180 -  def inputFiles = [file(buildProperties)]
2181 -  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}/${jalviewjs_j2s_subdir}"
2182 -
2183 -  from inputFiles
2184 -  into outputDir
2185 -  def outputFiles = []
2186 -  rename { filename ->
2187 -    outputFiles += "${outputDir}/${filename}"
2188 -    null
2189 -  }
2190 -  preserve {
2191 -    include "**"
2192 -  }
2193 -  outputs.files outputFiles
2194 -  inputs.files inputFiles
2195 -}
2196 -
2197 -
2198 -task jalviewjsProjectImport(type: Exec) {
2199 -  dependsOn eclipseSetup
2200 -  dependsOn jalviewjsEclipsePaths
2201 -  dependsOn jalviewjsEclipseSetup
2202 -
2203 -  doFirst {
2204 -    // do not run a headless import when we claim to be in Eclipse
2205 -    if (IN_ECLIPSE) {
2206 -      println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2207 -      throw new StopExecutionException("Not running headless import whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
2208 -    } else {
2209 -      println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2210 -    }
2211 -  }
2212  
2213 -  //def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview/org.eclipse.jdt.core"
2214 -  def projdir = eclipseWorkspace.getPath()+"/.metadata/.plugins/org.eclipse.core.resources/.projects/jalview"
2215 -  executable(eclipseBinary)
2216 -  args(["-nosplash", "--launcher.suppressErrors", "-application", "com.seeq.eclipse.importprojects.headlessimport", "-data", eclipseWorkspace.getPath(), "-import", jalviewDirAbsolutePath])
2217 -  if (eclipseDebug) {
2218 -    args += "-debug"
2219 -  }
2220 -  args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
2221 -  if (!IN_ECLIPSE) {
2222 -    args += [ "-D${j2sHeadlessBuildProperty}=true" ]
2223 -    args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
2224 -  }
2225 -
2226 -  inputs.file("${jalviewDir}/.project")
2227 -  outputs.upToDateWhen { 
2228 -    file(projdir).exists()
2229 -  }
2230 -}
2231 -
2232 -
2233 -task jalviewjsTranspile(type: Exec) {
2234 -  dependsOn jalviewjsEclipseSetup 
2235 -  dependsOn jalviewjsProjectImport
2236 -  dependsOn jalviewjsEclipsePaths
2237 -  if (!IN_ECLIPSE) {
2238 -    dependsOn jalviewjsEnableAltFileProperty
2239 -  }
2240 -
2241 -  doFirst {
2242 -    // do not run a headless transpile when we claim to be in Eclipse
2243 -    if (IN_ECLIPSE) {
2244 -      println("Skipping task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2245 -      throw new StopExecutionException("Not running headless transpile whilst IN_ECLIPSE is '${IN_ECLIPSE}'")
2246 -    } else {
2247 -      println("Running task ${name} as IN_ECLIPSE=${IN_ECLIPSE}")
2248 -    }
2249 -  }
2250 -
2251 -  executable(eclipseBinary)
2252 -  args(["-nosplash", "--launcher.suppressErrors", "-application", "org.eclipse.jdt.apt.core.aptBuild", "-data", eclipseWorkspace, "-${jalviewjs_eclipse_build_arg}", eclipse_project_name ])
2253 -  if (eclipseDebug) {
2254 -    args += "-debug"
2255 -  }
2256 -  args += [ "--launcher.appendVmargs", "-vmargs", "-Dorg.eclipse.equinox.p2.reconciler.dropins.directory=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" ]
2257 -  if (!IN_ECLIPSE) {
2258 -    args += [ "-D${j2sHeadlessBuildProperty}=true" ]
2259 -    args += [ "-D${jalviewjs_j2s_alt_file_property}=${jalviewjsJ2sAltSettingsFileName}" ]
2260 -  }
2261 -
2262 -  def stdout
2263 -  def stderr
2264 -  doFirst {
2265 -    stdout = new ByteArrayOutputStream()
2266 -    stderr = new ByteArrayOutputStream()
2267 -
2268 -    def logOutFileName = "${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}"
2269 -    def logOutFile = file(logOutFileName)
2270 -    logOutFile.createNewFile()
2271 -    logOutFile.text = """ROOT: ${jalviewjs_eclipse_root}
2272 -BINARY: ${eclipseBinary}
2273 -VERSION: ${eclipseVersion}
2274 -WORKSPACE: ${eclipseWorkspace}
2275 -DEBUG: ${eclipseDebug}
2276 -----
2277 -"""
2278 -    def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
2279 -    // combine stdout and stderr
2280 -    def logErrFOS = logOutFOS
2281 -
2282 -    if (jalviewjs_j2s_to_console.equals("true")) {
2283 -      standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2284 -        new org.apache.tools.ant.util.TeeOutputStream(
2285 -          logOutFOS,
2286 -          stdout),
2287 -        System.out)
2288 -      errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2289 -        new org.apache.tools.ant.util.TeeOutputStream(
2290 -          logErrFOS,
2291 -          stderr),
2292 -        System.err)
2293 -    } else {
2294 -      standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2295 -        logOutFOS,
2296 -        stdout)
2297 -      errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2298 -        logErrFOS,
2299 -        stderr)
2300 -    }
2301 -  }
2302 -
2303 -  doLast {
2304 -    if (stdout.toString().contains("Error processing ")) {
2305 -      // j2s did not complete transpile
2306 -      //throw new TaskExecutionException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2307 -      if (jalviewjs_ignore_transpile_errors.equals("true")) {
2308 -        println("IGNORING TRANSPILE ERRORS")
2309 -        println("See eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2310 -      } else {
2311 -        throw new GradleException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'")
2312 -      }
2313 -    }
2314 -  }
2315 -
2316 -  inputs.dir("${jalviewDir}/${sourceDir}")
2317 -  outputs.dir("${jalviewDir}/${jalviewjsTransferSiteJsDir}")
2318 -  outputs.upToDateWhen( { file("${jalviewDir}/${jalviewjsTransferSiteJsDir}${jalviewjs_server_resource}").exists() } )
2319 -}
2320 -
2321 -
2322 -def jalviewjsCallCore(String name, FileCollection list, String prefixFile, String suffixFile, String jsfile, String zjsfile, File logOutFile, Boolean logOutConsole) {
2323 -
2324 -  def stdout = new ByteArrayOutputStream()
2325 -  def stderr = new ByteArrayOutputStream()
2326 -
2327 -  def coreFile = file(jsfile)
2328 -  def msg = ""
2329 -  msg = "Creating core for ${name}...\nGenerating ${jsfile}"
2330 -  println(msg)
2331 -  logOutFile.createNewFile()
2332 -  logOutFile.append(msg+"\n")
2333 -
2334 -  def coreTop = file(prefixFile)
2335 -  def coreBottom = file(suffixFile)
2336 -  coreFile.getParentFile().mkdirs()
2337 -  coreFile.createNewFile()
2338 -  coreFile.write( coreTop.getText("UTF-8") )
2339 -  list.each {
2340 -    f ->
2341 -    if (f.exists()) {
2342 -      def t = f.getText("UTF-8")
2343 -      t.replaceAll("Clazz\\.([^_])","Clazz_${1}")
2344 -      coreFile.append( t )
2345 -    } else {
2346 -      msg = "...file '"+f.getPath()+"' does not exist, skipping"
2347 -      println(msg)
2348 -      logOutFile.append(msg+"\n")
2349 -    }
2350 -  }
2351 -  coreFile.append( coreBottom.getText("UTF-8") )
2352 -
2353 -  msg = "Generating ${zjsfile}"
2354 -  println(msg)
2355 -  logOutFile.append(msg+"\n")
2356 -  def logOutFOS = new FileOutputStream(logOutFile, true) // true == append
2357 -  def logErrFOS = logOutFOS
2358 -
2359 -  javaexec {
2360 -    classpath = files(["${jalviewDir}/${jalviewjs_closure_compiler}"])
2361 -    main = "com.google.javascript.jscomp.CommandLineRunner"
2362 -    jvmArgs = [ "-Dfile.encoding=UTF-8" ]
2363 -    args = [ "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--charset", "UTF-8", "--js", jsfile, "--js_output_file", zjsfile ]
2364 -    maxHeapSize = "2g"
2365 -
2366 -    msg = "\nRunning '"+commandLine.join(' ')+"'\n"
2367 -    println(msg)
2368 -    logOutFile.append(msg+"\n")
2369 -
2370 -    if (logOutConsole) {
2371 -      standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2372 -        new org.apache.tools.ant.util.TeeOutputStream(
2373 -          logOutFOS,
2374 -          stdout),
2375 -        standardOutput)
2376 -        errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2377 -          new org.apache.tools.ant.util.TeeOutputStream(
2378 -            logErrFOS,
2379 -            stderr),
2380 -          errorOutput)
2381 -    } else {
2382 -      standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
2383 -        logOutFOS,
2384 -        stdout)
2385 -        errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
2386 -          logErrFOS,
2387 -          stderr)
2388 -    }
2389 -  }
2390 -  msg = "--"
2391 -  println(msg)
2392 -  logOutFile.append(msg+"\n")
2393 -}
2394 -
2395 -
2396 -task jalviewjsBuildAllCores {
2397 -  group "JalviewJS"
2398 -  description "Build the core js lib closures listed in the classlists dir"
2399 -  dependsOn jalviewjsTranspile
2400 -  dependsOn jalviewjsTransferUnzipSwingJs
2401 -
2402 -  def j2sDir = "${jalviewDir}/${jalviewjsTransferSiteJsDir}/${jalviewjs_j2s_subdir}"
2403 -  def swingJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_j2s_subdir}"
2404 -  def libJ2sDir = "${jalviewDir}/${jalviewjsTransferSiteLibDir}/${jalviewjs_j2s_subdir}"
2405 -  def jsDir = "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}/${jalviewjs_js_subdir}"
2406 -  def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}/${jalviewjs_j2s_subdir}/core"
2407 -  def prefixFile = "${jsDir}/core/coretop2.js"
2408 -  def suffixFile = "${jsDir}/core/corebottom2.js"
2409 -
2410 -  inputs.file prefixFile
2411 -  inputs.file suffixFile
2412 -
2413 -  def classlistFiles = []
2414 -  // add the classlists found int the jalviewjs_classlists_dir
2415 -  fileTree(dir: "${jalviewDir}/${jalviewjs_classlists_dir}", include: "*.txt").each {
2416 -    file ->
2417 -    def name = file.getName() - ".txt"
2418 -    classlistFiles += [
2419 -      'file': file,
2420 -      'name': name
2421 -    ]
2422 -  }
2423 -
2424 -  // _jmol and _jalview cores. Add any other peculiar classlist.txt files here
2425 -  //classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jmol}"), 'name': "_jvjmol" ]
2426 -  classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jalview}"), 'name': jalviewjsJalviewCoreName ]
2427 -
2428 -  jalviewjsCoreClasslists = []
2429 -
2430 -  classlistFiles.each {
2431 -    hash ->
2432 -
2433 -    def file = hash['file']
2434 -    if (! file.exists()) {
2435 -      //println("...classlist file '"+file.getPath()+"' does not exist, skipping")
2436 -      return false // this is a "continue" in groovy .each closure
2437 -    }
2438 -    def name = hash['name']
2439 -    if (name == null) {
2440 -      name = file.getName() - ".txt"
2441 -    }
2442 -
2443 -    def filelist = []
2444 -    file.eachLine {
2445 -      line ->
2446 -        filelist += line
2447 -    }
2448 -    def list = fileTree(dir: j2sDir, includes: filelist)
2449 -
2450 -    def jsfile = "${outputDir}/core${name}.js"
2451 -    def zjsfile = "${outputDir}/core${name}.z.js"
2452 -
2453 -    jalviewjsCoreClasslists += [
2454 -      'jsfile': jsfile,
2455 -      'zjsfile': zjsfile,
2456 -      'list': list,
2457 -      'name': name
2458 -    ]
2459 -
2460 -    inputs.file(file)
2461 -    inputs.files(list)
2462 -    outputs.file(jsfile)
2463 -    outputs.file(zjsfile)
2464 -  }
2465 -  
2466 -  // _stevesoft core. add any cores without a classlist here (and the inputs and outputs)
2467 -  def stevesoftClasslistName = "_stevesoft"
2468 -  def stevesoftClasslist = [
2469 -    'jsfile': "${outputDir}/core${stevesoftClasslistName}.js",
2470 -    'zjsfile': "${outputDir}/core${stevesoftClasslistName}.z.js",
2471 -    'list': fileTree(dir: j2sDir, include: "com/stevesoft/pat/**/*.js"),
2472 -    'name': stevesoftClasslistName
2473 -  ]
2474 -  jalviewjsCoreClasslists += stevesoftClasslist
2475 -  inputs.files(stevesoftClasslist['list'])
2476 -  outputs.file(stevesoftClasslist['jsfile'])
2477 -  outputs.file(stevesoftClasslist['zjsfile'])
2478 -
2479 -  // _all core
2480 -  def allClasslistName = "_all"
2481 -  def allJsFiles = fileTree(dir: j2sDir, include: "**/*.js")
2482 -  allJsFiles += fileTree(
2483 -    dir: libJ2sDir,
2484 -    include: "**/*.js",
2485 -    excludes: [
2486 -      // these exlusions are files that the closure-compiler produces errors for. Should fix them
2487 -      "**/org/jmol/jvxl/readers/IsoIntersectFileReader.js",
2488 -      "**/org/jmol/export/JSExporter.js"
2489 -    ]
2490 -  )
2491 -  allJsFiles += fileTree(
2492 -    dir: swingJ2sDir,
2493 -    include: "**/*.js",
2494 -    excludes: [
2495 -      // these exlusions are files that the closure-compiler produces errors for. Should fix them
2496 -      "**/sun/misc/Unsafe.js",
2497 -      "**/swingjs/jquery/jquery-editable-select.js",
2498 -      "**/swingjs/jquery/j2sComboBox.js",
2499 -      "**/sun/misc/FloatingDecimal.js"
2500 -    ]
2501 -  )
2502 -  def allClasslist = [
2503 -    'jsfile': "${outputDir}/core${allClasslistName}.js",
2504 -    'zjsfile': "${outputDir}/core${allClasslistName}.z.js",
2505 -    'list': allJsFiles,
2506 -    'name': allClasslistName
2507 -  ]
2508 -  // not including this version of "all" core at the moment
2509 -  //jalviewjsCoreClasslists += allClasslist
2510 -  inputs.files(allClasslist['list'])
2511 -  outputs.file(allClasslist['jsfile'])
2512 -  outputs.file(allClasslist['zjsfile'])
2513 -
2514 -  doFirst {
2515 -    def logOutFile = file("${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_closure_stdout}")
2516 -    logOutFile.getParentFile().mkdirs()
2517 -    logOutFile.createNewFile()
2518 -    logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildAllCores\n----\n")
2519 -
2520 -    jalviewjsCoreClasslists.each {
2521 -      jalviewjsCallCore(it.name, it.list, prefixFile, suffixFile, it.jsfile, it.zjsfile, logOutFile, jalviewjs_j2s_to_console.equals("true"))
2522 -    }
2523 -  }
2524 -
2525 -}
2526 -
2527 -
2528 -def jalviewjsPublishCoreTemplate(String coreName, String templateName, File inputFile, String outputFile) {
2529 -  copy {
2530 -    from inputFile
2531 -    into file(outputFile).getParentFile()
2532 -    rename { filename ->
2533 -      if (filename.equals(inputFile.getName())) {
2534 -        return file(outputFile).getName()
2535 -      }
2536 -      return null
2537 -    }
2538 -    filter(ReplaceTokens,
2539 -      beginToken: '_',
2540 -      endToken: '_',
2541 -      tokens: [
2542 -        'MAIN': '"'+main_class+'"',
2543 -        'CODE': "null",
2544 -        'NAME': jalviewjsJalviewTemplateName+" [core ${coreName}]",
2545 -        'COREKEY': jalviewjs_core_key,
2546 -        'CORENAME': coreName
2547 -      ]
2548 -    )
2549 -  }
2550 -}
2551 -
2552 -
2553 -task jalviewjsPublishCoreTemplates {
2554 -  dependsOn jalviewjsBuildAllCores
2555 -  def inputFileName = "${jalviewDir}/${j2s_coretemplate_html}"
2556 -  def inputFile = file(inputFileName)
2557 -  def outputDir = "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
2558 -
2559 -  def outputFiles = []
2560 -  jalviewjsCoreClasslists.each { cl ->
2561 -    def outputFile = "${outputDir}/${jalviewjsJalviewTemplateName}_${cl.name}.html"
2562 -    cl['outputfile'] = outputFile
2563 -    outputFiles += outputFile
2564 -  }
2565 -
2566 -  doFirst {
2567 -    jalviewjsCoreClasslists.each { cl ->
2568 -      jalviewjsPublishCoreTemplate(cl.name, jalviewjsJalviewTemplateName, inputFile, cl.outputfile)
2569 -    }
2570 -  }
2571 -  inputs.file(inputFile)
2572 -  outputs.files(outputFiles)
2573 -}
2574 -
2575 -
2576 -task jalviewjsSyncCore (type: Sync) {
2577 -  dependsOn jalviewjsBuildAllCores
2578 -  dependsOn jalviewjsPublishCoreTemplates
2579 -  def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjsTransferSiteCoreDir}")
2580 -  def outputDir = "${jalviewDir}/${jalviewjsSiteDir}"
2581 -
2582 -  from inputFiles
2583 -  into outputDir
2584 -  def outputFiles = []
2585 -  rename { filename ->
2586 -    outputFiles += "${outputDir}/${filename}"
2587 -    null
2588 -  }
2589 -  preserve {
2590 -    include "**"
2591 -  }
2592 -  outputs.files outputFiles
2593 -  inputs.files inputFiles
2594 -}
2595 -
2596 -
2597 -// this Copy version of TransferSiteJs will delete anything else in the target dir
2598 -task jalviewjsCopyTransferSiteJs(type: Copy) {
2599 -  dependsOn jalviewjsTranspile
2600 -  from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2601 -  into "${jalviewDir}/${jalviewjsSiteDir}"
2602 -}
2603 -
2604 -
2605 -// this Sync version of TransferSite is used by buildship to keep the website automatically up to date when a file changes
2606 -task jalviewjsSyncTransferSiteJs(type: Sync) {
2607 -  from "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2608 -  include "**/*.*"
2609 -  into "${jalviewDir}/${jalviewjsSiteDir}"
2610 -  preserve {
2611 -    include "**"
2612 -  }
2613 -}
2614 -
2615 -
2616 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsCopyTransferSiteJs
2617 -jalviewjsSyncResources.mustRunAfter jalviewjsCopyTransferSiteJs
2618 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsCopyTransferSiteJs
2619 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsCopyTransferSiteJs
2620 -
2621 -jalviewjsSyncAllLibs.mustRunAfter jalviewjsSyncTransferSiteJs
2622 -jalviewjsSyncResources.mustRunAfter jalviewjsSyncTransferSiteJs
2623 -jalviewjsSyncSiteResources.mustRunAfter jalviewjsSyncTransferSiteJs
2624 -jalviewjsSyncBuildProperties.mustRunAfter jalviewjsSyncTransferSiteJs
2625 -
2626 -
2627 -task jalviewjsPrepareSite {
2628 -  group "JalviewJS"
2629 -  description "Prepares the website folder including unzipping files and copying resources"
2630 -  dependsOn jalviewjsSyncAllLibs
2631 -  dependsOn jalviewjsSyncResources
2632 -  dependsOn jalviewjsSyncSiteResources
2633 -  dependsOn jalviewjsSyncBuildProperties
2634 -  dependsOn jalviewjsSyncCore
2635 -}
2636 -
2637 -
2638 -task jalviewjsBuildSite {
2639 -  group "JalviewJS"
2640 -  description "Builds the whole website including transpiled code"
2641 -  dependsOn jalviewjsCopyTransferSiteJs
2642 -  dependsOn jalviewjsPrepareSite
2643 -}
2644 -
2645 -
2646 -task cleanJalviewjsTransferSite {
2647 -  doFirst {
2648 -    delete "${jalviewDir}/${jalviewjsTransferSiteJsDir}"
2649 -    delete "${jalviewDir}/${jalviewjsTransferSiteLibDir}"
2650 -    delete "${jalviewDir}/${jalviewjsTransferSiteSwingJsDir}"
2651 -    delete "${jalviewDir}/${jalviewjsTransferSiteCoreDir}"
2652 -  }
2653 -}
2654 -
2655 -
2656 -task cleanJalviewjsSite {
2657 -  dependsOn cleanJalviewjsTransferSite
2658 -  doFirst {
2659 -    delete "${jalviewDir}/${jalviewjsSiteDir}"
2660 -  }
2661 -}
2662 -
2663 -
2664 -task jalviewjsSiteTar(type: Tar) {
2665 -  group "JalviewJS"
2666 -  description "Creates a tar.gz file for the website"
2667 -  dependsOn jalviewjsBuildSite
2668 -  def outputFilename = "jalviewjs-site-${JALVIEW_VERSION}.tar.gz"
2669 -  archiveFileName = outputFilename
2670 -
2671 -  compression Compression.GZIP
2672 -
2673 -  from "${jalviewDir}/${jalviewjsSiteDir}"
2674 -  into jalviewjs_site_dir // this is inside the tar file
2675 -
2676 -  inputs.dir("${jalviewDir}/${jalviewjsSiteDir}")
2677 -}
2678 -
2679 -
2680 -task jalviewjsServer {
2681 -  group "JalviewJS"
2682 -  def filename = "jalviewjsTest.html"
2683 -  description "Starts a webserver on localhost to test the website. See ${filename} to access local site on most recently used port."
2684 -  def htmlFile = "${jalviewDirAbsolutePath}/${filename}"
2685 -  doLast {
2686 -
2687 -    def factory
2688 -    try {
2689 -      def f = Class.forName("org.gradle.plugins.javascript.envjs.http.simple.SimpleHttpFileServerFactory")
2690 -      factory = f.newInstance()
2691 -    } catch (ClassNotFoundException e) {
2692 -      throw new GradleException("Unable to create SimpleHttpFileServerFactory")
2693 -    }
2694 -    def port = Integer.valueOf(jalviewjs_server_port)
2695 -    def start = port
2696 -    def running = false
2697 -    def url
2698 -    def jalviewjsServer
2699 -    while(port < start+1000 && !running) {
2700 -      try {
2701 -        def doc_root = new File("${jalviewDirAbsolutePath}/${jalviewjsSiteDir}")
2702 -        jalviewjsServer = factory.start(doc_root, port)
2703 -        running = true
2704 -        url = jalviewjsServer.getResourceUrl(jalviewjs_server_resource)
2705 -        println("SERVER STARTED with document root ${doc_root}.")
2706 -        println("Go to "+url+" . Run  gradle --stop  to stop (kills all gradle daemons).")
2707 -        println("For debug: "+url+"?j2sdebug")
2708 -        println("For verbose: "+url+"?j2sverbose")
2709 -      } catch (Exception e) {
2710 -        port++;
2711 -      }
2712 -    }
2713 -    def htmlText = """
2714 -      <p><a href="${url}">JalviewJS Test. &lt;${url}&gt;</a></p>
2715 -      <p><a href="${url}?j2sdebug">JalviewJS Test with debug. &lt;${url}?j2sdebug&gt;</a></p>
2716 -      <p><a href="${url}?j2sverbose">JalviewJS Test with verbose. &lt;${url}?j2sdebug&gt;</a></p>
2717 -      """
2718 -    jalviewjsCoreClasslists.each { cl ->
2719 -      def urlcore = jalviewjsServer.getResourceUrl(file(cl.outputfile).getName())
2720 -      htmlText += """
2721 -      <p><a href="${urlcore}">${jalviewjsJalviewTemplateName} [core ${cl.name}]. &lt;${urlcore}&gt;</a></p>
2722 -      """
2723 -      println("For core ${cl.name}: "+urlcore)
2724 -    }
2725 -
2726 -    file(htmlFile).text = htmlText
2727 -  }
2728 -
2729 -  outputs.file(htmlFile)
2730 -  outputs.upToDateWhen({false})
2731 -}
2732 -
2733 -
2734 -task cleanJalviewjsAll {
2735 -  group "JalviewJS"
2736 -  description "Delete all configuration and build artifacts to do with JalviewJS build"
2737 -  dependsOn cleanJalviewjsSite
2738 -  dependsOn jalviewjsEclipsePaths
2739 -  
2740 -  doFirst {
2741 -    delete "${jalviewDir}/${jalviewjsBuildDir}"
2742 -    delete "${jalviewDir}/${eclipse_bin_dir}"
2743 -    if (eclipseWorkspace != null && file(eclipseWorkspace.getAbsolutePath()+"/.metadata").exists()) {
2744 -      delete file(eclipseWorkspace.getAbsolutePath()+"/.metadata")
2745 -    }
2746 -    delete jalviewjsJ2sAltSettingsFileName
2747 -  }
2748 -
2749 -  outputs.upToDateWhen( { false } )
2750 -}
2751 -
2752 -
2753 -task jalviewjsIDE_checkJ2sPlugin {
2754 -  group "00 JalviewJS in Eclipse"
2755 -  description "Compare the swingjs/net.sf.j2s.core(-j11)?.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)"
2756 -
2757 -  doFirst {
2758 -    def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
2759 -    def j2sPluginFile = file(j2sPlugin)
2760 -    def eclipseHome = System.properties["eclipse.home.location"]
2761 -    if (eclipseHome == null || ! IN_ECLIPSE) {
2762 -      throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.")
2763 -    }
2764 -    def eclipseJ2sPluginDirs = [ "${eclipseHome}/dropins" ]
2765 -    def altPluginsDir = System.properties["org.eclipse.equinox.p2.reconciler.dropins.directory"]
2766 -    if (altPluginsDir != null && file(altPluginsDir).exists()) {
2767 -      eclipseJ2sPluginDirs += altPluginsDir
2768 -    }
2769 -    def foundPlugin = false
2770 -    def j2sPluginFileName = j2sPluginFile.getName()
2771 -    def eclipseJ2sPlugin
2772 -    def eclipseJ2sPluginFile
2773 -    eclipseJ2sPluginDirs.any { dir ->
2774 -      eclipseJ2sPlugin = "${dir}/${j2sPluginFileName}"
2775 -      eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
2776 -      if (eclipseJ2sPluginFile.exists()) {
2777 -        foundPlugin = true
2778 -        return true
2779 -      }
2780 -    }
2781 -    if (!foundPlugin) {
2782 -      def msg = "Eclipse J2S Plugin is not installed (could not find '${j2sPluginFileName}' in\n"+eclipseJ2sPluginDirs.join("\n")+"\n)\nTry running task jalviewjsIDE_copyJ2sPlugin"
2783 -      System.err.println(msg)
2784 -      throw new StopExecutionException(msg)
2785 -    }
2786 -
2787 -    def digest = MessageDigest.getInstance("MD5")
2788 -
2789 -    digest.update(j2sPluginFile.text.bytes)
2790 -    def j2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
2791 -
2792 -    digest.update(eclipseJ2sPluginFile.text.bytes)
2793 -    def eclipseJ2sPluginMd5 = new BigInteger(1, digest.digest()).toString(16).padLeft(32, '0')
2794 -     
2795 -    if (j2sPluginMd5 != eclipseJ2sPluginMd5) {
2796 -      def msg = "WARNING! Eclipse J2S Plugin '${eclipseJ2sPlugin}' is different to this commit's version '${j2sPlugin}'"
2797 -      System.err.println(msg)
2798 -      throw new StopExecutionException(msg)
2799 -    } else {
2800 -      def msg = "Eclipse J2S Plugin '${eclipseJ2sPlugin}' is the same as '${j2sPlugin}' (this is good)"
2801 -      println(msg)
2802 -    }
2803 -  }
2804 -}
2805 -
2806 -task jalviewjsIDE_copyJ2sPlugin {
2807 -  group "00 JalviewJS in Eclipse"
2808 -  description "Copy the swingjs/net.sf.j2s.core(-j11)?.jar file into the Eclipse IDE's 'dropins' dir"
2809 -
2810 -  doFirst {
2811 -    def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}")
2812 -    def j2sPluginFile = file(j2sPlugin)
2813 -    def eclipseHome = System.properties["eclipse.home.location"]
2814 -    if (eclipseHome == null || ! IN_ECLIPSE) {
2815 -      throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. NOT copying J2S Plugin.")
2816 -    }
2817 -    def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}"
2818 -    def eclipseJ2sPluginFile = file(eclipseJ2sPlugin)
2819 -    def msg = "WARNING! Copying this commit's j2s plugin '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n* May require an Eclipse restart"
2820 -    System.err.println(msg)
2821 -    copy {
2822 -      from j2sPlugin
2823 -      eclipseJ2sPluginFile.getParentFile().mkdirs()
2824 -      into eclipseJ2sPluginFile.getParent()
2825 -    }
2826 -  }
2827 -}
2828 -
2829 -
2830 -task jalviewjsIDE_j2sFile {
2831 -  group "00 JalviewJS in Eclipse"
2832 -  description "Creates the .j2s file"
2833 -  dependsOn jalviewjsCreateJ2sSettings
2834 -}
2835 -
2836 -
2837 -task jalviewjsIDE_SyncCore {
2838 -  group "00 JalviewJS in Eclipse"
2839 -  description "Build the core js lib closures listed in the classlists dir and publish core html from template"
2840 -  dependsOn jalviewjsSyncCore
2841 -}
2842 -
2843 -
2844 -task jalviewjsIDE_SyncSiteAll {
2845 -  dependsOn jalviewjsSyncAllLibs
2846 -  dependsOn jalviewjsSyncResources
2847 -  dependsOn jalviewjsSyncSiteResources
2848 -  dependsOn jalviewjsSyncBuildProperties
2849 -}
2850 -
2851 -
2852 -cleanJalviewjsTransferSite.mustRunAfter jalviewjsIDE_SyncSiteAll
2853 -
2854 -
2855 -task jalviewjsIDE_PrepareSite {
2856 -  group "00 JalviewJS in Eclipse"
2857 -  description "Sync libs and resources to site dir, but not closure cores"
2858 -
2859 -  dependsOn jalviewjsIDE_SyncSiteAll
2860 -  //dependsOn cleanJalviewjsTransferSite // not sure why this clean is here -- will slow down a re-run of this task
2861 -}
2862 -
2863 -
2864 -task jalviewjsIDE_AssembleSite {
2865 -  group "00 JalviewJS in Eclipse"
2866 -  description "Assembles unzipped supporting zipfiles, resources, site resources and closure cores into the Eclipse transpiled site"
2867 -  dependsOn jalviewjsPrepareSite
2868 -}
2869 -
2870 -
2871 -task jalviewjsIDE_SiteClean {
2872 -  group "00 JalviewJS in Eclipse"
2873 -  description "Deletes the Eclipse transpiled site"
2874 -  dependsOn cleanJalviewjsSite
2875 -}
2876 -
2877 -
2878 -task jalviewjsIDE_Server {
2879 -  group "00 JalviewJS in Eclipse"
2880 -  description "Starts a webserver on localhost to test the website"
2881 -  dependsOn jalviewjsServer
2882 -}
2883 -
2884 -
2885 -// buildship runs this at import or gradle refresh
2886 -task eclipseSynchronizationTask {
2887 -  //dependsOn eclipseSetup
2888 -  dependsOn createBuildProperties
2889 -  if (J2S_ENABLED) {
2890 -    dependsOn jalviewjsIDE_j2sFile
2891 -    dependsOn jalviewjsIDE_checkJ2sPlugin
2892 -    dependsOn jalviewjsIDE_PrepareSite
2893 -  }
2894 -}
2895 -
2896 -
2897 -// buildship runs this at build time or project refresh
2898 -task eclipseAutoBuildTask {
2899 -  //dependsOn jalviewjsIDE_checkJ2sPlugin
2900 -  //dependsOn jalviewjsIDE_PrepareSite
2901 +  outputs.file("${outputDir}/${archiveFileName}")
2902  }
2903  
2904 -
2905 -task jalviewjs {
2906 -  group "JalviewJS"
2907 -  description "Build the site"
2908 -  dependsOn jalviewjsBuildSite
2909 -}