Improve use of tools without haxelib

This commit is contained in:
Joshua Granick
2015-12-28 13:43:20 -08:00
parent bc30dc7645
commit a0e03e6b35
5 changed files with 47 additions and 14 deletions

View File

@@ -433,6 +433,20 @@ class CommandLineTools {
}
if (path == "") {
if (FileSystem.exists ("tools.n")) {
path = PathHelper.combine (Sys.getCwd (), "../");
} else if (FileSystem.exists ("run.n")) {
path = Sys.getCwd ();
}
}
process.close ();
path += "/ndll/";
@@ -520,15 +534,15 @@ class CommandLineTools {
args = args.concat (additionalArguments);
}
if (exeExists) {
ProcessHelper.runCommand ("", exePath, args);
} else {
if (exeExists) {
ProcessHelper.runCommand ("", exePath, args);
} else {
ProcessHelper.runCommand ("", "haxelib", ["run", handler].concat (args));
}
try {
@@ -1412,12 +1426,13 @@ class CommandLineTools {
private function processArguments ():Void {
var arguments = Sys.args ();
var runFromHaxelib = false;
if (arguments.length > 0) {
// When the command-line tools are called from haxelib,
// the last argument is the project directory and the
// path to NME is the current working directory
// path to Lime is the current working directory
var lastArgument = "";
@@ -1439,6 +1454,25 @@ class CommandLineTools {
if (FileSystem.exists (lastArgument) && FileSystem.isDirectory (lastArgument)) {
Sys.setCwd (lastArgument);
runFromHaxelib = true;
} else {
arguments.push (lastArgument);
}
}
if (!runFromHaxelib) {
if (FileSystem.exists ("tools.n")) {
PathHelper.haxelibOverrides.set ("lime", PathHelper.combine (Sys.getCwd (), "../"));
} else if (FileSystem.exists ("run.n")) {
PathHelper.haxelibOverrides.set ("lime", Sys.getCwd ());
}

View File

@@ -160,11 +160,8 @@ class RunScript {
public static function main () {
var args = Sys.args ();
if (args.length == 0) return;
var command = args[0].toLowerCase ();
if (args.length > 2 && command == "rebuild" && args[1] == "tools") {
if (args.length > 2 && args[0] == "rebuild" && args[1] == "tools") {
var lastArgument = new Path (args[args.length - 1]).toString ();

View File

@@ -1,6 +1,7 @@
-main SVGExport
-neko ../svg.n
-lib lime
-D lime
-cp ..
-lib openfl
-lib svg
-D lime_cairo

View File

@@ -1,7 +1,8 @@
-main CommandLineTools
-neko tools.n
-D lime-curl
-lib lime
-D lime
-cp ..
-lib format
#-lib svg
-D optional_cffi