From: Ben Soares Date: Tue, 21 Apr 2020 00:11:04 +0000 (+0100) Subject: JAL-3602 Added configuration for enforced use of UTF-8 for creating the X-Git-Tag: Release_2_11_4_0~45^2~18^2~4 X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=439d89cfdb49de11de73e31b2604672edcc5a45d;p=jalview.git JAL-3602 Added configuration for enforced use of UTF-8 for creating the core js files and also in the closure-compiler. --- diff --git a/build.gradle b/build.gradle index d955de3..985cc87 100644 --- a/build.gradle +++ b/build.gradle @@ -804,11 +804,12 @@ task cleanClover { compileJava { - + + sourceCompatibility = compile_source_compatibility + targetCompatibility = compile_target_compatibility + options.compilerArgs = additional_compiler_args + options.encoding = "UTF-8" doFirst { - sourceCompatibility = compile_source_compatibility - targetCompatibility = compile_target_compatibility - options.compilerArgs = additional_compiler_args print ("Setting target compatibility to "+targetCompatibility+"\n") } @@ -1423,6 +1424,11 @@ task getdown() { } +tasks.withType(JavaCompile) { + options.encoding = 'UTF-8' +} + + clean { doFirst { delete getdownWebsiteDir @@ -1818,13 +1824,14 @@ task jalviewjsEclipsePaths { eclipseProduct = "${eclipseRoot}/Contents/Eclipse/.eclipseproduct" } else if (OperatingSystem.current().isWindows()) { // check these paths!! if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) { - eclipseRoot += "/eclipse.exe" + eclipseRoot += "/eclipse" } - eclipseBinary = "${eclipseRoot}/eclipse" + eclipseBinary = "${eclipseRoot}/eclipse.exe" eclipseProduct = "${eclipseRoot}/.eclipseproduct" } else { // linux or unix if (file("${eclipseRoot}/eclipse").isDirectory() && file("${eclipseRoot}/eclipse/.eclipseproduct").exists()) { eclipseRoot += "/eclipse" +println("eclipseDir exists") } eclipseBinary = "${eclipseRoot}/eclipse" eclipseProduct = "${eclipseRoot}/.eclipseproduct" @@ -2203,11 +2210,11 @@ def jalviewjsCallCore(String name, FileCollection list, String prefixFile, Strin def coreBottom = file(suffixFile) coreFile.getParentFile().mkdirs() coreFile.createNewFile() - coreFile.write( coreTop.text ) + coreFile.write( coreTop.getText("UTF-8") ) list.each { f -> if (f.exists()) { - def t = f.text + def t = f.getText("UTF-8") t.replaceAll("Clazz\\.([^_])","Clazz_${1}") coreFile.append( t ) } else { @@ -2216,7 +2223,7 @@ def jalviewjsCallCore(String name, FileCollection list, String prefixFile, Strin logOutFile.append(msg+"\n") } } - coreFile.append( coreBottom.text ) + coreFile.append( coreBottom.getText("UTF-8") ) msg = "Generating ${zjsfile}" println(msg) @@ -2225,8 +2232,10 @@ def jalviewjsCallCore(String name, FileCollection list, String prefixFile, Strin def logErrFOS = logOutFOS javaexec { - classpath = files(["${jalviewDir}/tools/closure_compiler.jar"]) - args = [ "--js", jsfile, "--js_output_file", zjsfile ] + classpath = files(["${jalviewDir}/${jalviewjs_closure_compiler}"]) + main = "com.google.javascript.jscomp.CommandLineRunner" + jvmArgs = [ "-Dfile.encoding=UTF-8" ] + args = [ "--compilation_level", "SIMPLE_OPTIMIZATIONS", "--warning_level", "QUIET", "--charset", "UTF-8", "--js", jsfile, "--js_output_file", zjsfile ] maxHeapSize = "2g" msg = "\nRunning '"+commandLine.join(' ')+"'\n" diff --git a/gradle.properties b/gradle.properties index 1507117..59699e3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,5 @@ -org.gradle.jvmargs=-Xmx1536m -Xms512m +org.gradle.jvmargs=-Xmx1536m -Xms512m -Dfile.encoding=UTF-8 +#systemProp.file.encoding=UTF-8 jalviewDir = . @@ -213,6 +214,7 @@ j2s_coretemplate_html = utils/jalviewjs/coretemplate.html jalviewjs_j2s_transpile_stdout = j2s-transpile.out #jalviewjs_j2s_stderr = j2s-transpile.err # all going into out jalviewjs_j2s_to_console = true +jalviewjs_closure_compiler = tools/closure_compiler.jar jalviewjs_j2s_closure_stdout = j2s-closure.out