| |
|
1 |
@echo off |
| |
|
2 |
|
| |
|
3 |
rem Script retrieves version information from version.h file |
| |
|
4 |
|
| |
|
5 |
setlocal ENABLEDELAYEDEXPANSION |
| |
|
6 |
|
| |
|
7 |
rem Detect current Major.Minos versions |
| |
|
8 |
set _ver_cmd=type "%WORKSPACE%\src\common\version.h" |
| |
|
9 |
|
| |
|
10 |
for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION1 "') do set _MajorVersion=%%a |
| |
|
11 |
if errorlevel 1 ( |
| |
|
12 |
echo Problem with retrieving _MajorVersion. |
| |
|
13 |
exit /b 1 |
| |
|
14 |
) |
| |
|
15 |
|
| |
|
16 |
if "!_MajorVersion!" == "" ( |
| |
|
17 |
echo Can't get the major version. |
| |
|
18 |
exit /b 1 |
| |
|
19 |
) |
| |
|
20 |
|
| |
|
21 |
set _ver_cmd=type "%WORKSPACE%\src\common\version.h" |
| |
|
22 |
for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION2 "') do set _MinorVersion=%%a |
| |
|
23 |
if errorlevel 1 ( |
| |
|
24 |
echo Problem with retrieving _MinorVersion. |
| |
|
25 |
exit /b 1 |
| |
|
26 |
) |
| |
|
27 |
if "!_MinorVersion!" == "" ( |
| |
|
28 |
echo Can't get the minor version. |
| |
|
29 |
exit /b 1 |
| |
|
30 |
) |
| |
|
31 |
|
| |
|
32 |
set _ver_cmd=type "%WORKSPACE%\src\common\version.h" |
| |
|
33 |
for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION3 "') do set _BuildVersion=%%a |
| |
|
34 |
if errorlevel 1 ( |
| |
|
35 |
echo Problem with retrieving _BuildVersion. |
| |
|
36 |
exit /b 1 |
| |
|
37 |
) |
| |
|
38 |
if "!_BuildVersion!" == "" ( |
| |
|
39 |
echo Can't get the build version. |
| |
|
40 |
exit /b 1 |
| |
|
41 |
) |
| |
|
42 |
|
| |
|
43 |
set _ver_cmd=type "%WORKSPACE%\src\common\version.h" |
| |
|
44 |
for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION4 "') do set _DetailVersion=%%a |
| |
|
45 |
if errorlevel 1 ( |
| |
|
46 |
echo Problem with retrieving _DetailVersion. |
| |
|
47 |
exit /b 1 |
| |
|
48 |
) |
| |
|
49 |
if "!_DetailVersion!" == "" ( |
| |
|
50 |
echo Can't get the detail version. |
| |
|
51 |
exit /b 1 |
| |
|
52 |
) |
| |
|
53 |
|
| |
|
54 |
set _ver_cmd=type "%WORKSPACE%\src\common\version.h" |
| |
|
55 |
for /f "tokens=3 delims= " %%a in ('!_ver_cmd! ^|find "define PRODUCT_VERSION "') do set _TextVersion=%%a |
| |
|
56 |
if errorlevel 1 ( |
| |
|
57 |
echo Problem with retrieving _TextVersion. |
| |
|
58 |
exit /b 1 |
| |
|
59 |
) |
| |
|
60 |
if "!_TextVersion!" == "" ( |
| |
|
61 |
echo Can't get the detail version. |
| |
|
62 |
exit /b 1 |
| |
|
63 |
) |
| |
|
64 |
|
| |
|
65 |
endlocal & call SET CHMajorVersion=%_MajorVersion%& SET CHMinorVersion=%_MinorVersion%& SET CHBuildVersion=%_BuildVersion%& SET CHDetailVersion=%_DetailVersion%& SET CHTextVersion=%_TextVersion:"=% |
| |
|
66 |
|
| |
|
67 |
echo Detected version %CHMajorVersion%.%CHMinorVersion%.%CHBuildVersion%.%CHDetailVersion% (%CHTextVersion%) |