id 'java'
id 'application'
id 'eclipse'
+ id "com.diffplug.spotless" version "6.18.0" //.gradle.spotless" "3.28.0"
+ id 'com.github.johnrengelman.shadow' version '8.1.1' // was 4.0.3
id "com.diffplug.gradle.spotless" version "3.28.0"
- id 'com.github.johnrengelman.shadow' version '4.0.3'
id 'com.install4j.gradle' version '10.0.3'
id 'com.dorongold.task-tree' version '2.1.1' // only needed to display task dependency tree with gradle task1 [task2 ...] taskTree
id 'com.palantir.git-version' version '0.13.0' apply false
testDir = string("${jalviewDir}/${bareTestSourceDir}")
classesDir = string("${jalviewDir}/${classes_dir}")
+ outputDir = file(classesDir)
// clover
useClover = clover.equals("true")
}
if (inFrontMatter) {
def m = null
- if (m = line =~ /^date:\s*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/) {
+ if (m == line =~ /^date:\s*(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})/) {
map["date"] = new Date().parse("yyyy-MM-dd HH:mm:ss", m[0][1])
- } else if (m = line =~ /^date:\s*(\d{4}-\d{2}-\d{2})/) {
+ } else if (m == line =~ /^date:\s*(\d{4}-\d{2}-\d{2})/) {
map["date"] = new Date().parse("yyyy-MM-dd", m[0][1])
- } else if (m = line =~ /^channel:\s*(\S+)/) {
+ } else if (m == line =~ /^channel:\s*(\S+)/) {
map["channel"] = m[0][1]
- } else if (m = line =~ /^version:\s*(\S+)/) {
+ } else if (m == line =~ /^version:\s*(\S+)/) {
map["version"] = m[0][1]
- } else if (m = line =~ /^\s*([^:]+)\s*:\s*(\S.*)/) {
+ } else if (m == line =~ /^\s*([^:]+)\s*:\s*(\S.*)/) {
map[ m[0][1] ] = m[0][2]
}
if (dateOnly && map["date"] != null) {
def inSection = false
changes.eachLine { line ->
def m = null
- if (m = line =~ /^##([^#].*)$/) {
+ if (m == line =~ /^##([^#].*)$/) {
if (inSection) {
changesHugo += "</div>\n\n"
}
section = section.replaceAll(/[^a-z0-9_\-]/, "")
changesHugo += "<div class=\"${section}\">\n\n"
inSection = true
- } else if (m = line =~ /^(\s*-\s*)<!--([^>]+)-->(.*?)(<br\/?>)?\s*$/) {
+ } else if (m == line =~ /^(\s*-\s*)<!--([^>]+)-->(.*?)(<br\/?>)?\s*$/) {
def comment = m[0][2].trim()
if (comment != "") {
comment = comment.replaceAll('"', """)
def sectionName = null
content.eachLine { line ->
def m = null
- if (m = line =~ /^##([^#].*)$/) {
+ if (m == line =~ /^##([^#].*)$/) {
if (sectionName != null) {
sections[sectionName] = sectionContent
sectionName = null
}
+/*
task releasesTemplates {
group "help"
description "Recreate whatsNew.html and releases.html from markdown files and templates in help"
def lm = null
def rContentProcessed = ""
rContent.eachLine { line ->
- if (lm = line =~ /^(\s*-)(\s*<!--[^>]*?-->)(.*)$/) {
+ if (lm == line =~ /^(\s*-)(\s*<!--[^>]*?-->)(.*)$/) {
line = "${lm[0][1]}${lm[0][3]}${lm[0][2]}"
- } else if (lm = line =~ /^###([^#]+.*)$/) {
+ } else if (lm == line =~ /^###([^#]+.*)$/) {
line = "_${lm[0][1].trim()}_"
}
rContentProcessed += line + "\n"
outputs.file(whatsnewHtmlFile)
}
+*/
task copyResources(type: Copy) {
group = "build"
task createBuildProperties(type: WriteProperties) {
dependsOn copyResources
+ dependsOn copyChannelResources
group = "build"
description = "Create the ${buildProperties} file"
task buildIndices(type: JavaExec) {
dependsOn copyHelp
+ //dependsOn releasesTemplates
classpath = sourceSets.main.compileClasspath
main = "com.sun.java.help.search.Indexer"
workingDir = "${helpBuildDir}/${help_dir}"
dependsOn buildResources
dependsOn copyDocs
dependsOn copyHelp
- dependsOn releasesTemplates
+ //dependsOn releasesTemplates
dependsOn convertMdFiles
dependsOn buildIndices
}
+// random block of dependencies
compileJava.dependsOn prepare
run.dependsOn compileJava
-compileTestJava.dependsOn compileJava
-
-
-
+//run.dependsOn prepare
+compileTestJava.dependsOn compileJava //
+compileTestJava.dependsOn buildIndices //
+processResources.dependsOn copyChannelResources //
+processResources.dependsOn copyResources //
+processResources.dependsOn createBuildProperties //
+processResources.dependsOn copyDocs //
+processResources.dependsOn convertMdFiles //
+processResources.dependsOn copyHelp //
+processResources.dependsOn buildIndices //
test {
group = "Verification"
description = "Runs all testTaskN tasks)"
/* END of test tasks results summary */
+/*
task compileLinkCheck(type: JavaCompile) {
options.fork = true
classpath = files("${jalviewDir}/${utils_dir}")
inputs.dir(helpBuildDir)
outputs.file(helpLinksCheckerOutFile)
}
+*/
// import the pubhtmlhelp target
}
}
+// block of dependencies
+//compileTestJava.dependsOn compileLinkCheck //
+//copyChannelResources.dependsOn compileLinkCheck //
+//convertMdFiles.dependsOn compileLinkCheck //
jar {
dependsOn prepare
- dependsOn linkCheck
+ dependsOn //linkCheck
manifest {
attributes "Main-Class": main_class,
}
def outputDir = "${jalviewDir}/${package_dir}"
- destinationDirectory = file(outputDir)
+ outputDir = file(outputDir)
archiveFileName = rootProject.name+".jar"
duplicatesStrategy "EXCLUDE"
mainClassName = shadow_jar_main_class
mergeServiceFiles()
- classifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
+ archiveClassifier = "all-"+JALVIEW_VERSION+"-j"+JAVA_VERSION
minimize()
}
task jalviewjsLaunchTest {
group "Test"
description "Check JalviewJS opens in a browser"
-// dependsOn jalviewjsBuildSite
+ dependsOn jalviewjsBuildSite
dependsOn jalviewjsCopyStderrLaunchFile
dependsOn jalviewjsChromiumProfile
def stdout
def stderr
doFirst {
- def timeoutms = Integer.valueOf(jalviewjs_chromium_timeout) * 1000
-
- ScheduledExecutorService executor = Executors.newScheduledThreadPool(3);
- final Future handler = executor.submit(
- () -> {
-
- exec {
- def binary = file(chromiumBinary)
- if (!binary.exists()) {
- throw new StopExecutionException("Could not find chromium binary '${chromiumBinary}'. Cannot run task ${name}.")
+ def timeoutms = Integer.valueOf(jalviewjs_chromium_overall_timeout) * 1000
+
+ def binary = file(chromiumBinary)
+ if (!binary.exists()) {
+ throw new StopExecutionException("Could not find chromium binary '${chromiumBinary}'. Cannot run task ${name}.")
+ }
+ stdout = new ByteArrayOutputStream()
+ stderr = new ByteArrayOutputStream()
+ def execStdout
+ def execStderr
+ if (jalviewjs_j2s_to_console.equals("true")) {
+ execStdout = new org.apache.tools.ant.util.TeeOutputStream(
+ stdout,
+ System.out)
+ execStderr = new org.apache.tools.ant.util.TeeOutputStream(
+ stderr,
+ System.err)
+ } else {
+ execStdout = stdout
+ execStderr = stderr
+ }
+ def execArgs = [
+ "--no-sandbox", // --no-sandbox IS USED BY THE THORIUM APPIMAGE ON THE BUILDSERVER
+ "--headless=new",
+ "--disable-gpu",
+ "--timeout=${timeoutms}",
+ "--virtual-time-budget=${timeoutms}",
+ "--user-data-dir=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}",
+ "--profile-directory=${jalviewjs_chromium_profile_name}",
+ "--allow-file-access-from-files",
+ "--enable-logging=stderr",
+ "file://${jalviewDirAbsolutePath}/${jalviewjsStderrLaunchFilename}"
+ ]
+
+ if (true || macOS) {
+ ScheduledExecutorService executor = Executors.newScheduledThreadPool(3);
+ Future f1 = executor.submit(
+ () -> {
+ exec {
+ standardOutput = execStdout
+ errorOutput = execStderr
+ executable(chromiumBinary)
+ args(execArgs)
+ println "COMMAND: '"+commandLine.join(" ")+"'"
}
+ executor.shutdownNow()
+ }
+ )
- stdout = new ByteArrayOutputStream()
- stderr = new ByteArrayOutputStream()
- if (jalviewjs_j2s_to_console.equals("true")) {
- standardOutput = new org.apache.tools.ant.util.TeeOutputStream(
- stdout,
- System.out)
- errorOutput = new org.apache.tools.ant.util.TeeOutputStream(
- stderr,
- System.err)
+ def noChangeBytes = 0
+ def noChangeIterations = 0
+ executor.scheduleAtFixedRate(
+ () -> {
+ String stderrString = stderr.toString()
+ // shutdown the task if we have a success string
+ if (stderrString.contains(jalviewjs_desktop_init_string)) {
+ f1.cancel()
+ Thread.sleep(1000)
+ executor.shutdownNow()
+ }
+ // if no change in stderr for 10s then also end
+ if (noChangeIterations >= jalviewjs_chromium_idle_timeout) {
+ executor.shutdownNow()
+ }
+ if (stderrString.length() == noChangeBytes) {
+ noChangeIterations++
} else {
- standardOutput = stdout
- errorOutput = stderr
+ noChangeBytes = stderrString.length()
+ noChangeIterations = 0
}
+ },
+ 1, 1, TimeUnit.SECONDS)
-
- executable(chromiumBinary)
- args([
- "--no-sandbox", // --no-sandbox IS USED BY THE THORIUM APPIMAGE ON THE BUILDSERVER
- "--headless=new",
- "--disable-gpu",
- "--timeout=${timeoutms}",
- "--virtual-time-budget=${timeoutms}",
- "--user-data-dir=${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_chromium_user_dir}",
- "--profile-directory=${jalviewjs_chromium_profile_name}",
- "--allow-file-access-from-files",
- "--enable-logging=stderr",
- "file://${jalviewDirAbsolutePath}/${jalviewjsStderrLaunchFilename}"
- ])
- }
-
- }
-
- )
-
- executor.schedule(new Runnable(){
- public void run(){
- executor.shutdownNow()
- }
- }, timeoutms, TimeUnit.MILLISECONDS);
-
- executor.scheduleAtFixedRate(
- () -> {
- if (stderr.toString().contains(jalviewjs_desktop_init_string)) {
- Thread.sleep(1000)
+ executor.schedule(new Runnable(){
+ public void run(){
+ f1.cancel()
executor.shutdownNow()
}
- },
- 1, 1, TimeUnit.SECONDS)
+ }, timeoutms, TimeUnit.MILLISECONDS)
- executor.awaitTermination(timeoutms, TimeUnit.MILLISECONDS)
+ executor.awaitTermination(timeoutms+10000, TimeUnit.MILLISECONDS)
+ executor.shutdownNow()
+ }
}