Allow fallback to alternate tools if setting HAXELIB_PATH in project
This commit is contained in:
@@ -70,6 +70,7 @@ class HXProject {
|
||||
private var defaultApp:ApplicationData;
|
||||
private var defaultMeta:MetaData;
|
||||
private var defaultWindow:WindowData;
|
||||
private var needRerun:Bool;
|
||||
|
||||
public static var _command:String;
|
||||
public static var _debug:Bool;
|
||||
|
||||
@@ -1163,9 +1163,30 @@ class ProjectXMLParser extends HXProject {
|
||||
|
||||
var name = substitute (element.att.name);
|
||||
|
||||
defines.set (name, value);
|
||||
environment.set (name, value);
|
||||
setenv (name, value);
|
||||
if (name == "HAXELIB_PATH") {
|
||||
|
||||
var currentPath = HaxelibHelper.getRepositoryPath ();
|
||||
|
||||
defines.set (name, value);
|
||||
environment.set (name, value);
|
||||
setenv (name, value);
|
||||
|
||||
var newPath = HaxelibHelper.getRepositoryPath (true);
|
||||
|
||||
if (currentPath != newPath) {
|
||||
|
||||
needRerun = true;
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
defines.set (name, value);
|
||||
environment.set (name, value);
|
||||
setenv (name, value);
|
||||
|
||||
}
|
||||
|
||||
case "error":
|
||||
|
||||
|
||||
@@ -81,9 +81,9 @@ class HaxelibHelper {
|
||||
}
|
||||
|
||||
|
||||
public static function getRepositoryPath ():String {
|
||||
public static function getRepositoryPath (clearCache:Bool = false):String {
|
||||
|
||||
if (repositoryPath == null) {
|
||||
if (repositoryPath == null || clearCache) {
|
||||
|
||||
var cache = LogHelper.verbose;
|
||||
LogHelper.verbose = debug;
|
||||
|
||||
@@ -20,6 +20,8 @@ import utils.CreateTemplate;
|
||||
import utils.JavaExternGenerator;
|
||||
import utils.PlatformSetup;
|
||||
|
||||
@:access(lime.project.HXProject)
|
||||
|
||||
|
||||
class CommandLineTools {
|
||||
|
||||
@@ -1695,6 +1697,30 @@ class CommandLineTools {
|
||||
|
||||
}
|
||||
|
||||
if (project != null && project.needRerun && !project.targetFlags.exists ("norerun")) {
|
||||
|
||||
HaxelibHelper.pathOverrides.remove ("lime");
|
||||
var workingDirectory = Sys.getCwd ();
|
||||
var limePath = HaxelibHelper.getPath (new Haxelib ("lime"), true, true);
|
||||
Sys.setCwd (workingDirectory);
|
||||
|
||||
LogHelper.info ("", LogHelper.accentColor + "Requesting alternate tools from custom haxelib path...\x1b[0m\n\n");
|
||||
|
||||
var args = Sys.args ();
|
||||
args.pop ();
|
||||
|
||||
Sys.setCwd (limePath);
|
||||
|
||||
args = [ PathHelper.combine (limePath, "run.n") ].concat (args);
|
||||
args.push ("--haxelib-lime=" + limePath);
|
||||
args.push ("-norerun");
|
||||
args.push (workingDirectory);
|
||||
|
||||
Sys.exit (Sys.command ("neko", args));
|
||||
return null;
|
||||
|
||||
}
|
||||
|
||||
if (project == null || (command != "rebuild" && project.sources.length == 0 && !FileSystem.exists (project.app.main + ".hx"))) {
|
||||
|
||||
LogHelper.error ("You must have a \"project.xml\" file or specify another valid project file when using the '" + command + "' command");
|
||||
|
||||
Reference in New Issue
Block a user