HTML5Helper, similar to -terser, adding -npx for Closure Compiler also uses the npx version instead of the bundled version

This commit is contained in:
Josh Tynjala
2023-05-16 12:50:53 -07:00
parent 763b982bd1
commit 571c2bd181

View File

@@ -229,20 +229,33 @@ class HTML5Helper
} }
else else
{ {
var templatePaths = [ var executable:String;
Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end) var args:Array<String>;
].concat(project.templatePaths); if (project.targetFlags.exists("npx"))
var args = [ {
"-Dapple.awt.UIElement=true", executable = "npx";
"-jar", args = [
System.findTemplate(templatePaths, "bin/compiler.jar"), "google-closure-compiler"
"--strict_mode_input", ];
"false", }
"--js", else
sourceFile, {
"--js_output_file", executable = "java";
tempFile var templatePaths = [
]; Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), #if lime "templates" #else "" #end)
].concat(project.templatePaths);
args = [
"-Dapple.awt.UIElement=true",
"-jar",
System.findTemplate(templatePaths, "bin/compiler.jar"),
];
}
args.push("--strict_mode_input");
args.push("false");
args.push("--js");
args.push(sourceFile);
args.push("--js_output_file");
args.push(tempFile);
if (project.targetFlags.exists("advanced")) if (project.targetFlags.exists("advanced"))
{ {
@@ -267,7 +280,7 @@ class HTML5Helper
args.push("--jscomp_off=suspiciousCode"); // avoid warnings caused by the embedded minified libraries args.push("--jscomp_off=suspiciousCode"); // avoid warnings caused by the embedded minified libraries
} }
System.runCommand("", "java", args); System.runCommand("", executable, args);
if (FileSystem.exists(tempFile + ".map")) if (FileSystem.exists(tempFile + ".map"))
{ {