X-Git-Url: http://git.iain.cx/?a=blobdiff_plain;f=version.cmd;h=0e216355d1696119f1a2622490666b4f0d8167b8;hb=caaaa1208f29647987173f7d9bc1aa75b58757b7;hp=536c3e6be1c3863c1657654235cc17ed81f6e9d6;hpb=44e85d48df1ecc95547d066459a1e904f128618c;p=nssm.git diff --git a/version.cmd b/version.cmd index 536c3e6..0e21635 100644 --- a/version.cmd +++ b/version.cmd @@ -21,13 +21,29 @@ set version=%version:~0,-1% set minor=%version:*.=% call set major=%%version:.%minor%=%% +@rem Build flags. +set flags=0L + @rem Don't include n and commit if we match a tag exactly. -if "%n%" == "0" set description=%major%.%minor% +if "%n%" == "0" (set description=%major%.%minor%) else set flags=VS_FF_PRERELEASE +@rem Maybe we couldn't get the git tag. +if "%commit%" == "prerelease" set flags=VS_FF_PRERELEASE @rem Ignore the build number if this isn't Jenkins. if "%BUILD_NUMBER%" == "" set BUILD_NUMBER=0 +@rem Copyright year provided by Jenkins. +set md=%BUILD_ID:*-=% +call set year=%%BUILD_ID:%md%=%% +set year=%year:~0,-1% +if "%BUILD_ID%" == "" set year= + @rem Create version.h. -@echo>version.h #define NSSM_VERSION _T("%description%") -@echo>>version.h #define NSSM_VERSIONINFO %major%,%minor%,%n%,%BUILD_NUMBER% -@echo>>version.h #define NSSM_DATE _T("%DATE%") +@echo>version.h.new #define NSSM_VERSION _T("%description%") +@echo>>version.h.new #define NSSM_VERSIONINFO %major%,%minor%,%n%,%BUILD_NUMBER% +@echo>>version.h.new #define NSSM_DATE _T("%DATE%") +@echo>>version.h.new #define NSSM_FILEFLAGS %flags% +@echo>>version.h.new #define NSSM_COPYRIGHT _T("Public Domain; Author Iain Patterson 2003-%year%") + +fc version.h version.h.new >NUL: 2>NUL: +if %ERRORLEVEL% == 0 (del version.h.new) else (move /y version.h.new version.h)