• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@echo off
2
3setlocal enableextensions enabledelayedexpansion
4
5for /f %%v in ('cd "%~dp0.." ^&^& git status ^>NUL 2^>NUL ^&^& git describe --tags --match "v*" --dirty 2^>NUL') do set version=%%v
6
7if not "%version%"=="" set version=!version:~1! && goto :gotversion
8
9if exist "%~dp0..\package_version" goto :getversion
10
11echo Git cannot be found, nor can package_version. Generating unknown version.
12
13set version=unknown
14
15goto :gotversion
16
17:getversion
18
19for /f "delims== tokens=2" %%v in (%~dps0..\package_version) do set version=%%v
20set version=!version:"=!
21
22:gotversion
23
24set version=!version: =!
25set version_out=#define %~2 "%version%"
26
27echo %version_out%> "%~1_temp"
28
29echo n | comp "%~1_temp" "%~1" > NUL 2> NUL
30
31if not errorlevel 1 goto exit
32
33copy /y "%~1_temp" "%~1"
34
35:exit
36
37del "%~1_temp"
38