2023-08-28 15:03:29 -04:00
|
|
|
package source; // Yeah, I know...
|
|
|
|
|
2024-03-02 23:49:27 -05:00
|
|
|
import sys.FileSystem;
|
|
|
|
import sys.io.File;
|
|
|
|
|
2023-08-28 15:03:29 -04:00
|
|
|
class Postbuild
|
|
|
|
{
|
2024-03-02 23:49:27 -05:00
|
|
|
static inline final buildTimeFile = '.build_time';
|
|
|
|
|
2023-08-28 15:03:29 -04:00
|
|
|
static function main()
|
|
|
|
{
|
2024-03-02 23:49:27 -05:00
|
|
|
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();
|
2023-08-28 15:03:29 -04:00
|
|
|
|
2024-03-02 23:49:27 -05:00
|
|
|
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;
|
2023-08-28 15:03:29 -04:00
|
|
|
}
|
|
|
|
}
|