File tree Expand file tree Collapse file tree 3 files changed +18
-4
lines changed
Expand file tree Collapse file tree 3 files changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -401,3 +401,4 @@ FodyWeavers.xsd
401401
402402# ntp specific
403403* /* /.version
404+ * /* /scm-rev
Original file line number Diff line number Diff line change @@ -138,7 +138,7 @@ IF {%1} == {-G} (
138138 SET GENERATESCMREV = %2
139139 SET OUTPUTSCMREV = %2
140140 IF NOT {%3 } == {} GOTO USAGE
141- GOTO GENERATE_SCM_REV
141+ GOTO GENERATE_SCM_BK_REV
142142)
143143IF {%1 } == {-S} (
144144 IF {%2 } == {} GOTO USAGE
@@ -304,19 +304,27 @@ REM ****************************************************************************
304304
305305 REM Now we have the version info, try to add a BK ChangeSet revision
306306
307- IF " %SCMREV% " == " " GOTO GENERATE_SCM_REV
307+ IF " %SCMREV% " == " " GOTO GENERATE_SCM_BK_REV
308308
309309 REM ** Called as -S to use generated scm-rev file.
310310 FOR /F " TOKENS=1" %%a IN ('type %SCMREV% ') DO @ SET CSET = %%a
311311 GOTO HAVECHANGESETREVISION
312312
313- :GENERATE_SCM_REV
313+ :GENERATE_SCM_BK_REV
314314 REM ** Check if BK is installed ...
315315 bk root ../../../.. 2 > NUL > NUL
316- IF ERRORLEVEL 1 GOTO NOBK
316+ IF ERRORLEVEL 1 GOTO GENERATE_SCM_GIT_REV
317317
318318 REM ** Try to get the CSet rev directly from BK
319319 FOR /F " TOKENS=1 DELIMS==" %%a IN ('bk.exe -R prs -hr+ -nd:I: ChangeSet') DO @ SET CSET = %%a
320+ GOTO WRITE_SCM_REV
321+
322+ :GENERATE_SCM_GIT_REV
323+ git rev-parse --short HEAD 2 > NUL > NUL
324+ IF ERRORLEVEL 1 GOTO NOBK
325+
326+ FOR /F " TOKENS=1" %%a IN ('git rev-parse --short HEAD') DO @ SET CSET = %%a
327+ GOTO WRITE_SCM_REV
320328
321329:NOBK
322330 IF NOT " %GENERATESCMREV% " == " " GOTO WRITE_SCM_REV
Original file line number Diff line number Diff line change 1313 <Command >call ..\..\scripts\mkver.bat -G scm-rev</Command >
1414 <Outputs >scm-rev</Outputs >
1515 </CustomBuild >
16+ <CustomBuild Include =" ..\..\..\..\.git\index" Condition =" exists('..\..\..\..\.git\index')" >
17+ <Message >Generating scm-rev from git...</Message >
18+ <Command >call ..\..\scripts\mkver.bat -G scm-rev</Command >
19+ <Outputs >scm-rev</Outputs >
20+ </CustomBuild >
1621 </ItemGroup >
1722 <ItemGroup >
1823 <CustomBuild Include =" scm-rev" >
You can’t perform that action at this time.
0 commit comments