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