forked from SoboLAN/pokerenlighter-simulator
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmake.pe.bat
72 lines (53 loc) · 2.5 KB
/
make.pe.bat
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
@echo off
setlocal
REM This file is for building the Poker Enlighter executable.
REM Some very important notes:
REM - The script assumes the availability of the javac and jar commands.
REM - The script makes very specific assumptions of the structure of the JAR file, in the packaging
REM stage. Please keep this script in sync with this structure.
REM We're going to count execution time. So, remeber start time. Note that we don't look at the date, so this
REM calculation won't work right if the program run spans local midnight.
set t0=%time: =0%
REM First, let's define some variables that contain most used names and paths
REM throughout the build script. Changes of these variables will propagate down the script.
set mainclass=org/javafling/pokerenlighter/main/PokerEnlighterSimulator
set manifestfile=Manifest.txt
set simulatorjar=simulator.jar
set simulatorclass=org/javafling/pokerenlighter/simulation/Simulator
set extraclass1=org/javafling/pokerenlighter/simulation/SimulationExport
set extraclass2=org/javafling/pokerenlighter/main/PokerEnlighterSimulator
REM The actual compilation command. It is compiled without any debugging
REM symbols, to add some obfuscation.
javac -g:none -Xlint:unchecked %simulatorclass%.java %extraclass1%.java %extraclass2%.java 2>&1
timeout /t 1 /nobreak > NUL
REM Next, the script will move inside the "org/" folder and delete all the source code files.
REM This is to ensure that the resulting executable will not contain the source code.
REM The script will move back to the build folder root after it's done deleting.
cd org
del /s *.java > NUL
timeout /t 1 /nobreak > NUL
cd..
REM Next, the Manifest file is built. This is needed for the JAR file.
echo Main-Class: %mainclass% > %manifestfile%
REM Package everything in a JAR file.
jar cfm0 %simulatorjar% %manifestfile% org/* 2>&1
REM And we are done. Enjoy.
REM Capture the end time before doing anything else
set t=%time: =0%
REM make t0 into a scaler in 100ths of a second, being careful not
REM to let SET/A misinterpret 08 and 09 as octal
set /a h=1%t0:~0,2%-100
set /a m=1%t0:~3,2%-100
set /a s=1%t0:~6,2%-100
set /a c=1%t0:~9,2%-100
set /a starttime = %h% * 360000 + %m% * 6000 + 100 * %s% + %c%
REM make t into a scaler in 100ths of a second
set /a h=1%t:~0,2%-100
set /a m=1%t:~3,2%-100
set /a s=1%t:~6,2%-100
set /a c=1%t:~9,2%-100
set /a endtime = %h% * 360000 + %m% * 6000 + 100 * %s% + %c%
REM runtime in 100ths is now just end - start
set /a runtime = %endtime% - %starttime%
set runtime = %s%.%c%
echo Ran for %runtime%0 ms