zipFiles.each { file_zip ->
from zipTree(file_zip)
- // rename files in jsmol/j2s/... to swingjs/j2s/...
- /*
- if (file_zip.getName().startsWith("Jmol-j2s-site")) {
- eachFile { fcd ->
- // jsmol/... -> swingjs/...
- def relPathSegments = fcd.relativePath.getSegments()
- if (relPathSegments[0] == "jsmol") {
- def newRelPathSegments = relPathSegments
- newRelPathSegments[0] = "swingjs"
- fcd.relativePath = new RelativePath(true, newRelPathSegments)
- }
- }
- }
- */
-
// The following replace() is needed due to a mismatch in Jmol calls to
// colorPtToFFRGB$javajs_util_T3d when only colorPtToFFRGB$javajs_util_T3 is defined
// in the SwingJS.zip (github or the one distributed with JSmol)
}
-task jalviewjsBuildAllCores {
+task jalviewjsBuildCore {
group "JalviewJS"
description "Build the core js lib closures listed in the classlists dir"
dependsOn jalviewjsTransferSiteMergeDirs
]
}
- // _jmol and _jalview cores. Add any other peculiar classlist.txt files here
- //classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jmol}"), 'name': "_jvjmol" ]
+ // _jalview core
classlistFiles += [ 'file': file("${jalviewDir}/${jalviewjs_classlist_jalview}"), 'name': jalviewjsJalviewCoreName ]
jalviewjsCoreClasslists = []
def logOutFile = file("${jalviewDirAbsolutePath}/${jalviewjsBuildDir}/${jalviewjs_j2s_closure_stdout}")
logOutFile.getParentFile().mkdirs()
logOutFile.createNewFile()
- logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildAllCores\n----\n")
+ logOutFile.write(getDate("yyyy-MM-dd HH:mm:ss")+" jalviewjsBuildCore\n----\n")
jalviewjsCoreClasslists.each {
jalviewjsCallCore(it.name, it.list, prefixFile, suffixFile, it.jsfile, it.zjsfile, logOutFile, jalviewjs_j2s_to_console.equals("true"))
task jalviewjsPublishCoreTemplates {
- dependsOn jalviewjsBuildAllCores
+ dependsOn jalviewjsBuildCore
def inputFileName = "${jalviewDir}/${j2s_coretemplate_html}"
def inputFile = file(inputFileName)
task jalviewjsSyncCore (type: Sync) {
- dependsOn jalviewjsBuildAllCores
+ dependsOn jalviewjsBuildCore
dependsOn jalviewjsPublishCoreTemplates
def inputDir = file("${jalviewDir}/${jalviewjsTransferSiteCoreDir}")
execStdout = stdout
execStderr = stderr
}
- // macOS not running properly with timeout arguments
- def execArgs = macOS ? [] : [
+ // macOS seems okay now with timeout arguments
+ def execArgs = [
"--virtual-time-budget=${timeoutms}",
+ "--timeout=${timeoutms}",
]
execArgs += [
"--no-sandbox", // --no-sandbox IS USED BY THE THORIUM APPIMAGE ON THE BUILDSERVER
"--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()
+
+ java.lang.Runnable runChrome = () -> {
+ exec {
+ standardOutput = execStdout
+ errorOutput = execStderr
+ executable(chromiumBinary)
+ args(execArgs)
+ println "COMMAND: '"+commandLine.join(" ")+"'"
}
- )
+ executor.shutdownNow()
+ }
+
+ if (macOS) {
+ // we create our own timeout executor as --timeout doesn't work on macOS
+ ScheduledExecutorService executor = Executors.newScheduledThreadPool(3);
+
+ Future f1 = executor.submit( runChrome )
def noChangeBytes = 0
def noChangeIterations = 0
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)
+ f1.cancel(true)
+ Thread.sleep(100)
executor.shutdownNow()
- }
+ } else
// if no change in stderr for 10s then also end
if (noChangeIterations >= jalviewjs_chromium_idle_timeout) {
executor.shutdownNow()
noChangeIterations = 0
}
},
- 1, 1, TimeUnit.SECONDS)
+ 200, 200, TimeUnit.MILLISECONDS)
executor.schedule(new Runnable(){
public void run(){
- f1.cancel()
+ f1.cancel(true)
executor.shutdownNow()
}
}, timeoutms, TimeUnit.MILLISECONDS)
- executor.awaitTermination(timeoutms+10000, TimeUnit.MILLISECONDS)
+ executor.awaitTermination(timeoutms+200, TimeUnit.MILLISECONDS)
+ f1.cancel(true)
executor.shutdownNow()
+ } else {
+ // just run chrome and rely on --virtual-time-budget and --timeout
+ runChrome.run()
}
}