-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDirectory.Solution.targets
More file actions
53 lines (50 loc) · 3.27 KB
/
Directory.Solution.targets
File metadata and controls
53 lines (50 loc) · 3.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
<Project>
<Target Name="GetGitBranch" BeforeTargets="ValidateSolutionConfiguration"
Condition="!Exists('$(SolutionDir)changes.log')">
<Exec ConsoleToMSBuild="True" IgnoreExitCode="true" Command="git rev-parse --abbrev-ref HEAD"
StandardOutputImportance="low" StandardErrorImportance="low" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ConsoleOutput" PropertyName="GitBranch" />
<Output TaskParameter="ExitCode" PropertyName="GitBranchExitCode" />
</Exec>
</Target>
<Target Name="GetGitTag" AfterTargets="GetGitBranch"
Condition="$(GitBranch) != '' AND !Exists('$(SolutionDir)changes.log')">
<Exec ConsoleToMSBuild="True" IgnoreExitCode="true"
Condition="$(GitBranch) == 'master' OR $(GitBranch) == 'main'"
Command='git describe --tags --abbrev=0 --exclude "v*-*"' StandardOutputImportance="low"
StandardErrorImportance="low" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ConsoleOutput" PropertyName="GitTag" />
<Output TaskParameter="ConsoleOutput" PropertyName="GitVerTag" />
<Output TaskParameter="ExitCode" PropertyName="GitTagExitCode" />
</Exec>
<Exec ConsoleToMSBuild="True" IgnoreExitCode="true"
Condition="$(GitBranch) != 'master' AND $(GitBranch) != 'main'"
Command="git describe --tags --abbrev=0" StandardOutputImportance="low"
StandardErrorImportance="low" ContinueOnError="WarnAndContinue">
<Output TaskParameter="ConsoleOutput" PropertyName="GitTag" />
<Output TaskParameter="ExitCode" PropertyName="GitTagExitCode" />
</Exec>
</Target>
<Target Name="CreateGitLog" AfterTargets="GetGitTag"
Condition="!Exists('$(MSBuildThisFileDirectory)\changes.log')">
<PropertyGroup>
<GitBaseCommand>git log --no-merges</GitBaseCommand>
<GitCommand Condition="$([MSBuild]::IsOSPlatform('Windows')) == 'true'">$(GitBaseCommand)
--pretty=format:"- %25%25s"</GitCommand>
<GitCommand Condition="$([MSBuild]::IsOSPlatform('Windows')) != 'true'">$(GitBaseCommand)
--pretty=format:"- %25s"</GitCommand>
</PropertyGroup>
<Exec Condition="$(GitTagExitCode) == 0"
Command='$(GitCommand) $(GitTag)..HEAD > "$(MSBuildThisFileDirectory)changes.log"'
StandardOutputImportance="low" StandardErrorImportance="low" ContinueOnError="WarnAndContinue" />
<Exec Condition="$(GitTagExitCode) != 0"
Command="$(GitCommand) > "$(MSBuildThisFileDirectory)changes.log""
StandardOutputImportance="low" StandardErrorImportance="low" ContinueOnError="WarnAndContinue" />
<Exec Condition="$([MSBuild]::IsOSPlatform('Windows')) == 'true'"
Command="type $(MSBuildThisFileDirectory)changes.log | findstr -v 💚 | findstr -v : | findstr -v 🔧 > $(MSBuildThisFileDirectory)changes.log"
StandardOutputImportance="low" StandardErrorImportance="low" ContinueOnError="WarnAndContinue" />
<Exec Condition="$([MSBuild]::IsOSPlatform('Windows')) != 'true'"
Command="sed -i '/^- 💚/ d' $(MSBuildThisFileDirectory)changes.log && sed -i '/^- 🔧/ d' $(MSBuildThisFileDirectory)changes.log && sed -i '/:/d' $(MSBuildThisFileDirectory)changes.log"
StandardOutputImportance="low" StandardErrorImportance="low" ContinueOnError="WarnAndContinue" />
</Target>
</Project>