Add -dryrun flag for testing, improve the behavior of 'rebuild'
This commit is contained in:
@@ -19,8 +19,6 @@
|
|||||||
|
|
||||||
<section unless="display || lime-legacy">
|
<section unless="display || lime-legacy">
|
||||||
|
|
||||||
<haxelib name="hxcpp" if="cpp" />
|
|
||||||
|
|
||||||
<ndll name="std" haxelib="hxcpp" if="cpp" />
|
<ndll name="std" haxelib="hxcpp" if="cpp" />
|
||||||
<ndll name="regexp" haxelib="hxcpp" if="cpp" />
|
<ndll name="regexp" haxelib="hxcpp" if="cpp" />
|
||||||
<ndll name="zlib" haxelib="hxcpp" if="cpp" />
|
<ndll name="zlib" haxelib="hxcpp" if="cpp" />
|
||||||
|
|||||||
@@ -1560,6 +1560,10 @@ class CommandLineTools {
|
|||||||
argument = "-verbose";
|
argument = "-verbose";
|
||||||
LogHelper.verbose = true;
|
LogHelper.verbose = true;
|
||||||
|
|
||||||
|
} else if (argument == "-dryrun") {
|
||||||
|
|
||||||
|
ProcessHelper.dryRun = true;
|
||||||
|
|
||||||
} else if (argument == "-notrace") {
|
} else if (argument == "-notrace") {
|
||||||
|
|
||||||
traceEnabled = false;
|
traceEnabled = false;
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ class CPPHelper {
|
|||||||
|
|
||||||
|
|
||||||
private static var rebuiltLibraries = new Map <String, Bool> ();
|
private static var rebuiltLibraries = new Map <String, Bool> ();
|
||||||
|
private static var rebuiltPaths = new Map <String, Bool> ();
|
||||||
|
|
||||||
|
|
||||||
public static function compile (project:HXProject, path:String, flags:Array<String> = null, buildFile:String = "Build.xml"):Void {
|
public static function compile (project:HXProject, path:String, flags:Array<String> = null, buildFile:String = "Build.xml"):Void {
|
||||||
@@ -128,6 +129,7 @@ class CPPHelper {
|
|||||||
|
|
||||||
var defines = StringMapHelper.copy (project.defines);
|
var defines = StringMapHelper.copy (project.defines);
|
||||||
defines.set ("rebuild", 1);
|
defines.set ("rebuild", 1);
|
||||||
|
|
||||||
var haxelibProject = HXProject.fromHaxelib (haxelib, defines);
|
var haxelibProject = HXProject.fromHaxelib (haxelib, defines);
|
||||||
|
|
||||||
if (haxelibProject == null) {
|
if (haxelibProject == null) {
|
||||||
@@ -140,12 +142,18 @@ class CPPHelper {
|
|||||||
StringMapHelper.copyKeys (project.targetFlags, haxelibProject.targetFlags);
|
StringMapHelper.copyKeys (project.targetFlags, haxelibProject.targetFlags);
|
||||||
|
|
||||||
rebuiltLibraries.set (haxelib.name, true);
|
rebuiltLibraries.set (haxelib.name, true);
|
||||||
|
|
||||||
|
if (!rebuiltPaths.exists (haxelibProject.config.get ("project.rebuild.path"))) {
|
||||||
|
|
||||||
|
rebuiltPaths.set (haxelibProject.config.get ("project.rebuild.path"), true);
|
||||||
rebuild (haxelibProject, commands);
|
rebuild (haxelibProject, commands);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (project.targetFlags.exists ("clean")) {
|
if (project.targetFlags.exists ("clean")) {
|
||||||
|
|
||||||
if (buildRelease) {
|
if (buildRelease) {
|
||||||
@@ -198,7 +206,11 @@ class CPPHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!FileSystem.exists (path)) return;
|
if (path == null || !FileSystem.exists (path)) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (buildFile == null && project.config.exists ("project.rebuild.file")) {
|
if (buildFile == null && project.config.exists ("project.rebuild.file")) {
|
||||||
|
|
||||||
@@ -208,7 +220,11 @@ class CPPHelper {
|
|||||||
|
|
||||||
if (buildFile == null) buildFile = "Build.xml";
|
if (buildFile == null) buildFile = "Build.xml";
|
||||||
|
|
||||||
if (!FileSystem.exists (PathHelper.combine (path, buildFile))) return;
|
if (!FileSystem.exists (PathHelper.combine (path, buildFile))) {
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var args = [ "run", project.config.getString ("cpp.buildLibrary", "hxcpp"), buildFile ];
|
var args = [ "run", project.config.getString ("cpp.buildLibrary", "hxcpp"), buildFile ];
|
||||||
|
|
||||||
|
|||||||
@@ -188,8 +188,13 @@ class PathHelper {
|
|||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
var cacheDryRun = ProcessHelper.dryRun;
|
||||||
|
ProcessHelper.dryRun = false;
|
||||||
|
|
||||||
output = ProcessHelper.runProcess (Sys.getEnv ("HAXEPATH"), "haxelib", [ "path", name ], true, true, true);
|
output = ProcessHelper.runProcess (Sys.getEnv ("HAXEPATH"), "haxelib", [ "path", name ], true, true, true);
|
||||||
|
|
||||||
|
ProcessHelper.dryRun = cacheDryRun;
|
||||||
|
|
||||||
} catch (e:Dynamic) { }
|
} catch (e:Dynamic) { }
|
||||||
|
|
||||||
LogHelper.verbose = cache;
|
LogHelper.verbose = cache;
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import sys.FileSystem;
|
|||||||
class ProcessHelper {
|
class ProcessHelper {
|
||||||
|
|
||||||
|
|
||||||
|
public static var dryRun:Bool = false;
|
||||||
public static var processorCores (get_processorCores, null):Int;
|
public static var processorCores (get_processorCores, null):Int;
|
||||||
|
|
||||||
private static var _processorCores:Int = 0;
|
private static var _processorCores:Int = 0;
|
||||||
@@ -183,11 +184,15 @@ class ProcessHelper {
|
|||||||
|
|
||||||
LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + "");
|
LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + "");
|
||||||
|
|
||||||
|
if (!dryRun) {
|
||||||
|
|
||||||
oldPath = Sys.getCwd ();
|
oldPath = Sys.getCwd ();
|
||||||
Sys.setCwd (path);
|
Sys.setCwd (path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var argString = "";
|
var argString = "";
|
||||||
|
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
@@ -212,6 +217,8 @@ class ProcessHelper {
|
|||||||
|
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|
||||||
|
if (!dryRun) {
|
||||||
|
|
||||||
if (args != null && args.length > 0) {
|
if (args != null && args.length > 0) {
|
||||||
|
|
||||||
result = Sys.command (command, args);
|
result = Sys.command (command, args);
|
||||||
@@ -228,6 +235,8 @@ class ProcessHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
if (result != 0) {
|
if (result != 0) {
|
||||||
|
|
||||||
throw ("Error running: " + command + " " + args.join (" ") + " [" + path + "]");
|
throw ("Error running: " + command + " " + args.join (" ") + " [" + path + "]");
|
||||||
@@ -306,11 +315,15 @@ class ProcessHelper {
|
|||||||
|
|
||||||
LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + "");
|
LogHelper.info ("", " - \x1b[1mChanging directory:\x1b[0m " + path + "");
|
||||||
|
|
||||||
|
if (!dryRun) {
|
||||||
|
|
||||||
oldPath = Sys.getCwd ();
|
oldPath = Sys.getCwd ();
|
||||||
Sys.setCwd (path);
|
Sys.setCwd (path);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
var argString = "";
|
var argString = "";
|
||||||
|
|
||||||
for (arg in args) {
|
for (arg in args) {
|
||||||
@@ -332,6 +345,8 @@ class ProcessHelper {
|
|||||||
var output = "";
|
var output = "";
|
||||||
var result = 0;
|
var result = 0;
|
||||||
|
|
||||||
|
if (!dryRun) {
|
||||||
|
|
||||||
var process = new Process (command, args);
|
var process = new Process (command, args);
|
||||||
var buffer = new BytesOutput ();
|
var buffer = new BytesOutput ();
|
||||||
|
|
||||||
@@ -401,6 +416,8 @@ class ProcessHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
return output;
|
return output;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -415,6 +432,9 @@ class ProcessHelper {
|
|||||||
|
|
||||||
public static function get_processorCores ():Int {
|
public static function get_processorCores ():Int {
|
||||||
|
|
||||||
|
var cacheDryRun = dryRun;
|
||||||
|
dryRun = false;
|
||||||
|
|
||||||
if (_processorCores < 1) {
|
if (_processorCores < 1) {
|
||||||
|
|
||||||
var result = null;
|
var result = null;
|
||||||
@@ -471,6 +491,8 @@ class ProcessHelper {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
dryRun = cacheDryRun;
|
||||||
|
|
||||||
return _processorCores;
|
return _processorCores;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,15 @@ class PlatformTarget {
|
|||||||
if (!Reflect.hasField (metaFields.rebuild, "ignore") && (command == "rebuild" || project.targetFlags.exists ("rebuild"))) {
|
if (!Reflect.hasField (metaFields.rebuild, "ignore") && (command == "rebuild" || project.targetFlags.exists ("rebuild"))) {
|
||||||
|
|
||||||
LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: REBUILD" + LogHelper.resetColor);
|
LogHelper.info ("", "\n" + LogHelper.accentColor + "Running command: REBUILD" + LogHelper.resetColor);
|
||||||
|
|
||||||
|
// hack for now, need to move away from project.rebuild.path, probably
|
||||||
|
|
||||||
|
if (project.targetFlags.exists ("rebuild")) {
|
||||||
|
|
||||||
|
project.config.set ("project.rebuild.path", null);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
rebuild ();
|
rebuild ();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user