Track whether working dir has modifications

This commit is contained in:
Julio C. Rocha 2024-05-10 14:00:18 -07:00
parent c6b2750cfe
commit 9b55325429
1 changed files with 51 additions and 43 deletions

View File

@ -1,44 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="GetGitVersion" BeforeTargets="PrepareForBuild" Condition="'$(GetGitVersionSet)'!='true'">
<Exec Command="git rev-parse HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevision" />
</Exec>
<Exec Command="git rev-parse --short HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevisionShort" />
</Exec>
<Exec Command="git rev-list --count HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevisionCount" />
</Exec>
<!-- TODO: Remove -->
<Message Importance="High" Text="git rev: [$(GitRevision)]" />
<Message Importance="High" Text="git rev short: [$(GitRevisionShort)]" />
<Message Importance="High" Text="git rev count: [$(GitRevisionCount)]" />
<PropertyGroup>
<!-- Call only once per MSBuild invocation. -->
<GetGitVersionSet>true</GetGitVersionSet>
</PropertyGroup>
<ItemGroup>
<ClCompile>
<PreprocessorDefinitions>
%(PreprocessorDefinitions);
GIT_REVISION=$(GitRevision);
GIT_REVISION_SHORT=$(GitRevisionShort);
VERSION_BUILD=$(GitRevisionCount);
VERSION_BUILD_YEAR=$([System.DateTime]::Now.ToString(`yyyy`))
</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>
%(PreprocessorDefinitions);
GIT_REVISION=$(GitRevision);
GIT_REVISION_SHORT=$(GitRevisionShort);
VERSION_BUILD=$(GitRevisionCount);
VERSION_BUILD_YEAR=$([System.DateTime]::Now.ToString(`yyyy`))
</PreprocessorDefinitions>
</ResourceCompile>
</ItemGroup>
</Target>
<?xml version="1.0" encoding="utf-8"?>
<Project>
<Target Name="GetGitVersion" BeforeTargets="PrepareForBuild" Condition="'$(GetGitVersionSet)'!='true'">
<Exec Command="git rev-parse HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevision" />
</Exec>
<Exec Command="git rev-parse --short HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevisionShort" />
</Exec>
<Exec Command="git rev-list --count HEAD" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitRevisionCount" />
</Exec>
<Exec Command="git diff --stat" ConsoleToMsBuild="true" StandardOutputImportance="Low" EchoOff="true">
<Output TaskParameter="ConsoleOutput" PropertyName="GitIsDirty" />
</Exec>
<PropertyGroup>
<!-- Call only once per MSBuild invocation. -->
<GetGitVersionSet>true</GetGitVersionSet>
<GitVersion>$(GitRevisionShort)</GitVersion>
<GitVersion Condition="'$(GitIsDirty)'!=''">$(GitRevisionShort)-Dirty</GitVersion>
</PropertyGroup>
<!-- TODO: Remove -->
<Message Importance="High" Text="git rev: [$(GitRevision)]" />
<Message Importance="High" Text="git rev short: [$(GitRevisionShort)]" />
<Message Importance="High" Text="git rev count: [$(GitRevisionCount)]" />
<Message Importance="High" Text="git dirty?: [Dirty]" Condition="'$(GitIsDirty)'!=''" />
<Message Importance="High" Text="git dirty?: []" Condition="'$(GitIsDirty)'==''" />
<Message Importance="High" Text="GitVersion: [$(GitVersion)]" />
<ItemGroup>
<ClCompile>
<PreprocessorDefinitions>
%(PreprocessorDefinitions);
GIT_REVISION=$(GitRevision);
GIT_REVISION_SHORT=$(GitRevisionShort);
VERSION_BUILD=$(GitRevisionCount);
VERSION_BUILD_YEAR=$([System.DateTime]::Now.ToString(`yyyy`))
</PreprocessorDefinitions>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>
%(PreprocessorDefinitions);
GIT_REVISION=$(GitRevision);
GIT_REVISION_SHORT=$(GitRevisionShort);
VERSION_BUILD=$(GitRevisionCount);
VERSION_BUILD_YEAR=$([System.DateTime]::Now.ToString(`yyyy`))
</PreprocessorDefinitions>
</ResourceCompile>
</ItemGroup>
</Target>
</Project>