Funkin/source/Postbuild.hx
Hazel 0a19c7a8cb fix(ci), feat(ci), refactor: i don't need sleep, i need answers (#357)
* hx the codec

* fix(ci,html5): use haxe.Timer instead of Sys.time

* refactor(compat): use haxe.Timer instead of Sys.time(), introduce TimerUtil to reduce code dupe

* fix: redundant types

* refactor(style): use TimerTools in place of haxe.Timer

* refactor: consistent timer code

* feat: build timings

* refactor(ci): cleanup ci configs

* sigh

* sigh, 2

* fix: haxelib deleterepo does not silently fail

* retrigger ci

* verbose output

* debug info after haxelib gti

* force haxelib git override

* more debug info

* force bash

* at least haxelib is consistent now

* fix the runners first, then do that

* update ci-haxe

* it is time?

* deleterepo may fail

* finishing touches
2024-03-02 23:49:27 -05:00

37 lines
774 B
Haxe

package source; // Yeah, I know...
import sys.FileSystem;
import sys.io.File;
class Postbuild
{
static inline final buildTimeFile = '.build_time';
static function main()
{
printBuildTime();
}
static function printBuildTime()
{
// get buildEnd before fs operations since they are blocking
var end:Float = Sys.time();
if (FileSystem.exists(buildTimeFile))
{
var fi = File.read(buildTimeFile);
var start:Float = fi.readDouble();
fi.close();
sys.FileSystem.deleteFile(buildTimeFile);
var buildTime = roundToTwoDecimals(end - start);
trace('Build took: ${buildTime} seconds');
}
}
private static function roundToTwoDecimals(value:Float):Float
{
return Math.round(value * 100) / 100;
}
}