Skip to content

Commit e5f5159

Browse files
committed
Merge branch 'progress' into codename
2 parents 51389fe + 5e612a3 commit e5f5159

File tree

2 files changed

+41
-26
lines changed

2 files changed

+41
-26
lines changed

tools/hxcpp/BuildTool.hx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ class BuildTool
576576
first = false;
577577
Log.lock();
578578
Log.println("");
579-
Log.info("\x1b[33;1mCompiling group: " + group.mId + " (" + to_be_compiled.length + " files)\x1b[0m");
579+
Log.info("\x1b[33;1mCompiling group: " + group.mId + " (" + to_be_compiled.length + " file" + (to_be_compiled.length==1 ? "" : "s") + ")\x1b[0m");
580580
var message = "\x1b[1m" + (nvcc ? getNvcc() : mCompiler.mExe) + "\x1b[0m";
581581
var flags = group.mCompilerFlags;
582582
if (!nvcc)
@@ -613,7 +613,9 @@ class BuildTool
613613

614614
Profile.push("compile");
615615

616-
var compile_progress = new Progress(0,to_be_compiled.length);
616+
var compile_progress = null;
617+
if (!Log.verbose)
618+
compile_progress = new Progress(0,to_be_compiled.length);
617619

618620
if (threadPool==null)
619621
{

tools/hxcpp/Compiler.hx

Lines changed: 37 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
import haxe.crypto.Md5;
22
import haxe.io.Path;
33
import sys.FileSystem;
4+
#if haxe4
5+
import sys.thread.Mutex;
6+
#elseif cpp
7+
import cpp.vm.Mutex;
8+
#else
9+
import neko.vm.Mutex;
10+
#end
11+
412
using StringTools;
513

614
private class FlagInfo
@@ -301,6 +309,8 @@ class Compiler
301309
catch(e:Dynamic) { }
302310
}
303311

312+
static public var printMutex = new Mutex();
313+
304314
public function compile(inFile:File,inTid:Int,headerFunc:Void->Void,pchTimeStamp:Null<Float>,inProgess:Null<Progress>)
305315
{
306316
var obj_name = getObjName(inFile);
@@ -382,34 +392,41 @@ class Compiler
382392
if (delayedFilename!=null)
383393
args.push(delayedFilename);
384394

385-
var tagInfo = inFile.mTags==null ? "" : " " + inFile.mTags.split(",");
386-
387-
var fileName = inFile.mName;
388-
var split = fileName.split ("/");
389-
if (split.length > 1)
395+
if (!Log.verbose)
390396
{
391-
fileName = " \x1b[2m-\x1b[0m \x1b[33m" + split.slice(0, split.length - 1).join("/") + "/\x1b[33;1m" + split[split.length - 1] + "\x1b[0m";
392-
}
393-
else
394-
{
395-
fileName = " \x1b[2m-\x1b[0m \x1b[33;1m" + fileName + "\x1b[0m";
396-
}
397-
fileName += " \x1b[3m" + tagInfo + "\x1b[0m";
397+
var tagInfo = inFile.mTags==null ? "" : " " + inFile.mTags.split(",");
398398

399-
if (inProgess!=null)
400-
{
401-
inProgess.progress(1);
402-
fileName = inProgess.getProgress() + fileName;
399+
var fileName = inFile.mName;
400+
var split = fileName.split ("/");
401+
if (split.length > 1)
402+
{
403+
fileName = " \x1b[2m-\x1b[0m \x1b[33m" + split.slice(0, split.length - 1).join("/") + "/\x1b[33;1m" + split[split.length - 1] + "\x1b[0m";
404+
}
405+
else
406+
{
407+
fileName = " \x1b[2m-\x1b[0m \x1b[33;1m" + fileName + "\x1b[0m";
408+
}
409+
fileName += " \x1b[3m" + tagInfo + "\x1b[0m";
410+
411+
printMutex.acquire();
412+
413+
if (inProgess != null)
414+
{
415+
inProgess.progress(1);
416+
fileName = inProgess.getProgress() + fileName;
417+
}
418+
419+
if((inTid >= 0 && BuildTool.threadExitCode == 0) || inTid < 0)
420+
{
421+
Log.info(fileName);
422+
}
423+
printMutex.release();
403424
}
404425

405426
if (inTid >= 0)
406427
{
407428
if (BuildTool.threadExitCode == 0)
408429
{
409-
if (!Log.verbose)
410-
{
411-
Log.info(fileName);
412-
}
413430
var err = ProcessManager.runProcessThreaded(exe, args, null);
414431
cleanTmp(tmpFile);
415432
if (err!=0)
@@ -422,10 +439,6 @@ class Compiler
422439
}
423440
else
424441
{
425-
if (!Log.verbose)
426-
{
427-
Log.info(fileName);
428-
}
429442
var result = ProcessManager.runProcessThreaded(exe, args, null);
430443
cleanTmp(tmpFile);
431444
if (result!=0)

0 commit comments

Comments
 (0)