X-Git-Url: http://source.jalview.org/gitweb/?a=blobdiff_plain;f=build.gradle;h=901fcc8e7c3f3fae8ebd66892cfdb94f3f07e4b6;hb=20fde02b6f6f28396595d8a3b90fb48783da0b9e;hp=e2619433114f958596d70f8b8d818717c6ca26aa;hpb=56b4b8a69b9430c4d6dd07eda6954fd77ae7405c;p=jalview.git diff --git a/build.gradle b/build.gradle index e261943..901fcc8 100644 --- a/build.gradle +++ b/build.gradle @@ -143,6 +143,11 @@ ext { getdown_app_dir = getdown_app_dir_release buildProperties = string("${resourceDir}/${build_properties_file}") reportRsyncCommand = true + // Don't ignore transpile errors for release build + if (jalviewjs_ignore_transpile_errors.equals("true")) { + jalviewjs_ignore_transpile_errors = "false" + println("Setting jalviewjs_ignore_transpile_errors to 'false'") + } break case "ARCHIVE": @@ -194,6 +199,11 @@ ext { getdown_app_dir = getdown_app_dir_alt buildProperties = string("${resourceDir}/${build_properties_file}") reportRsyncCommand = true + // Don't ignore transpile errors for release build + if (jalviewjs_ignore_transpile_errors.equals("true")) { + jalviewjs_ignore_transpile_errors = "false" + println("Setting jalviewjs_ignore_transpile_errors to 'false'") + } break case ~/^SCRATCH(|-[-\w]*)$/: @@ -322,10 +332,19 @@ ext { jalviewjsJ2sSettingsFileName = string("${jalviewDir}/${jalviewjs_j2s_settings}") jalviewjsJ2sProps = null + eclipseJavaVersion = "55" + jalviewjsJ2sPlugin = jalviewjs_j2s_plugin + if (IN_ECLIPSE) { + //def eclipseJavaVersion = System.property["java.class.version"] + if (Float.parseFloat(eclipseJavaVersion) >= 55 && file(jalviewjs_j2s_plugin_j11).exists()) { // 55 is Java 11 + jalviewjsJ2sPlugin = jalviewjs_j2s_plugin_j11 + } + } eclipseWorkspace = null eclipseBinary = string("") eclipseVersion = string("") eclipseDebug = false + eclipseJavaVersion = string("") // ENDEXT } @@ -451,7 +470,7 @@ eclipse { } cp.entries.removeAll(removeTheseToo) - //cp.entries += new Output("${eclipse_bin_dir}/main") + cp.entries += new Output("${eclipse_bin_dir}/main") if (file(helpSourceDir).isDirectory()) { cp.entries += new Library(fileReference(helpSourceDir)) } @@ -518,6 +537,7 @@ eclipse { javaRuntimeName = eclipse_java_runtime_name // add in jalview project specific properties/preferences into eclipse core preferences + // and also the codestyle XML file file { withProperties { props -> def jalview_prefs = new Properties() @@ -529,6 +549,22 @@ eclipse { props.putAt(t, v) } } + // codestyle file -- overrides previous formatter prefs + def csFile = file("${jalviewDirAbsolutePath}/${eclipse_codestyle_file}") + if (csFile.exists()) { + XmlParser parser = new XmlParser() + def profiles = parser.parse(csFile) + def profile = profiles.'profile'.find { p -> (p.'@kind' == "CodeFormatterProfile" && p.'@name' == "Jalview") } + if (profile != null) { + profile.'setting'.each { s -> + def id = s.'@id' + def value = s.'@value' + if (id != null && value != null) { + props.putAt(id, value) + } + } + } + } } } @@ -1548,6 +1584,15 @@ task jalviewjsEclipsePaths { } +task printProperties { + group "Debug" + description "Output to console all System.properties" + doFirst { + System.properties.each { key, val -> System.out.println("Property: ${key}=${val}") } + } +} + + task eclipseSetup { dependsOn eclipseProject dependsOn eclipseClasspath @@ -1560,7 +1605,7 @@ task jalviewjsEclipseCopyDropins(type: Copy) { dependsOn jalviewjsEclipsePaths def inputFiles = fileTree(dir: "${jalviewDir}/${jalviewjs_eclipse_dropins_dir}", include: "*.jar") - inputFiles += file("${jalviewDir}/${jalviewjs_j2s_plugin}") + inputFiles += file("${jalviewDir}/${jalviewjsJ2sPlugin}") def outputDir = "${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_eclipse_tmp_dropins_dir}" from inputFiles @@ -1851,7 +1896,12 @@ DEBUG: ${eclipseDebug} if (stdout.toString().contains("Error processing ")) { // j2s did not complete transpile //throw new TaskExecutionException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'") - throw new GradleException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'") + if (jalviewjs_ignore_transpile_errors.equals("true")) { + println("IGNORING TRANSPILE ERRORS") + println("See eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'") + } else { + throw new GradleException("Error during transpilation:\n${stderr}\nSee eclipse transpile log file '${jalviewDir}/${jalviewjsBuildDir}/${jalviewjs_j2s_transpile_stdout}'") + } } } @@ -1972,7 +2022,7 @@ task jalviewjsBuildAllCores { def file = hash['file'] if (! file.exists()) { - println("...classlist file '"+file.getPath()+"' does not exist, skipping") + //println("...classlist file '"+file.getPath()+"' does not exist, skipping") return false // this is a "continue" in groovy .each closure } def name = hash['name'] @@ -2045,7 +2095,8 @@ task jalviewjsBuildAllCores { 'list': allJsFiles, 'name': allClasslistName ] - jalviewjsCoreClasslists += allClasslist + // not including this version of "all" core at the moment + //jalviewjsCoreClasslists += allClasslist inputs.files(allClasslist['list']) outputs.file(allClasslist['jsfile']) outputs.file(allClasslist['zjsfile']) @@ -2289,26 +2340,21 @@ task cleanJalviewjsAll { task jalviewjsIDE_checkJ2sPlugin { group "00 JalviewJS in Eclipse" - description "Compare the swingjs/net.sf.j2s.core.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)" + description "Compare the swingjs/net.sf.j2s.core(-j11)?.jar file with the Eclipse IDE's plugin version (found in the 'dropins' dir)" doFirst { - def j2sPlugin = string("${jalviewDir}/${jalviewjs_j2s_plugin}") + def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}") def j2sPluginFile = file(j2sPlugin) - def copyPlugin = jalviewjs_eclipseIDE_auto_copy_j2s_plugin == "true" def eclipseHome = System.properties["eclipse.home.location"] - def doCopy = false if (eclipseHome == null || ! IN_ECLIPSE) { throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. Skipping J2S Plugin Check.") } def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}" def eclipseJ2sPluginFile = file(eclipseJ2sPlugin) if (!eclipseJ2sPluginFile.exists()) { - def msg = "Eclipse J2S Plugin is not installed" - println(msg) - if (! copyPlugin) { - throw new GradleException(msg) - } - doCopy = true + def msg = "Eclipse J2S Plugin is not installed (could not find '${eclipseJ2sPlugin}')\nTry running task jalviewjsIDE_copyJ2sPlugin" + System.err.println(msg) + throw new StopExecutionException(msg) } def digest = MessageDigest.getInstance("MD5") @@ -2321,24 +2367,34 @@ task jalviewjsIDE_checkJ2sPlugin { if (j2sPluginMd5 != eclipseJ2sPluginMd5) { def msg = "WARNING! Eclipse J2S Plugin '${eclipseJ2sPlugin}' is different to this commit's version '${j2sPlugin}'" + System.err.println(msg) + throw new StopExecutionException(msg) + } else { + def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}' (this is good)" println(msg) - if (! copyPlugin) { - throw new StopExecutionException(msg) - } - doCopy = true } + } +} - if (doCopy) { - def msg = "WARNING! Auto-copying this commit's j2s plugin version '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n May require an Eclipse restart" - println(msg) - copy { - from j2sPlugin - eclipseJ2sPluginFile.getParentFile().mkdirs() - into eclipseJ2sPluginFile.getParent() - } - } else { - def msg = "Eclipse J2S Plugin is the same as '${j2sPlugin}'" - println(msg) +task jalviewjsIDE_copyJ2sPlugin { + group "00 JalviewJS in Eclipse" + description "Copy the swingjs/net.sf.j2s.core(-j11)?.jar file into the Eclipse IDE's 'dropins' dir" + + doFirst { + def j2sPlugin = string("${jalviewDir}/${jalviewjsJ2sPlugin}") + def j2sPluginFile = file(j2sPlugin) + def eclipseHome = System.properties["eclipse.home.location"] + if (eclipseHome == null || ! IN_ECLIPSE) { + throw new StopExecutionException("Cannot find running Eclipse home from System.properties['eclipse.home.location']. NOT copying J2S Plugin.") + } + def eclipseJ2sPlugin = "${eclipseHome}/dropins/${j2sPluginFile.getName()}" + def eclipseJ2sPluginFile = file(eclipseJ2sPlugin) + def msg = "WARNING! Copying this commit's j2s plugin '${j2sPlugin}' to Eclipse J2S Plugin '${eclipseJ2sPlugin}'\n* May require an Eclipse restart" + System.err.println(msg) + copy { + from j2sPlugin + eclipseJ2sPluginFile.getParentFile().mkdirs() + into eclipseJ2sPluginFile.getParent() } } }