diff --git a/docs/build.hx b/docs/build.hx index 7a7fec3c84..3686a002ed 100644 --- a/docs/build.hx +++ b/docs/build.hx @@ -56,10 +56,10 @@ class Build extends Script html5.define("html5"); html5.build(); - System.runCommand("", "haxelib", [ + System.runCommand("", "haxelib " + [ "run", "dox", "-i", "xml", "-in", "lime", "--title", "Lime API Reference", "-D", "source-path", "https://github.com/openfl/lime/tree/develop/src/", "-D", "website", "http://lime.software", "-D", "logo", "/images/logo.png", "-D", "textColor", "0x777777", "-theme", "../assets/docs-theme", "--toplevel-package", "lime" - ]); + ].join(" ")); } } diff --git a/src/lime/_internal/macros/AssetsMacro.hx b/src/lime/_internal/macros/AssetsMacro.hx index a9aae1f088..980fd9aee2 100644 --- a/src/lime/_internal/macros/AssetsMacro.hx +++ b/src/lime/_internal/macros/AssetsMacro.hx @@ -276,7 +276,7 @@ class AssetsMacro if (path != null && path != "") { #if html5 - Sys.command("haxelib", ["run", "lime", "generate", "-font-hash", sys.FileSystem.fullPath(path)]); + Sys.command("haxelib run lime generate -font-hash \"" + sys.FileSystem.fullPath(path) + "\""); path += ".hash"; #end diff --git a/src/lime/system/CFFI.hx b/src/lime/system/CFFI.hx index 4f36f03067..2bcf6ff8b3 100644 --- a/src/lime/system/CFFI.hx +++ b/src/lime/system/CFFI.hx @@ -204,7 +204,7 @@ class CFFI #if (sys && !macro && !html5) try { - var proc = new Process("haxelib", ["path", library]); + var proc = new Process("haxelib path "+ library); if (proc != null) { diff --git a/src/lime/tools/AssetHelper.hx b/src/lime/tools/AssetHelper.hx index 4277b6c6f0..4dd5df2344 100644 --- a/src/lime/tools/AssetHelper.hx +++ b/src/lime/tools/AssetHelper.hx @@ -467,7 +467,7 @@ class AssetHelper for (handler in handlers) { var outputFile = System.getTemporaryFile(); - var args = ["run", handler, "process", temporaryFile, outputFile]; + var args = ["run", '"$handler"', "process", '"$temporaryFile"', '"$outputFile"']; if (Log.verbose) { @@ -476,7 +476,7 @@ class AssetHelper if (targetDirectory != null) { - args.push("--targetDirectory=" + Path.tryFullPath(targetDirectory)); + args.push("--targetDirectory=\"" + Path.tryFullPath(targetDirectory) + '"'); } try diff --git a/src/lime/tools/CPPHelper.hx b/src/lime/tools/CPPHelper.hx index 2fcf06639b..3773fb6730 100644 --- a/src/lime/tools/CPPHelper.hx +++ b/src/lime/tools/CPPHelper.hx @@ -273,8 +273,24 @@ class CPPHelper Sys.putEnv("HXCPP_COMPILE_THREADS", Std.string(threads)); } + var scoped = FileSystem.exists(".lime") && FileSystem.isDirectory(".lime"); + + if (scoped) + { + var localTemp = ".lime/temp"; + + System.recursiveCopy(path, localTemp); + + path = localTemp; + } + Sys.putEnv("HXCPP_EXIT_ON_ERROR", ""); Haxelib.runCommand(path, args); + + if (scoped) + { + System.removeDirectory(path); + } } } diff --git a/src/lime/tools/FlashHelper.hx b/src/lime/tools/FlashHelper.hx index a6465bdb06..0c0b15fd50 100644 --- a/src/lime/tools/FlashHelper.hx +++ b/src/lime/tools/FlashHelper.hx @@ -743,13 +743,13 @@ class FlashHelper // Have to daisy-chain it to fix Haxe compiler issue args.push ("-swf-lib"); - args.push (destination + "/.assets.swf"); + args.push ("\"" + destination + "/.assets.swf\""); args.push ("-D"); args.push ("flash-use-stage"); } - System.runCommand ("", "haxe", args); + System.runCommand ("", "haxe " + args.join(" "), null); if (FileSystem.exists (destination + "/.assets.swf")) { diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index b5ece9f141..5a6bcb8dd6 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -532,12 +532,13 @@ class HXProject extends Script var tempDirectory = System.getTemporaryDirectory(); var classFile = Path.combine(tempDirectory, name + ".hx"); var nekoOutput = Path.combine(tempDirectory, name + ".n"); + var hxpSourcesPath = Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src"); System.copyFile(path, classFile); #if lime var args = [ - name, "-main", "lime.tools.HXProject", "-cp", tempDirectory, "-neko", nekoOutput, "-cp", Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src"), + name, "-main", "lime.tools.HXProject", "-cp", '"$tempDirectory"', "-neko", '"$nekoOutput"', "-cp", '"$hxpSourcesPath"', "-lib", "lime", "-lib", "hxp" ]; #else @@ -547,9 +548,9 @@ class HXProject extends Script "-main", "lime.tools.HXProject", "-cp", - tempDirectory, + '"$tempDirectory"', "-cp", - Path.combine(Haxelib.getPath(new Haxelib("hxp")), "src") + '"$hxpSourcesPath"' ]; #end var input = File.read(classFile, false); @@ -575,7 +576,7 @@ class HXProject extends Script System.dryRun = false; #if lime - System.runCommand("", "haxe", args); + System.runCommand("", "haxe " + args.join(" "), null); #end var inputFile = Path.combine(tempDirectory, "input.dat"); @@ -602,9 +603,9 @@ class HXProject extends Script try { #if lime - System.runCommand("", "neko", [FileSystem.fullPath(nekoOutput), inputFile, outputFile]); + System.runCommand("", 'neko "${FileSystem.fullPath(nekoOutput)}" "$inputFile" "$outputFile"', null); #else - System.runCommand("", "haxe", args.concat(["--", inputFile, outputFile])); + System.runCommand("", "haxe " + args.concat(["--", '"$inputFile"', '"$outputFile"']).join(" "), null); #end } catch (e:Dynamic) diff --git a/src/lime/tools/ImageHelper.hx b/src/lime/tools/ImageHelper.hx index c6dab7a364..0676d2a3de 100644 --- a/src/lime/tools/ImageHelper.hx +++ b/src/lime/tools/ImageHelper.hx @@ -25,14 +25,14 @@ class ImageHelper try { - System.runCommand("", "neko", [ + System.runCommand("", "neko " + [ Path.combine(Haxelib.getPath(new Haxelib(#if lime "lime" #else "hxp" #end)), "svg.n"), "process", - path, + '"$path"', Std.string(width), Std.string(height), - temp - ], true, true); + '"$temp"' + ].join(" "), null, true, true); if (FileSystem.exists(temp)) { diff --git a/src/lime/tools/ModuleHelper.hx b/src/lime/tools/ModuleHelper.hx index d0c3e2a4ea..83cae1dddc 100644 --- a/src/lime/tools/ModuleHelper.hx +++ b/src/lime/tools/ModuleHelper.hx @@ -119,7 +119,7 @@ class ModuleHelper File.saveContent(importPath, moduleImport); File.saveContent(hxmlPath, hxml); - System.runCommand("", "haxe", [hxmlPath]); + System.runCommand("", 'haxe "$hxmlPath"', null); patchFile(outputPath); diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 73c1727e63..7fbd289d17 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -303,7 +303,7 @@ class CommandLineTools var cacheValue = Sys.getEnv("HAXELIB_PATH"); Sys.putEnv("HAXELIB_PATH", Haxelib.getRepositoryPath()); - System.runCommand(Path.directory(hxmlPath), "haxe", [Path.withoutDirectory(hxmlPath)]); + HXML.buildFile(hxmlPath, Sys.getCwd()); if (cacheValue != null) { @@ -437,7 +437,11 @@ class CommandLineTools var path = ""; - if (FileSystem.exists("tools.n")) + if (Path.normalize(Sys.getCwd()).substr(-6, 6) == "/.lime") + { + path = Path.combine(Sys.getCwd(), "/ndll/"); + } + else if (FileSystem.exists("tools.n")) { path = Path.combine(Sys.getCwd(), "../ndll/"); } @@ -448,7 +452,7 @@ class CommandLineTools if (path == "") { - var process = new Process("haxelib", ["path", "lime"]); + var process = new Process("haxelib path lime"); try { @@ -548,7 +552,7 @@ class CommandLineTools var exePath = Path.join([targetDir, "run.exe"]); var exeExists = FileSystem.exists(exePath); - var args = [command, temporaryFile]; + var args = [command, '"$temporaryFile"']; if (Log.verbose) args.push("-verbose"); if (!Log.enableColor) args.push("-nocolor"); @@ -1216,14 +1220,14 @@ class CommandLineTools var sourcePath = words[0]; var glyphs = "32-255"; - System.runCommand(Path.directory(sourcePath), "neko", [ - Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/hxswfml.n", + System.runCommand(Path.directory(sourcePath), "neko " + [ + '"${Haxelib.getPath(new Haxelib("lime")) + "/templates/bin/hxswfml.n"}"', "ttf2hash2", - Path.withoutDirectory(sourcePath), - Path.withoutDirectory(sourcePath) + ".hash", + '"${Path.withoutDirectory(sourcePath)}"', + '"${Path.withoutDirectory(sourcePath) + ".hash"}"', "-glyphs", glyphs - ]); + ].join(" "), null); } else if (targetFlags.exists("font-details")) { @@ -1643,7 +1647,7 @@ class CommandLineTools try { - var process = new Process("haxe", ["-version"]); + var process = new Process("haxe -version"); var haxeVersion = StringTools.trim(process.stderr.readAll().toString()); if (haxeVersion == "") diff --git a/tools/RunScript.hx b/tools/RunScript.hx index 5b4663cf07..449a7e3378 100644 --- a/tools/RunScript.hx +++ b/tools/RunScript.hx @@ -7,16 +7,17 @@ import sys.FileSystem; class RunScript { - private static function rebuildTools(rebuildBinaries = true):Void + private static function buildTools(targetDirectory:String = null, rebuildBinaries = true):Void { - var limeDirectory = Haxelib.getPath(new Haxelib("lime"), true); - var toolsDirectory = Path.combine(limeDirectory, "tools"); + var toolsHxmlPath = getToolsHxmlPath(); - if (!FileSystem.exists(toolsDirectory)) + if (targetDirectory == null) { - toolsDirectory = Path.combine(limeDirectory, "../tools"); + targetDirectory = Path.directory(toolsHxmlPath); } + Haxelib.workingDirectory = targetDirectory; + /*var extendedToolsDirectory = Haxelib.getPath (new Haxelib ("lime-extended"), false); if (extendedToolsDirectory != null && extendedToolsDirectory != "") { @@ -29,7 +30,7 @@ class RunScript } else {*/ - System.runCommand(toolsDirectory, "haxe", ["tools.hxml"]); + HXML.buildFile(toolsHxmlPath, targetDirectory); // } @@ -39,12 +40,12 @@ class RunScript for (platform in platforms) { - var source = Path.combine(limeDirectory, "ndll/" + platform + "/lime.ndll"); + var source = Path.combine(targetDirectory, "ndll/" + platform + "/lime.ndll"); // var target = Path.combine (toolsDirectory, "ndll/" + platform + "/lime.ndll"); if (!FileSystem.exists(source)) { - var args = ["tools/tools.n", "rebuild", "lime", "-release", "-nocffi"]; + var args = [Path.combine(targetDirectory, "tools.n"), "rebuild", "lime", "-release", "-nocffi"]; if (Log.verbose) { @@ -61,25 +62,25 @@ class RunScript case "Windows": if (System.hostPlatform == WINDOWS) { - System.runCommand(limeDirectory, "neko", args.concat(["windows", toolsDirectory])); + System.runCommand(targetDirectory, "neko", args.concat(["windows", targetDirectory])); } case "Mac", "Mac64": if (System.hostPlatform == MAC) { - System.runCommand(limeDirectory, "neko", args.concat(["mac", toolsDirectory])); + System.runCommand(targetDirectory, "neko", args.concat(["mac", targetDirectory])); } case "Linux": if (System.hostPlatform == LINUX && System.hostArchitecture != X64) { - System.runCommand(limeDirectory, "neko", args.concat(["linux", "-32", toolsDirectory])); + System.runCommand(targetDirectory, "neko", args.concat(["linux", "-32", targetDirectory])); } case "Linux64": if (System.hostPlatform == LINUX && System.hostArchitecture == X64) { - System.runCommand(limeDirectory, "neko", args.concat(["linux", "-64", toolsDirectory])); + System.runCommand(targetDirectory, "neko", args.concat(["linux", "-64", targetDirectory])); } } } @@ -135,10 +136,11 @@ class RunScript { var args = Sys.args(); - if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools") + var cacheDirectory = Sys.getCwd(); + + if (args.length > 0) { var lastArgument = new Path(args[args.length - 1]).toString(); - var cacheDirectory = Sys.getCwd(); if (((StringTools.endsWith(lastArgument, "/") && lastArgument != "/") || StringTools.endsWith(lastArgument, "\\")) && !StringTools.endsWith(lastArgument, ":\\")) @@ -150,8 +152,12 @@ class RunScript { Sys.setCwd(lastArgument); } + } + + var workingDirectory = Sys.getCwd(); - Haxelib.workingDirectory = Sys.getCwd(); + if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools") + { var rebuildBinaries = true; for (arg in args) @@ -187,7 +193,7 @@ class RunScript } } - rebuildTools(rebuildBinaries); + rebuildTools(workingDirectory, rebuildBinaries); if (args.indexOf("-openfl") > -1) { @@ -198,13 +204,84 @@ class RunScript Sys.exit(0); } } + else if (args.length > 1 && args[0] == "scope") + { + switch args[1] + { + case "create": + System.makeDirectory(".lime"); + + case "delete": + System.removeDirectory(".lime"); + + default: + Log.error("Incorrect arguments for command 'scope'"); + } + + return; + } + + var toolsPath:String = checkTools(workingDirectory, args); + var args = [Path.withoutDirectory(toolsPath)].concat(args); + Sys.exit(runCommand(Path.directory(toolsPath), "neko", args)); + + } + + private static function checkTools(workingDirectory:String, args:Array):String + { + var toolsPath:String = getToolsPath(workingDirectory); + var toolsDest = Path.directory(toolsPath); + + if (!hasTools(toolsDest) || args.indexOf("-rebuild") > -1) + { + buildTools(toolsDest); + } - if (!FileSystem.exists("tools/tools.n") || args.indexOf("-rebuild") > -1) + return toolsPath; + } + + private static function rebuildTools(workingDirectory:String, rebuildBinaries = true):String + { + var toolsPath = getToolsPath(workingDirectory); + var toolsDest = Path.directory(toolsPath); + + buildTools(toolsDest, rebuildBinaries); + + return toolsPath; + } + + private static function hasTools(directory:String):Bool + { + return FileSystem.exists(directory + "/tools.n"); + } + + private static function getToolsHxmlPath():String + { + var toolsDirectory:String = Path.combine(Haxelib.getPath(new Haxelib("lime"), true), "tools"); + + if (!FileSystem.exists(toolsDirectory)) + { + toolsDirectory = Path.combine(toolsDirectory, "../../tools"); + } + + return toolsDirectory + "/tools.hxml"; + } + + private static function getToolsPath(workingDirectory:String):String + { + var scopeDirectory:String = workingDirectory + "/.lime"; + + var targetDirectory:String; + + if (FileSystem.exists(scopeDirectory) && FileSystem.isDirectory(scopeDirectory)) + { + targetDirectory = scopeDirectory; + } + else { - rebuildTools(); + targetDirectory = Path.directory(getToolsHxmlPath()); } - var args = ["tools/tools.n"].concat(args); - Sys.exit(runCommand("", "neko", args)); + return targetDirectory + "/tools.n"; } } diff --git a/tools/SVGExport.hx b/tools/SVGExport.hx index c11c9774d5..d051b009de 100644 --- a/tools/SVGExport.hx +++ b/tools/SVGExport.hx @@ -29,7 +29,7 @@ class SVGExport if (path == "") { - var process = new Process("haxelib", ["path", "lime"]); + var process = new Process("haxelib path lime"); try { diff --git a/tools/platforms/AndroidPlatform.hx b/tools/platforms/AndroidPlatform.hx index f0f6f35d0e..44c88f10d4 100644 --- a/tools/platforms/AndroidPlatform.hx +++ b/tools/platforms/AndroidPlatform.hx @@ -71,7 +71,7 @@ class AndroidPlatform extends PlatformTarget for (architecture in architectures) { - var haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-16"]; + var haxeParams = ['"$hxml"', "-D", "android", "-D", "PLATFORM=android-16"]; var cppParams = ["-Dandroid", "-DPLATFORM=android-16"]; var path = sourceSet + "/jniLibs/armeabi"; var suffix = ".so"; @@ -86,7 +86,7 @@ class AndroidPlatform extends PlatformTarget } else if (architecture == Architecture.ARM64) { - haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-21"]; + haxeParams = ['"$hxml"', "-D", "android", "-D", "PLATFORM=android-21"]; cppParams = ["-Dandroid", "-DPLATFORM=android-21"]; haxeParams.push("-D"); @@ -105,7 +105,7 @@ class AndroidPlatform extends PlatformTarget } else if (architecture == Architecture.X64) { - haxeParams = [hxml, "-D", "android", "-D", "PLATFORM=android-21"]; + haxeParams = ['"$hxml"', "-D", "android", "-D", "PLATFORM=android-21"]; cppParams = ["-Dandroid", "-DPLATFORM=android-21"]; haxeParams.push("-D"); @@ -120,7 +120,7 @@ class AndroidPlatform extends PlatformTarget ProjectHelper.copyLibrary(project, ndll, "Android", "lib", suffix, path, project.debug, ".so"); } - System.runCommand("", "haxe", haxeParams); + System.runCommand("", "haxe " + haxeParams.join(" "), null); if (noOutput) return; diff --git a/tools/platforms/EmscriptenPlatform.hx b/tools/platforms/EmscriptenPlatform.hx index be4f44e226..2431818517 100644 --- a/tools/platforms/EmscriptenPlatform.hx +++ b/tools/platforms/EmscriptenPlatform.hx @@ -49,7 +49,7 @@ class EmscriptenPlatform extends PlatformTarget } var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - var args = [hxml, "-D", "emscripten", "-D", "webgl", "-D", "static_link"]; + var args = ['"$hxml"', "-D", "emscripten", "-D", "webgl", "-D", "static_link"]; if (Log.verbose) { @@ -57,7 +57,7 @@ class EmscriptenPlatform extends PlatformTarget args.push("verbose"); } - System.runCommand("", "haxe", args); + System.runCommand("", "haxe " + args.join(" "), null); if (noOutput) return; diff --git a/tools/platforms/FlashPlatform.hx b/tools/platforms/FlashPlatform.hx index 793a2e53b5..b32cc7fead 100644 --- a/tools/platforms/FlashPlatform.hx +++ b/tools/platforms/FlashPlatform.hx @@ -38,7 +38,8 @@ class FlashPlatform extends PlatformTarget public override function build():Void { - System.runCommand("", "haxe", [targetDirectory + "/haxe/" + buildType + ".hxml"]); + var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; + System.runCommand("", 'haxe "$hxml"', null); } public override function clean():Void diff --git a/tools/platforms/HTML5Platform.hx b/tools/platforms/HTML5Platform.hx index 3161629256..1b2b4a9616 100644 --- a/tools/platforms/HTML5Platform.hx +++ b/tools/platforms/HTML5Platform.hx @@ -66,7 +66,7 @@ class HTML5Platform extends PlatformTarget } var hxml = targetDirectory + "/haxe/" + type + ".hxml"; - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; diff --git a/tools/platforms/LinuxPlatform.hx b/tools/platforms/LinuxPlatform.hx index f0aa37244c..9307b40599 100644 --- a/tools/platforms/LinuxPlatform.hx +++ b/tools/platforms/LinuxPlatform.hx @@ -116,7 +116,7 @@ class LinuxPlatform extends PlatformTarget if (targetType == "neko") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -133,7 +133,7 @@ class LinuxPlatform extends PlatformTarget } else if (targetType == "hl") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -145,7 +145,7 @@ class LinuxPlatform extends PlatformTarget } else if (targetType == "nodejs") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); // NekoHelper.createExecutable (project.templatePaths, "linux" + (is64 ? "64" : ""), targetDirectory + "/obj/ApplicationMain.n", executablePath); // NekoHelper.copyLibraries (project.templatePaths, "linux" + (is64 ? "64" : ""), applicationDirectory); } @@ -153,7 +153,7 @@ class LinuxPlatform extends PlatformTarget { var libPath = Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/java/lib/"); - System.runCommand("", "haxe", [hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar"]); + System.runCommand("", "haxe " + ['"$hxml"', "-java-lib", '"$libPath"' + "disruptor.jar", "-java-lib", '"$libPath"' + "lwjgl.jar"].join(" "), null); // System.runCommand ("", "haxe", [ hxml ]); if (noOutput) return; @@ -168,7 +168,7 @@ class LinuxPlatform extends PlatformTarget + (haxeVersion.length == 5 ? "0" + haxeVersion.charAt(4) : haxeVersion.charAt(4) + haxeVersion.charAt(5)); } - System.runCommand(targetDirectory + "/obj", "haxelib", ["run", "hxjava", "hxjava_build.txt", "--haxe-version", haxeVersionString]); + System.runCommand(targetDirectory + "/obj", "haxelib run hxjava hxjava_build.txt --haxe-version " + haxeVersionString, null); System.recursiveCopy(targetDirectory + "/obj/lib", Path.combine(applicationDirectory, "lib")); System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", Path.combine(applicationDirectory, project.app.file + ".jar")); @@ -176,7 +176,7 @@ class LinuxPlatform extends PlatformTarget } else { - var haxeArgs = [hxml]; + var haxeArgs = ['"$hxml"']; var flags = []; if (is64) @@ -194,7 +194,7 @@ class LinuxPlatform extends PlatformTarget if (!project.targetFlags.exists("static")) { - System.runCommand("", "haxe", haxeArgs); + System.runCommand("", "haxe " + haxeArgs.join(" "), null); if (noOutput) return; @@ -204,7 +204,7 @@ class LinuxPlatform extends PlatformTarget } else { - System.runCommand("", "haxe", haxeArgs.concat(["-D", "static_link"])); + System.runCommand("", "haxe " + haxeArgs.concat(["-D", "static_link"]).join(" "), null); if (noOutput) return; diff --git a/tools/platforms/MacPlatform.hx b/tools/platforms/MacPlatform.hx index e65f23a4d4..1e98969947 100644 --- a/tools/platforms/MacPlatform.hx +++ b/tools/platforms/MacPlatform.hx @@ -109,7 +109,7 @@ class MacPlatform extends PlatformTarget if (targetType == "neko") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -118,7 +118,7 @@ class MacPlatform extends PlatformTarget } else if (targetType == "hl") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -132,11 +132,11 @@ class MacPlatform extends PlatformTarget { var libPath = Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/java/lib/"); - System.runCommand("", "haxe", [hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar"]); + System.runCommand("", "haxe " + ['"$hxml"', "-java-lib", '"$libPath"' + "disruptor.jar", "-java-lib", '"$libPath"' + "lwjgl.jar"].join(" "), null); if (noOutput) return; - Haxelib.runCommand(targetDirectory + "/obj", ["run", "hxjava", "hxjava_build.txt", "--haxe-version", "3103"]); + Haxelib.runCommand(targetDirectory + "/obj", ["run", "hxjava", "hxjava_build.txt", "--haxe-version", "3103"], false); System.recursiveCopy(targetDirectory + "/obj/lib", Path.combine(executableDirectory, "lib")); System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", Path.combine(executableDirectory, project.app.file + ".jar")); @@ -144,7 +144,7 @@ class MacPlatform extends PlatformTarget } else if (targetType == "nodejs") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -153,7 +153,7 @@ class MacPlatform extends PlatformTarget } else if (targetType == "cs") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -167,7 +167,7 @@ class MacPlatform extends PlatformTarget } else { - var haxeArgs = [hxml, "-D", "HXCPP_CLANG"]; + var haxeArgs = ['"$hxml"', "-D", "HXCPP_CLANG"]; var flags = ["-DHXCPP_CLANG"]; if (is64) @@ -179,7 +179,7 @@ class MacPlatform extends PlatformTarget if (!project.targetFlags.exists("static")) { - System.runCommand("", "haxe", haxeArgs); + System.runCommand("", "haxe " + haxeArgs.join(" "), null); if (noOutput) return; @@ -189,7 +189,7 @@ class MacPlatform extends PlatformTarget } else { - System.runCommand("", "haxe", haxeArgs.concat(["-D", "static_link"])); + System.runCommand("", "haxe " + haxeArgs.concat(["-D", "static_link"]).join(" "), null); if (noOutput) return; diff --git a/tools/platforms/TizenPlatform.hx b/tools/platforms/TizenPlatform.hx index 808b130588..ca0a17624d 100644 --- a/tools/platforms/TizenPlatform.hx +++ b/tools/platforms/TizenPlatform.hx @@ -45,7 +45,7 @@ class TizenPlatform extends PlatformTarget var hxml = targetDirectory + "/haxe/" + buildType + ".hxml"; - System.runCommand("", "haxe", [hxml, "-D", "tizen"]); + System.runCommand("", 'haxe "$hxml" -D tizen', null); if (noOutput) return; diff --git a/tools/platforms/WindowsPlatform.hx b/tools/platforms/WindowsPlatform.hx index b3ff775604..8f5d55fb5e 100644 --- a/tools/platforms/WindowsPlatform.hx +++ b/tools/platforms/WindowsPlatform.hx @@ -92,7 +92,7 @@ class WindowsPlatform extends PlatformTarget { try { - var process = new Process("haxe", ["-version"]); + var process = new Process("haxe -version"); var haxeVersion = StringTools.trim(process.stderr.readAll().toString()); if (haxeVersion == "") { @@ -143,7 +143,7 @@ class WindowsPlatform extends PlatformTarget if (project.app.main != null) { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); var msBuildPath = "C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\MSBuild\\15.0\\Bin\\MSBuild.exe"; var args = [ @@ -218,7 +218,7 @@ class WindowsPlatform extends PlatformTarget if (targetType == "neko") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -234,7 +234,7 @@ class WindowsPlatform extends PlatformTarget } else if (targetType == "hl") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -253,7 +253,7 @@ class WindowsPlatform extends PlatformTarget } else if (targetType == "cppia") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -270,7 +270,7 @@ class WindowsPlatform extends PlatformTarget } else if (targetType == "nodejs") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -279,7 +279,7 @@ class WindowsPlatform extends PlatformTarget } else if (targetType == "cs") { - System.runCommand("", "haxe", [hxml]); + System.runCommand("", 'haxe "$hxml"', null); if (noOutput) return; @@ -293,8 +293,8 @@ class WindowsPlatform extends PlatformTarget { var libPath = Path.combine(Haxelib.getPath(new Haxelib("lime")), "templates/java/lib/"); - System.runCommand("", "haxe", [hxml, "-java-lib", libPath + "disruptor.jar", "-java-lib", libPath + "lwjgl.jar"]); - // System.runCommand ("", "haxe", [ hxml ]); + System.runCommand("", 'haxe "$hxml" -java-lib "${libPath + "disruptor.jar"}" -java-lib "${libPath + "lwjgl.jar"}"', null); + // System.runCommand ("", "haxe " + hxml, null); if (noOutput) return; @@ -308,7 +308,7 @@ class WindowsPlatform extends PlatformTarget + (haxeVersion.length == 5 ? "0" + haxeVersion.charAt(4) : haxeVersion.charAt(4) + haxeVersion.charAt(5)); } - System.runCommand(targetDirectory + "/obj", "haxelib", ["run", "hxjava", "hxjava_build.txt", "--haxe-version", haxeVersionString]); + System.runCommand(targetDirectory + "/obj", "haxelib run hxjava hxjava_build.txt --haxe-version " + haxeVersionString, null); System.recursiveCopy(targetDirectory + "/obj/lib", Path.combine(applicationDirectory, "lib")); System.copyFile(targetDirectory + "/obj/ApplicationMain" + (project.debug ? "-Debug" : "") + ".jar", Path.combine(applicationDirectory, project.app.file + ".jar")); @@ -316,7 +316,7 @@ class WindowsPlatform extends PlatformTarget } else if (targetType == "winrt") { - var haxeArgs = [hxml]; + var haxeArgs = ['"$hxml"']; var flags = []; haxeArgs.push("-D"); @@ -345,7 +345,7 @@ class WindowsPlatform extends PlatformTarget if (!project.targetFlags.exists("static")) { - System.runCommand("", "haxe", haxeArgs); + System.runCommand("", "haxe " + haxeArgs.join(" "), null); if (noOutput) return; @@ -355,7 +355,7 @@ class WindowsPlatform extends PlatformTarget } else { - System.runCommand("", "haxe", haxeArgs.concat(["-D", "static_link"])); + System.runCommand("", "haxe " + haxeArgs.join(" ") + " -D static_link", null); if (noOutput) return; @@ -376,7 +376,7 @@ class WindowsPlatform extends PlatformTarget } else { - var haxeArgs = [hxml]; + var haxeArgs = ['"$hxml"']; var flags = []; if (is64) @@ -399,7 +399,7 @@ class WindowsPlatform extends PlatformTarget if (!project.targetFlags.exists("static")) { - System.runCommand("", "haxe", haxeArgs); + System.runCommand("", "haxe " + haxeArgs.join(" "), null); if (noOutput) return; @@ -409,7 +409,7 @@ class WindowsPlatform extends PlatformTarget } else { - System.runCommand("", "haxe", haxeArgs.concat(["-D", "static_link"])); + System.runCommand("", "haxe " + haxeArgs.join(" ") + " -D static_link", null); if (noOutput) return; diff --git a/tools/utils/JavaExternGenerator.hx b/tools/utils/JavaExternGenerator.hx index 5213e7f35e..ca006fd7b6 100644 --- a/tools/utils/JavaExternGenerator.hx +++ b/tools/utils/JavaExternGenerator.hx @@ -205,7 +205,7 @@ class JavaExternGenerator public static function getHaxelib(library:String):String { - var proc = new Process("haxelib", ["path", library]); + var proc = new Process("haxelib path " + library); var result = ""; try