Skip to content

Commit 00985d5

Browse files
committed
Add new log level, setup, between info and verbose. Shows a little extra output when HXCPP_LOG_SETUP is set.
1 parent d570ba3 commit 00985d5

File tree

3 files changed

+37
-27
lines changed

3 files changed

+37
-27
lines changed

tools/hxcpp/BuildTool.hx

+23-20
Original file line numberDiff line numberDiff line change
@@ -340,30 +340,32 @@ class BuildTool
340340

341341
public static function getThreadCount() : Int
342342
{
343-
if (instance==null)
344-
return sCompileThreadCount;
345-
var defs = instance.mDefines;
346-
if (sAllowNumProcs)
343+
if (instance!=null)
347344
{
348-
var thread_var = defs.exists("HXCPP_COMPILE_THREADS") ?
349-
defs.get("HXCPP_COMPILE_THREADS") : Sys.getEnv("HXCPP_COMPILE_THREADS");
350-
351-
if (thread_var == null)
352-
{
353-
sCompileThreadCount = getNumberOfProcesses();
354-
}
355-
else
345+
var defs = instance.mDefines;
346+
if (sAllowNumProcs)
356347
{
357-
sCompileThreadCount = (Std.parseInt(thread_var)<2) ? 1 : Std.parseInt(thread_var);
358-
}
359-
if (sCompileThreadCount!=sReportedThreads)
360-
{
361-
sReportedThreads = sCompileThreadCount;
362-
Log.v("\x1b[33;1mUsing compile threads: " + sCompileThreadCount + "\x1b[0m");
348+
var thread_var = defs.exists("HXCPP_COMPILE_THREADS") ?
349+
defs.get("HXCPP_COMPILE_THREADS") : Sys.getEnv("HXCPP_COMPILE_THREADS");
350+
351+
if (thread_var == null)
352+
{
353+
sCompileThreadCount = getNumberOfProcesses();
354+
}
355+
else
356+
{
357+
sCompileThreadCount = (Std.parseInt(thread_var)<2) ? 1 : Std.parseInt(thread_var);
358+
}
363359
}
360+
if (sCompileThreadCount>1 && sThreadPool==null)
361+
sThreadPool = new ThreadPool(sCompileThreadCount);
362+
}
363+
364+
if (sCompileThreadCount!=sReportedThreads)
365+
{
366+
sReportedThreads = sCompileThreadCount;
367+
Log.setup('${Log.YELLOW}Using compile threads: $sCompileThreadCount${Log.NORMAL}' );
364368
}
365-
if (sCompileThreadCount>1 && sThreadPool==null)
366-
sThreadPool = new ThreadPool(sCompileThreadCount);
367369

368370
return sCompileThreadCount;
369371
}
@@ -1544,6 +1546,7 @@ class BuildTool
15441546
if (defines.exists("HXCPP_NO_COLOUR") || defines.exists("HXCPP_NO_COLOR"))
15451547
Log.colorSupported = false;
15461548
Log.verbose = defines.exists("HXCPP_VERBOSE");
1549+
Log.showSetup = defines.exists("HXCPP_LOG_SETUP");
15471550
exitOnThreadError = defines.exists("HXCPP_EXIT_ON_ERROR");
15481551

15491552

tools/hxcpp/Log.hx

+7
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ class Log
2020
public static var mute:Bool= false;
2121
public static var quiet:Bool = false;
2222
public static var verbose:Bool = false;
23+
public static var showSetup:Bool = false;
2324

2425
public static var colorSupported:Null<Bool> = null;
2526
private static var sentWarnings = new Map<String,Bool>();
@@ -93,6 +94,12 @@ class Log
9394
Log.info("",verboseMessage);
9495
}
9596

97+
inline public static function setup(verboseMessage:String):Void
98+
{
99+
Log.info(showSetup ? verboseMessage : "",verboseMessage);
100+
}
101+
102+
96103
public static function lock():Void
97104
{
98105
if (printMutex!=null)

tools/hxcpp/Setup.hx

+7-7
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,15 @@ class Setup
434434
else
435435
{
436436
root = defines.get("ANDROID_NDK_ROOT");
437-
Log.info("", "\x1b[33;1mUsing Android NDK root: " + root + "\x1b[0m");
437+
Log.setup("\x1b[33;1mUsing Android NDK root: " + root + "\x1b[0m");
438438
}
439439

440440
if (ndkVersion==0)
441441
{
442442
var version = Setup.getNdkVersion( root );
443443
if (version > 0)
444444
{
445-
Log.info("", "\x1b[33;1mDetected Android NDK " + version + "\x1b[0m");
445+
Log.setup("\x1b[33;1mDetected Android NDK " + version + "\x1b[0m");
446446
defines.set("NDKV" + Std.int(version), "1" );
447447
ndkVersion = Std.int(version);
448448
}
@@ -482,7 +482,7 @@ class Setup
482482
if (bestVer!="")
483483
{
484484
defines.set("TOOLCHAIN_VERSION",bestVer);
485-
Log.info("", "\x1b[33;1mDetected Android toolchain: "+arm_type+"-" + bestVer + "\x1b[0m");
485+
Log.setup("\x1b[33;1mDetected Android toolchain: "+arm_type+"-" + bestVer + "\x1b[0m");
486486
}
487487
}
488488
catch(e:Dynamic) { }
@@ -517,7 +517,7 @@ class Setup
517517
catch(e:Dynamic) { }
518518

519519
if (defines.exists('HXCPP_ANDROID_PLATFORM')) {
520-
Log.info("", "\x1b[33;1mUsing Android NDK platform: " + defines.get("HXCPP_ANDROID_PLATFORM") + "\x1b[0m");
520+
Log.setup("\x1b[33;1mUsing Android NDK platform: " + defines.get("HXCPP_ANDROID_PLATFORM") + "\x1b[0m");
521521
}
522522
else if (defines.exists('NDKV19+')) {
523523
if (defines.exists("PLATFORM_NUMBER")) {
@@ -715,11 +715,11 @@ class Setup
715715
}
716716
ioDefines.set("HXCPP_MSVC", where );
717717
Sys.putEnv("HXCPP_MSVC", where);
718-
Log.info("", 'Using MSVC Ver $ival in $where ($varName)');
718+
Log.setup('Using MSVC Ver $ival in $where ($varName)');
719719
}
720720
else
721721
{
722-
Log.info("", 'Using specified MSVC Ver $val');
722+
Log.setup('Using specified MSVC Ver $val');
723723
ioDefines.set("HXCPP_MSVC", val );
724724
Sys.putEnv("HXCPP_MSVC", val);
725725
}
@@ -818,7 +818,7 @@ class Setup
818818
if (reg.match(str))
819819
{
820820
var cl_version = Std.parseInt(reg.matched(1));
821-
Log.info("", "Using MSVC version: " + cl_version);
821+
Log.setup("Using MSVC version: " + cl_version);
822822
ioDefines.set("MSVC_VER", cl_version+"");
823823
if (cl_version>=17)
824824
ioDefines.set("MSVC17+","1");

0 commit comments

Comments
 (0)