-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathbump.bat
50 lines (36 loc) · 1.62 KB
/
bump.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
:: Bump batch script
::
:: Updates the version numbers for this project
:: Requires sed to work
@ECHO OFF
PUSHD .
sed >NUL 2>&1
IF %ERRORLEVEL% == 9009 (
ECHO ERROR: Cannot find sed
GOTO END
)
IF "%1" == "" GOTO USAGE
SET BUMP_VERSION=%1
ECHO _START_%BUMP_VERSION%_END_ | sed -nb "/^_START_[0-9]\+\(\.[0-9]\+\)*_END_/!{q100}"
IF ERRORLEVEL 1 GOTO USAGE
SET BUMP_VERSION=%1
SET BUMP_COMMAND_MAJOR='ECHO _START_%BUMP_VERSION%_END_ ^^^| sed -b "s/^_START_\([0-9]\+\)\(\.[0-9]\+\)*_END_/\1/"'
SET BUMP_COMMAND_MINOR='ECHO _START_%BUMP_VERSION%_END_ ^^^| sed -b "s/^_START_[0-9]\+\.\([0-9]\+\)\(\.[0-9]\+\)*_END_/\1/"'
SET BUMP_COMMAND_REVISION='ECHO _START_%BUMP_VERSION%_END_ ^^^| sed -b "s/^_START_[0-9]\+\.[0-9]\+\.[0-9]\+\.\([0-9]\+\)\(\.[0-9]\+\)*_END_/\1/"'
FOR /F "tokens=*" %%i IN (%BUMP_COMMAND_MAJOR%) DO SET BUMP_VERSION_MAJOR=%%i
FOR /F "tokens=*" %%i IN (%BUMP_COMMAND_MINOR%) DO SET BUMP_VERSION_MINOR=%%i
FOR /F "tokens=*" %%i IN (%BUMP_COMMAND_REVISION%) DO SET BUMP_VERSION_REVISION=%%i
CD /D "%~dp0"
:: Add more matches here
sed -bi "s/^!define PRODUCT_VERSION \".*\"/!define PRODUCT_VERSION \"%BUMP_VERSION%\"/g" installer/pw.nsi
sed -bi "s/^OpenSoldat Polyworks [0-9]\+\(\.[0-9]\+\)*/OpenSoldat Polyworks %BUMP_VERSION%/g" installer/readme.txt
sed -bi "s/\(MajorVer=\)[0-9]\+/\1%BUMP_VERSION_MAJOR%/g" src/prjOpenSoldatMapEditor.vbp
sed -bi "s/\(MinorVer=\)[0-9]\+/\1%BUMP_VERSION_MINOR%/g" src/prjOpenSoldatMapEditor.vbp
sed -bi "s/\(RevisionVer=\)[0-9]\+/\1%BUMP_VERSION_REVISION%/g" src/prjOpenSoldatMapEditor.vbp
ECHO DONE!
GOTO END
:USAGE
ECHO %0: Updates the version numbers in the project
ECHO Usage: %0 1.2.3.4
:END
POPD