Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/hxcpp/BuildTool.hx
Original file line number Diff line number Diff line change
Expand Up @@ -688,7 +688,7 @@ class BuildTool
} : null;

Profile.push("compile");
var progress = new Progress(to_be_compiled.length);
var progress = new Progress(to_be_compiled.length, mDefines.exists("HXCPP_PROGRESS_PERCENT"));
if (threadPool==null)
{
for(file in to_be_compiled)
Expand Down
32 changes: 20 additions & 12 deletions tools/hxcpp/Progress.hx
Original file line number Diff line number Diff line change
@@ -1,25 +1,33 @@
// How many of a group's files have compiled, shown before each file as it starts
class Progress
{
class Progress {
var finished:Int;
var total:Int;
var usePercent:Bool;

public function new(inTotal:Int)
{
public function new(inTotal:Int, usePercent:Bool = false) {
finished = 0;
total = inTotal;
this.usePercent = usePercent;
}

public function label():String
{
var done = Std.string(finished);
while (done.length < Std.string(total).length)
done = " " + done;
return "\x1b[1m[" + done + "/" + total + "]\x1b[0m";
public function label():String {
if (usePercent) {
var percent = finished / total;
var pct = Std.int(percent * 1000) / 10;
var str = Std.string(pct);
if (Std.int(pct) == pct) {
str += ".0";
}
return "\x1b[1m[" + str + "%]\x1b[0m";
} else {
var done = Std.string(finished);
while (done.length < Std.string(total).length)
done = " " + done;
return "\x1b[1m[" + done + "/" + total + "]\x1b[0m";
}
}

public function fileDone()
{
public function fileDone() {
Log.lock();
finished++;
Log.unlock();
Expand Down