Skip to content

Commit

Permalink
build: always re-generate PRODUCT_VERSION
Browse files Browse the repository at this point in the history
  • Loading branch information
fxliang committed Jul 22, 2024
1 parent 60c5455 commit a6c3e99
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions build.bat
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,15 @@ if not defined VERSION_PATCH set VERSION_PATCH=1
if not defined WEASEL_VERSION set WEASEL_VERSION=%VERSION_MAJOR%.%VERSION_MINOR%.%VERSION_PATCH%
if not defined WEASEL_BUILD set WEASEL_BUILD=0

if not defined PRODUCT_VERSION (
rem use numeric build version for release build
set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%
rem for non-release build, try to use git commit hash as product build version
if not defined RELEASE_BUILD (
rem check if git is installed and available, then get the short commit id of head
git --version >nul 2>&1
if not errorlevel 1 (
rem get short commmit id of head
for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%-%%i)
)
rem use numeric build version for release build
set PRODUCT_VERSION=%WEASEL_VERSION%.%WEASEL_BUILD%
rem for non-release build, try to use git commit hash as product build version
if not defined RELEASE_BUILD (
rem check if git is installed and available, then get the short commit id of head
git --version >nul 2>&1
if not errorlevel 1 (
rem get short commmit id of head
for /F %%i in ('git rev-parse --short HEAD') do (set PRODUCT_VERSION=%WEASEL_VERSION%-%%i)
)
)

Expand Down

0 comments on commit a6c3e99

Please sign in to comment.