Add support for overriding otarget output directory

This commit is contained in:
Joshua Granick
2017-06-19 16:29:13 -07:00
parent 22d02c2888
commit b40f82b6e7
13 changed files with 49 additions and 26 deletions

View File

@@ -362,7 +362,7 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
}
public function parse (elem:Fast):Void {
public function parse (elem:Fast, substitute:String->String = null):Void {
var bucket = this;
var bucketType = "";
@@ -386,21 +386,22 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
}
parseAttributes (elem, bucket);
parseChildren (elem, bucket);
parseAttributes (elem, bucket, substitute);
parseChildren (elem, bucket, 0, substitute);
log ("> current config : " + this);
}
private function parseAttributes (elem:Fast, bucket:Dynamic):Void {
private function parseAttributes (elem:Fast, bucket:Dynamic, substitute:String->String = null):Void {
for (attrName in elem.x.attributes ()) {
if (attrName != "type") {
var attrValue = elem.x.get (attrName);
if (substitute != null) attrValue = substitute (attrValue);
setNode (bucket, attrName, attrValue);
}
@@ -410,7 +411,7 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
}
private function parseChildren (elem:Fast, bucket:Dynamic, depth:Int = 0):Void {
private function parseChildren (elem:Fast, bucket:Dynamic, depth:Int = 0, substitute:String->String = null):Void {
for (child in elem.elements) {
@@ -437,19 +438,19 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
if (hasAttributes) {
parseAttributes (child, arrayBucket);
parseAttributes (child, arrayBucket, substitute);
}
if (hasChildren) {
parseChildren (child, arrayBucket, d);
parseChildren (child, arrayBucket, d, substitute);
}
if (!hasChildren && !hasAttributes) {
parseValue (child, arrayBucket);
parseValue (child, arrayBucket, substitute);
}
@@ -457,7 +458,7 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
if (!hasChildren && !hasAttributes) {
parseValue (child, bucket);
parseValue (child, bucket, substitute);
} else {
@@ -465,13 +466,13 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
if (hasAttributes) {
parseAttributes (child, childBucket);
parseAttributes (child, childBucket, substitute);
}
if (hasChildren) {
parseChildren (child, childBucket, d);
parseChildren (child, childBucket, d, substitute);
}
@@ -483,11 +484,13 @@ abstract ConfigData(Dynamic) to Dynamic from Dynamic {
}
private function parseValue (elem:Fast, bucket:Dynamic):Void {
private function parseValue (elem:Fast, bucket:Dynamic, substitute:String->String = null):Void {
if (elem.innerHTML != "") {
setNode (bucket, elem.name, elem.innerHTML);
var value = elem.innerHTML;
if (substitute != null) value = substitute (value);
setNode (bucket, elem.name, value);
}

View File

@@ -66,44 +66,53 @@ class ProjectXMLParser extends HXProject {
case MOBILE:
defines.set ("platformType", "mobile");
defines.set ("mobile", "1");
case DESKTOP:
defines.set ("platformType", "desktop");
defines.set ("desktop", "1");
case WEB:
defines.set ("platformType", "web");
defines.set ("web", "1");
case CONSOLE:
defines.set ("platformType", "console");
defines.set ("console", "1");
}
if (targetFlags.exists ("neko")) {
defines.set ("targetType", "neko");
defines.set ("native", "1");
defines.set ("neko", "1");
} else if (targetFlags.exists ("java")) {
defines.set ("targetType", "java");
defines.set ("native", "1");
defines.set ("java", "1");
} else if (targetFlags.exists ("nodejs")) {
defines.set ("targetType", "nodejs");
defines.set ("native", "1");
defines.set ("nodejs", "1");
} else if (targetFlags.exists ("cs")) {
defines.set ("targetType", "cs");
defines.set ("native", "1");
defines.set ("cs", "1");
} else if (target == Platform.FIREFOX) {
defines.set ("targetType", "js");
defines.set ("html5", "1");
} else if (platformType == DESKTOP && target != PlatformHelper.hostPlatform) {
@@ -112,32 +121,42 @@ class ProjectXMLParser extends HXProject {
if (target == Platform.WINDOWS) {
defines.set ("targetType", "cpp");
defines.set ("cpp", "1");
defines.set ("mingw", "1");
} else {
defines.set ("targetType", "neko");
defines.set ("neko", "1");
}
} else if (targetFlags.exists ("cpp") || ((platformType != PlatformType.WEB) && !targetFlags.exists ("html5")) || target == Platform.EMSCRIPTEN) {
defines.set ("targetType", "cpp");
defines.set ("native", "1");
defines.set ("cpp", "1");
} else if (target == Platform.FLASH) {
defines.set ("targetType", "swf");
}
if (debug) {
defines.set ("buildType", "debug");
defines.set ("debug", "1");
} else if (targetFlags.exists ("final")) {
defines.set ("buildType", "final");
defines.set ("final", "1");
} else {
defines.set ("buildType", "release");
defines.set ("release", "1");
}
@@ -156,6 +175,7 @@ class ProjectXMLParser extends HXProject {
defines.set (Std.string (target).toLowerCase (), "1");
defines.set ("target", Std.string (target).toLowerCase ());
defines.set ("platform", defines.get ("target"));
}
@@ -2044,7 +2064,7 @@ class ProjectXMLParser extends HXProject {
case "config":
config.parse (element);
config.parse (element, substitute);
case "prebuild":
@@ -2058,7 +2078,7 @@ class ProjectXMLParser extends HXProject {
if (StringTools.startsWith (element.name, "config:")) {
config.parse (element);
config.parse (element, substitute);
}

View File

@@ -52,7 +52,7 @@ class AndroidPlatform extends PlatformTarget {
}
targetDirectory = project.app.path + "/android/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("android.output-directory", "android/" + buildType));
}

View File

@@ -29,7 +29,7 @@ class EmscriptenPlatform extends PlatformTarget {
super (command, _project, targetFlags);
targetDirectory = project.app.path + "/emscripten/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("emscripten.output-directory", "emscripten/" + buildType));
outputFile = targetDirectory + "/bin/" + project.app.file + ".js";
}

View File

@@ -42,7 +42,7 @@ class FirefoxPlatform extends HTML5Platform {
private override function initialize (command:String, project:HXProject):Void {
targetDirectory = project.app.path + "/firefox/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("firefox.output-directory", "firefox/" + buildType));
outputFile = targetDirectory + "/bin/" + project.app.file + ".js";
}

View File

@@ -37,7 +37,7 @@ class FlashPlatform extends PlatformTarget {
super (command, _project, targetFlags);
targetDirectory = project.app.path + "/flash/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("flash.output-directory", "flash/" + buildType));
}

View File

@@ -110,7 +110,7 @@ class HTML5Platform extends PlatformTarget {
private function initialize (command:String, project:HXProject):Void {
targetDirectory = project.app.path + "/html5/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("html5.output-directory", "html5/" + buildType));
outputFile = targetDirectory + "/bin/" + project.app.file + ".js";
}

View File

@@ -38,7 +38,7 @@ class IOSPlatform extends PlatformTarget {
super (command, _project, targetFlags);
targetDirectory = PathHelper.combine (project.app.path, "ios/" + buildType);
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("ios.output-directory", "ios/" + buildType));
}

View File

@@ -71,7 +71,7 @@ class LinuxPlatform extends PlatformTarget {
}
targetDirectory = project.app.path + "/linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "") + "/" + targetType + "/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("linux.output-directory", "linux" + (is64 ? "64" : "") + (isRaspberryPi ? "-rpi" : "") + "/" + targetType + "/" + buildType));
applicationDirectory = targetDirectory + "/bin/";
executablePath = PathHelper.combine (applicationDirectory, project.app.file);

View File

@@ -75,7 +75,7 @@ class MacPlatform extends PlatformTarget {
}
targetDirectory = project.app.path + "/mac" + (is64 ? "64" : "") + "/" + targetType + "/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("mac.output-directory", "mac" + (is64 ? "64" : "") + "/" + targetType + "/" + buildType));
applicationDirectory = targetDirectory + "/bin/" + project.app.file + ".app";
contentDirectory = applicationDirectory + "/Contents/Resources";
executableDirectory = applicationDirectory + "/Contents/MacOS";

View File

@@ -38,7 +38,7 @@ class TVOSPlatform extends PlatformTarget {
super (command, _project, targetFlags);
targetDirectory = PathHelper.combine (project.app.path, "tvos/" + buildType);
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("tvos.output-directory", "tvos/" + buildType));
}

View File

@@ -28,7 +28,7 @@ class TizenPlatform extends PlatformTarget {
super (command, _project, targetFlags);
targetDirectory = project.app.path + "/tizen/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("tizen.output-directory", "tizen/" + buildType));
}

View File

@@ -68,7 +68,7 @@ class WindowsPlatform extends PlatformTarget {
}
targetDirectory = project.app.path + "/windows" + (is64 ? "64" : "") + "/" + targetType + "/" + buildType;
targetDirectory = PathHelper.combine (project.app.path, project.config.getString ("windows.output-directory", "windows" + (is64 ? "64" : "") + "/" + targetType + "/" + buildType));
applicationDirectory = targetDirectory + "/bin/";
executablePath = applicationDirectory + project.app.file + ".exe";