forked from FunkinCrew/Funkin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPostbuild.hx
40 lines (32 loc) · 874 Bytes
/
Postbuild.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
package source; // Yeah, I know...
import sys.FileSystem;
import sys.io.File;
/**
* A script which executes after the game is built.
*/
class Postbuild
{
static inline final BUILD_TIME_FILE:String = '.build_time';
static function main():Void
{
printBuildTime();
}
static function printBuildTime():Void
{
// get buildEnd before fs operations since they are blocking
var end:Float = Sys.time();
if (FileSystem.exists(BUILD_TIME_FILE))
{
var fi:sys.io.FileInput = File.read(BUILD_TIME_FILE);
var start:Float = fi.readDouble();
fi.close();
sys.FileSystem.deleteFile(BUILD_TIME_FILE);
var buildTime:Float = roundToTwoDecimals(end - start);
trace('Build took: ${buildTime} seconds');
}
}
static function roundToTwoDecimals(value:Float):Float
{
return Math.round(value * 100) / 100;
}
}