Skip to content

Commit a7f3a99

Browse files
committed
chore: Add initial version calculation script
1 parent 2db3f07 commit a7f3a99

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

GetVersion.cmd

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
@ECHO OFF
2+
SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION
3+
4+
REM Parse command line.
5+
SET Mode=%~1
6+
7+
REM Get product version.
8+
REM TODO!
9+
10+
REM Get code revision.
11+
REM For Subversion, this is a positive integer.
12+
REM For Git, this is the stable version, new commits, and latest commit ID hyphenated.
13+
SET Revision=
14+
IF EXIST ".svn" (
15+
FOR /F "usebackq tokens=1" %%R IN (`svn --non-interactive info --show-item revision .`) DO SET Revision=%%R
16+
)
17+
IF EXIST ".git" (
18+
FOR /F "usebackq tokens=1" %%R IN (`git describe --first-parent --always`) DO SET Revision=%%R
19+
)
20+
IF "%Revision%" == "" (
21+
>&2 ECHO WARNING: No Subversion or Git revision found.
22+
)
23+
24+
REM Output version numbers.
25+
ECHO OpenRails_Version=%Version%
26+
ECHO OpenRails_Revision=%Revision%

0 commit comments

Comments
 (0)