-
Notifications
You must be signed in to change notification settings - Fork 27
/
release.bat
75 lines (51 loc) · 1.78 KB
/
release.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
73
74
75
@echo off
if not exist "%~2\jmods" (
echo jmods folder not found in given path to runtime [%~2] >&2
exit /b 1
)
if "%3" == "" (
echo No platform supplied! >&2
exit /b 1
)
if "%4" == "" (
echo No image name supplied! >&2
exit /b 1
)
set IMAGE=target\runtime-images\%3\%4
RMDIR /S /Q "%IMAGE%" 2>nul
"%~1\bin\jlink" --no-header-files --no-man-pages --compress=2 --strip-debug --module-path "%~2\jmods" --add-modules java.base,java.desktop --output %IMAGE%
if %errorlevel% neq 0 exit /b %errorlevel%
xcopy target\%4.jar "%~dp0%IMAGE%\lib\"
xcopy data "%~dp0%IMAGE%\data\" /i /s /e
xcopy db "%~dp0%IMAGE%\db\" /i /s /e
xcopy documentation "%~dp0%IMAGE%\documentation\" /i /s /e
xcopy graphics "%~dp0%IMAGE%\graphics\" /i /s /e
xcopy changelog.txt "%~dp0%IMAGE%\"
xcopy forbidden_ids.txt "%~dp0%IMAGE%\"
xcopy settings.txt "%~dp0%IMAGE%\"
goto %3
echo Unknown platform name %3! >&2
exit /b 1
:windows
echo @start bin\javaw -cp lib\%4.jar nationGen.GUI.GUI> ./%IMAGE%/NationGen.bat
echo @start bin\javaw -cp lib\%4.jar nationGen.GUI.SpriteGen> ./%IMAGE%/SpriteGen.bat
goto done
:linux
:osx
:: this is a hack to get just a linefeed character
(set LF=^
%=EMPTY=%
)
setlocal DisableDelayedExpansion
:: this is another hack to not use echo since it does CRLF at end of line
<NUL set /p ="#!" > ./%IMAGE%/NationGen.sh
<NUL set /p ="#!" > ./%IMAGE%/SpriteGen.sh
endlocal
setlocal EnableDelayedExpansion
<NUL set /p ="/bin/sh!LF!DIR=`dirname $0`!LF!$DIR/bin/java -cp lib/%4.jar nationGen.GUI.GUI" >> ./%IMAGE%/NationGen.sh
<NUL set /p ="/bin/sh!LF!DIR=`dirname $0`!LF!$DIR/bin/java -cp lib/%4.jar nationGen.GUI.SpriteGen" >> ./%IMAGE%/SpriteGen.sh
endlocal
:: the above hack sets errorlevel to 1 so do a dummy command to clear it
ver >NUL
:done
echo Runtime image for %3 environment created at %IMAGE%