From 1b310dcc456746580b63b8920a2c68d0b9c9dce0 Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Sat, 6 Nov 2021 14:56:31 -0400 Subject: [PATCH 1/2] Add support for include.hxp. Note that all paths in an include.hxp file must be absolute. Fortunately, `Sys.getCwd()` works as expected. --- src/lime/tools/HXProject.hx | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/src/lime/tools/HXProject.hx b/src/lime/tools/HXProject.hx index 78eab0213..58b6c89ac 100644 --- a/src/lime/tools/HXProject.hx +++ b/src/lime/tools/HXProject.hx @@ -540,37 +540,48 @@ class HXProject extends Script return HXProject.fromPath(path, userDefines); } - public static function fromPath(path:String, userDefines:Map = null):HXProject + public static function fromPath(directory:String, userDefines:Map = null):HXProject { - if (!FileSystem.exists(path) || !FileSystem.isDirectory(path)) + if (!FileSystem.exists(directory) || !FileSystem.isDirectory(directory)) { return null; } - var files = ["include.lime", "include.nmml", "include.xml"]; + var files = ["include.lime", "include.nmml", "include.xml", "include.hxp"]; var projectFile = null; for (file in files) { - if (projectFile == null && FileSystem.exists(Path.combine(path, file))) + if (FileSystem.exists(Path.combine(directory, file))) { - projectFile = Path.combine(path, file); + projectFile = Path.combine(directory, file); + break; } } + var project = null; + if (projectFile != null) { - var project = new ProjectXMLParser(projectFile, userDefines); + if (StringTools.endsWith(projectFile, ".hxp")) + { + var cwd = Sys.getCwd(); + Sys.setCwd(directory); + project = HXProject.fromFile(projectFile, userDefines); + Sys.setCwd(cwd); + } + else + { + project = new ProjectXMLParser(projectFile, userDefines); + } if (project.config.get("project.rebuild.path") == null) { - project.config.set("project.rebuild.path", Path.combine(path, "project")); + project.config.set("project.rebuild.path", Path.combine(directory, "project")); } - - return project; } - return null; + return project; } private function getHaxelibVersion(haxelib:Haxelib):String From 83b39e918443d97bb4a99839e7a691e2ad644664 Mon Sep 17 00:00:00 2001 From: Joseph Cloutier Date: Mon, 13 Jun 2022 15:57:23 -0400 Subject: [PATCH 2/2] Don't treat include.hxp as a complete project. --- tools/CommandLineTools.hx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/CommandLineTools.hx b/tools/CommandLineTools.hx index 8f693435a..11358fd65 100644 --- a/tools/CommandLineTools.hx +++ b/tools/CommandLineTools.hx @@ -1179,7 +1179,7 @@ class CommandLineTools if ((extension == "lime" && file != "include.lime") || (extension == "nmml" && file != "include.nmml") || (extension == "xml" && file != "include.xml") - || extension == "hxp") + || (extension == "hxp" && file != "include.hxp")) { matches.get(extension).push(path); }