Skip to content

Commit

Permalink
Tool fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jgranick committed Mar 25, 2014
1 parent c5f6c66 commit 2ecbcba
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 51 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
obj/
bin/
Binary file modified run.n
Binary file not shown.
17 changes: 9 additions & 8 deletions tools/run/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import sys.FileSystem;
import neko.vm.Thread;
import neko.vm.Mutex;
import neko.vm.Tls;
import neko.vm.Tls;
#else
import cpp.vm.Thread;
import cpp.vm.Mutex;
Expand Down Expand Up @@ -39,7 +38,8 @@ class BuildTool
public static var compileCache:String;
public static var targetKey:String;
public static var instance:BuildTool;
static var printMutex:Mutex;
public static var helperThread = new Tls<Thread>();
public static var printMutex:Mutex;
static var mVarMatch = new EReg("\\${(.*?)}","");

public function new(inMakefile:String,inDefines:Hash<String>,inTargets:Array<String>,
Expand Down Expand Up @@ -162,7 +162,8 @@ class BuildTool
if (target.mBuildDir!="")
{
restoreDir = Sys.getCwd();
LogManager.info("", "Enter \"" + target.mBuildDir + "\"");
Sys.println(target.mBuildDir);
LogManager.info("", "\x1b[1mChanging directory:\x1b[0m " + target.mBuildDir);
Sys.setCwd(target.mBuildDir);
}

Expand Down Expand Up @@ -307,7 +308,7 @@ class BuildTool
if (target.mBuildDir!="")
{
restoreDir = Sys.getCwd();
LogManager.info("", "Enter \"" + target.mBuildDir + "\"");
LogManager.info("", "\x1b[1mChanging directory:\x1b[0m " + target.mBuildDir);
Sys.setCwd(target.mBuildDir);
}

Expand Down Expand Up @@ -568,10 +569,10 @@ class BuildTool
}
else if (isLinux)
{
result = ProcessManager.runProcess("", "nproc", [], true, true, true);
result = ProcessManager.runProcess("", "nproc", []);
if (result == null)
{
var cpuinfo = ProcessManager.runProcess("", "cat", [ "/proc/cpuinfo" ], true, true, true);
var cpuinfo = ProcessManager.runProcess("", "cat", [ "/proc/cpuinfo" ]);
if (cpuinfo != null)
{
var split = cpuinfo.split("processor");
Expand All @@ -582,7 +583,7 @@ class BuildTool
else if (isMac)
{
var cores = ~/Total Number of Cores: (\d+)/;
var output = ProcessManager.runProcess("", "/usr/sbin/system_profiler", [ "-detailLevel", "full", "SPHardwareDataType" ]);
var output = ProcessManager.runProcess("", "/usr/sbin/system_profiler", [ "-detailLevel", "full", "SPHardwareDataType" ], true, false);
if (cores.match(output))
{
result = cores.matched(1);
Expand Down Expand Up @@ -905,7 +906,7 @@ class BuildTool

if (defines.exists("apple") && !defines.exists("DEVELOPER_DIR"))
{
var developer_dir = ProcessManager.runProcess("", "xcode-select", ["--print-path"]);
var developer_dir = ProcessManager.runProcess("", "xcode-select", ["--print-path"], true, false);
if (developer_dir == null || developer_dir == "" || developer_dir.indexOf ("Run xcode-select") > -1)
developer_dir = "/Applications/Xcode.app/Contents/Developer";
if (developer_dir == "/Developer")
Expand Down
4 changes: 2 additions & 2 deletions tools/run/Compiler.hx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ class Compiler

if (inTid >= 0)
{
ProcessManager.runProcess("", exe, args);
ProcessManager.runProcessThreaded("", exe, args);
}
else
{
Expand Down Expand Up @@ -255,7 +255,7 @@ class Compiler
var exe = split.shift ();
args = split.concat (args);

var result = ProcessManager.runCommand("", exe, args, true, false, true);
var result = ProcessManager.runCommand("", exe, args);
if (result!=0)
{
if (FileSystem.exists(pch_name))
Expand Down
2 changes: 1 addition & 1 deletion tools/run/HLSL.hx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class HLSL

LogManager.info("", exe + " " + args.join(" "));

var result = ProcessManager.runCommand("", exe, args);
var result = ProcessManager.runCommand("", exe, args, false);
if (result!=0)
{
LogManager.error("Could not compile shader \"" + file + "\"");
Expand Down
6 changes: 3 additions & 3 deletions tools/run/Linker.hx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ class Linker
var libObjs = Setup.readStdout(mExe, ["t", lib ]);
var objDir = inCompiler.mObjDir + "/" + libName;
PathManager.mkdir(objDir);
ProcessManager.runCommand (objDir, mExe, ["x", lib], true, false, true);
ProcessManager.runCommand (objDir, mExe, ["x", lib]);
for(obj in libObjs)
objs.push( objDir+"/"+obj );
}
Expand Down Expand Up @@ -186,7 +186,7 @@ class Linker
var exe = split.shift ();
args = split.concat (args);

var result = ProcessManager.runCommand("", exe, args, true, false, true);
var result = ProcessManager.runCommand("", exe, args);
if (result!=0)
{
Sys.exit(result);
Expand All @@ -196,7 +196,7 @@ class Linker
if (mRanLib!="")
{
args = [out_name];
var result = ProcessManager.runCommand("", mRanLib, args, true, false, true);
var result = ProcessManager.runCommand("", mRanLib, args);
if (result!=0)
{
Sys.exit(result);
Expand Down
2 changes: 1 addition & 1 deletion tools/run/LogManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class LogManager
}
}

if (colorSupported)
if (true || colorSupported)
{
return output;
}
Expand Down
12 changes: 6 additions & 6 deletions tools/run/PathManager.hx
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class PathManager

try
{
output = ProcessManager.runProcess(Sys.getEnv ("HAXEPATH"), "haxelib", [ "path", name ], true, true, true);
output = ProcessManager.runProcess(Sys.getEnv ("HAXEPATH"), "haxelib", [ "path", name ]);
}
catch (e:Dynamic) {}

Expand Down Expand Up @@ -198,10 +198,10 @@ class PathManager

if (!directoryCache.exists (total))
{
directoryCache.set(total, true);
//directoryCache.set(total, true);
if (!FileSystem.exists(total))
{
LogManager.info("", " - \x1b[1mCreating directory:\x1b[0m " + total);
LogManager.info("", "\x1b[1mCreating directory:\x1b[0m " + total);
FileSystem.createDirectory(total);
}
}
Expand Down Expand Up @@ -245,7 +245,7 @@ class PathManager
catch (e:Dynamic) {}
}

LogManager.info("", " - \x1b[1mRemoving directory:\x1b[0m " + directory);
LogManager.info("", "\x1b[1mRemoving directory:\x1b[0m " + directory);

try
{
Expand All @@ -259,7 +259,7 @@ class PathManager
{
if (FileSystem.exists(file))
{
LogManager.info("", " - \x1b[1mRemoving file:\x1b[0m " + file);
LogManager.info("", "\x1b[1mRemoving file:\x1b[0m " + file);
FileSystem.deleteFile(file);
}
}
Expand All @@ -280,7 +280,7 @@ class PathManager
}

public static function standardize(path:String, trailingSlash:Bool = false):String
{
{
path = StringTools.replace (path, "\\", "/");
path = StringTools.replace (path, "//", "/");
path = StringTools.replace (path, "//", "/");
Expand Down
Loading

0 comments on commit 2ecbcba

Please sign in to comment.