Skip to content

Commit

Permalink
Merge branch 'progress' into codename
Browse files Browse the repository at this point in the history
  • Loading branch information
NeeEoo committed Aug 30, 2024
2 parents 51389fe + 5e612a3 commit e5f5159
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 26 deletions.
6 changes: 4 additions & 2 deletions tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -576,7 +576,7 @@ class BuildTool
first = false;
Log.lock();
Log.println("");
Log.info("\x1b[33;1mCompiling group: " + group.mId + " (" + to_be_compiled.length + " files)\x1b[0m");
Log.info("\x1b[33;1mCompiling group: " + group.mId + " (" + to_be_compiled.length + " file" + (to_be_compiled.length==1 ? "" : "s") + ")\x1b[0m");
var message = "\x1b[1m" + (nvcc ? getNvcc() : mCompiler.mExe) + "\x1b[0m";
var flags = group.mCompilerFlags;
if (!nvcc)
Expand Down Expand Up @@ -613,7 +613,9 @@ class BuildTool

Profile.push("compile");

var compile_progress = new Progress(0,to_be_compiled.length);
var compile_progress = null;
if (!Log.verbose)
compile_progress = new Progress(0,to_be_compiled.length);

if (threadPool==null)
{
Expand Down
61 changes: 37 additions & 24 deletions tools/hxcpp/Compiler.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,14 @@
import haxe.crypto.Md5;
import haxe.io.Path;
import sys.FileSystem;
#if haxe4
import sys.thread.Mutex;
#elseif cpp
import cpp.vm.Mutex;
#else
import neko.vm.Mutex;
#end

using StringTools;

private class FlagInfo
Expand Down Expand Up @@ -301,6 +309,8 @@ class Compiler
catch(e:Dynamic) { }
}

static public var printMutex = new Mutex();

public function compile(inFile:File,inTid:Int,headerFunc:Void->Void,pchTimeStamp:Null<Float>,inProgess:Null<Progress>)
{
var obj_name = getObjName(inFile);
Expand Down Expand Up @@ -382,34 +392,41 @@ class Compiler
if (delayedFilename!=null)
args.push(delayedFilename);

var tagInfo = inFile.mTags==null ? "" : " " + inFile.mTags.split(",");

var fileName = inFile.mName;
var split = fileName.split ("/");
if (split.length > 1)
if (!Log.verbose)
{
fileName = " \x1b[2m-\x1b[0m \x1b[33m" + split.slice(0, split.length - 1).join("/") + "/\x1b[33;1m" + split[split.length - 1] + "\x1b[0m";
}
else
{
fileName = " \x1b[2m-\x1b[0m \x1b[33;1m" + fileName + "\x1b[0m";
}
fileName += " \x1b[3m" + tagInfo + "\x1b[0m";
var tagInfo = inFile.mTags==null ? "" : " " + inFile.mTags.split(",");

if (inProgess!=null)
{
inProgess.progress(1);
fileName = inProgess.getProgress() + fileName;
var fileName = inFile.mName;
var split = fileName.split ("/");
if (split.length > 1)
{
fileName = " \x1b[2m-\x1b[0m \x1b[33m" + split.slice(0, split.length - 1).join("/") + "/\x1b[33;1m" + split[split.length - 1] + "\x1b[0m";
}
else
{
fileName = " \x1b[2m-\x1b[0m \x1b[33;1m" + fileName + "\x1b[0m";
}
fileName += " \x1b[3m" + tagInfo + "\x1b[0m";

printMutex.acquire();

if (inProgess != null)
{
inProgess.progress(1);
fileName = inProgess.getProgress() + fileName;
}

if((inTid >= 0 && BuildTool.threadExitCode == 0) || inTid < 0)
{
Log.info(fileName);
}
printMutex.release();
}

if (inTid >= 0)
{
if (BuildTool.threadExitCode == 0)
{
if (!Log.verbose)
{
Log.info(fileName);
}
var err = ProcessManager.runProcessThreaded(exe, args, null);
cleanTmp(tmpFile);
if (err!=0)
Expand All @@ -422,10 +439,6 @@ class Compiler
}
else
{
if (!Log.verbose)
{
Log.info(fileName);
}
var result = ProcessManager.runProcessThreaded(exe, args, null);
cleanTmp(tmpFile);
if (result!=0)
Expand Down

0 comments on commit e5f5159

Please sign in to comment.