-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.bat
128 lines (109 loc) · 2.54 KB
/
build.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
echo off
cls
setlocal enabledelayedexpansion
SET VERSION=1.0
SET SCRIPT_DIR=%~dp0
SET WORKING_DIR=%cd%
SET BUILD_TYPE=
SET ARC=x64
for %%x in (%*) do (
if "%%x"=="help" (
SET BUILD_TYPE=help
)
if "%%x"=="h" (
SET BUILD_TYPE=help
)
if "%%x"=="zip" (
SET BUILD_TYPE=zip
)
if "%%x"=="exe" (
SET BUILD_TYPE=exe
)
if "%%x"=="portable" (
SET BUILD_TYPE=portable
)
if "%%x"=="z" (
SET BUILD_TYPE=zip
)
if "%%x"=="x" (
SET BUILD_TYPE=exe
)
if "%%x"=="p" (
SET BUILD_TYPE=
)
if "%%x"=="86" (
SET ARC=x86
)
if "%%x"=="64" (
SET ARC=x64
)
if "%%x"=="x86" (
SET ARC=x86
)
if "%%x"=="x64" (
SET ARC=x64
)
)
cd !SCRIPT_DIR!
if "!BUILD_TYPE!"=="" (
echo Error: you need to specify the build type (exe or zip^)
SET BUILD_TYPE=help
)
if "!BUILD_TYPE!"=="help" (
call:help
)
if "!BUILD_TYPE!"=="exe" (
call:build_exe_installer
)
if "!BUILD_TYPE!"=="zip" (
call:build_zip_archive
)
if "!BUILD_TYPE!"=="portable" (
call:build_portable
)
:end_program
cd !WORKING_DIR!
exit /b 0
:build_exe_installer
SET FOUND_ISCC=false
for /F "tokens=* USEBACKQ" %%F in (`iscc.exe 2^> nul`) do SET FOUND_ISCC=true
if !FOUND_ISCC!==false (
SET /p ISCC_FOLDER=Inno Script(iscc.exe^) not found in path. Enter Inno Setup folder:
if !ISCC_FOLDER!==close (goto:end_program)
SET PATH=!PATH!;!ISCC_FOLDER!
call:build_exe_installer
exit /b 0
)
iscc.exe ./devjammer_!ARC!.iss
goto:end_program
exit /b 0
:build_zip_archive
SET FOUND_ZIPPER=false
for /F "tokens=* USEBACKQ" %%F in (`zip.bat 2^> nul`) do SET FOUND_ZIPPER=true
if !FOUND_ZIPPER!==false (
SET /p ZIPPER_FOLDER=zip.bat not found in path. Enter Cronux(https://thecarisma.github.io/Cronux^) folder:
if !ZIPPER_FOLDER!==close (goto:end_program)
SET PATH=!PATH!;!ZIPPER_FOLDER!
call:build_zip_archive
exit /b 0
)
if not exist ".\build\" (mkdir .\build\)
call zip.bat .\build\devjammer-!VERSION!-!ARC!.zip ..\bin\!ARC!\Release\devjammer.exe .\..\README.MD ..\LICENSE
goto:end_program
exit /b 0
:build_portable
if not exist ".\build\" (mkdir .\build\)
copy ..\bin\!ARC!\Release\devjammer.exe .\build\devjammer-!ARC!.exe
goto:end_program
exit /b 0
:help
echo Usage: build.bat [BUILD_TYPE] [ARC]
echo [BUILD_TYPE]
echo z zip build a distributable zip arcive
echo x exe build a executable installer (Inno Setup Required)
echo p portable build a single portable executable
echo h help print this help message
echo [ARC]
echo 86 x32 build 32 bit distributable package
echo 64 x64 build 64 bit distributable package
exit /b 0