|
400 | 400 | </ImportGroup> |
401 | 401 | <Target Name="_GetBuildInfo" BeforeTargets="PrepareForBuild"> |
402 | 402 | <PropertyGroup> |
403 | | - <HG Condition="$(HG) == ''">hg</HG> |
404 | | - <_HG>$(HG)</_HG> |
405 | | - <_HG Condition="$(HG.Contains(` `))">"$(HG)"</_HG> |
| 403 | + <GIT Condition="$(GIT) == ''">git</GIT> |
| 404 | + <_GIT>$(GIT)</_GIT> |
| 405 | + <_GIT Condition="$(GIT.Contains(` `))">"$(GIT)"</_GIT> |
406 | 406 | </PropertyGroup> |
407 | | - <Message Text="Getting build info from $(_HG)" Importance="high" /> |
| 407 | + <Message Text="Getting build info from $(_GIT)" Importance="high" /> |
408 | 408 | <MakeDir Directories="$(IntDir)" Condition="!Exists($(IntDir))" /> |
409 | | - <Exec Command="$(_HG) id -b > "$(IntDir)hgbranch.txt"" ContinueOnError="true" /> |
410 | | - <Exec Command="$(_HG) id -i > "$(IntDir)hgversion.txt"" ContinueOnError="true" /> |
411 | | - <Exec Command="$(_HG) id -t > "$(IntDir)hgtag.txt"" ContinueOnError="true" /> |
| 409 | + <Exec Command="$(_GIT) name-rev --name-only HEAD > "$(IntDir)gitbranch.txt"" ContinueOnError="true" /> |
| 410 | + <Exec Command="$(_GIT) rev-parse HEAD > "$(IntDir)gitversion.txt"" ContinueOnError="true" /> |
| 411 | + <Exec Command="$(_GIT) name-rev --tags --name id -t > "$(IntDir)gittag.txt"" ContinueOnError="true" /> |
412 | 412 | <PropertyGroup> |
413 | | - <HgBranch Condition="Exists('$(IntDir)hgbranch.txt')">$([System.IO.File]::ReadAllText('$(IntDir)hgbranch.txt').Trim())</HgBranch> |
414 | | - <HgVersion Condition="Exists('$(IntDir)hgversion.txt')">$([System.IO.File]::ReadAllText('$(IntDir)hgversion.txt').Trim())</HgVersion> |
415 | | - <HgTag Condition="Exists('$(IntDir)hgtag.txt')">$([System.IO.File]::ReadAllText('$(IntDir)hgtag.txt').Trim())</HgTag> |
| 413 | + <GitBranch Condition="Exists('$(IntDir)gitbranch.txt')">$([System.IO.File]::ReadAllText('$(IntDir)gitbranch.txt').Trim())</GitBranch> |
| 414 | + <GitVersion Condition="Exists('$(IntDir)gitversion.txt')">$([System.IO.File]::ReadAllText('$(IntDir)gitversion.txt').Trim())</GitVersion> |
| 415 | + <GitTag Condition="Exists('$(IntDir)gittag.txt')">$([System.IO.File]::ReadAllText('$(IntDir)gittag.txt').Trim())</GitTag> |
416 | 416 | </PropertyGroup> |
| 417 | + <Message Text="Building $(GitTag):$(GitVersion) $(GitBranch)" Importance="high" /> |
417 | 418 | <ItemGroup> |
418 | 419 | <ClCompile Include="..\Modules\getbuildinfo.c"> |
419 | | - <PreprocessorDefinitions>HGVERSION="$(HgVersion)";HGTAG="$(HgTag)";HGBRANCH="$(HgBranch)";%(PreprocessorDefinitions)</PreprocessorDefinitions> |
| 420 | + <PreprocessorDefinitions>GITVERSION="$(GitVersion)";GITTAG="$(GitTag)";GITBRANCH="$(GitBranch)";%(PreprocessorDefinitions)</PreprocessorDefinitions> |
420 | 421 | </ClCompile> |
421 | 422 | </ItemGroup> |
422 | 423 | </Target> |
|
0 commit comments