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