-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Directory.Build.targets
109 lines (98 loc) · 4.81 KB
/
Directory.Build.targets
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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<Project>
<PropertyGroup>
<AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)'=='' AND EXISTS('$(MSBuildThisFileDirectory)build/cloud3d-codesign.snk')">$(MSBuildThisFileDirectory)build/cloud3d-codesign.snk</AssemblyOriginatorKeyFile>
<AssemblyOriginatorKeyFile Condition="'$(AssemblyOriginatorKeyFile)'==''">$(MSBuildThisFileDirectory)build/Test.snk</AssemblyOriginatorKeyFile>
<SignAssembly Condition="EXISTS('$(AssemblyOriginatorKeyFile)')">true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<GenerateNuspecDependsOn>SetAuthors;SetPackageTags;SetPackageDescription;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>
<Target Name="SetAuthors">
<RemoveDuplicates
Inputs="@(Author)">
<Output
TaskParameter="Filtered"
ItemName="_Author"/>
</RemoveDuplicates>
<PropertyGroup>
<Authors Condition="'@(_Author)'!=''">@(_Author, ',')</Authors>
</PropertyGroup>
</Target>
<Target Name="SetPackageTags">
<RemoveDuplicates
Inputs="@(PackageTag)">
<Output
TaskParameter="Filtered"
ItemName="_PackageTag"/>
</RemoveDuplicates>
<PropertyGroup>
<PackageTags Condition="'$(PackageTags)'==''">@(_PackageTag, ' ')</PackageTags>
</PropertyGroup>
</Target>
<Target Name="SetPackageDescription" DependsOnTargets="GetBuildVersion">
<PropertyGroup>
<PackageDescription>
Assembly Version: $(AssemblyVersion)
File Version: $(AssemblyFileVersion)
Informational Version: $(AssemblyInformationalVersion)
Build Configuration: $(Configuration)
$(AssemblyDescription)
</PackageDescription>
</PropertyGroup>
<Message Text="Package Description: $(PackageDescription)" Importance="high" />
</Target>
<Target Name="PackIfChanged">
<ItemGroup>
<_Temporary Remove="@(_Temporary)" />
<_Temporary Include="$(git_commit_ids)" />
</ItemGroup>
<ItemGroup>
<GitProjectDirectory Include="$(MSBuildProjectDirectory)" />
<GitProjectDirectory Include="@(ProjectReference->DirectoryName())" />
</ItemGroup>
<Message Importance="high" Text="Project: $(MSBuildProjectName)" />
<Message Importance="high" Text="Git Commit IDs: %(_Temporary.Identity)" />
<Message Importance="high" Text="GitProjectDirectory: $([MSBuild]::MakeRelative($(SolutionDir),'%(GitProjectDirectory.Identity)'))" />
<PropertyGroup>
<_GitCommand>git log --pretty=tformat:"%%H" -n1 .</_GitCommand>
</PropertyGroup>
<Exec Command="$(_GitCommand)" WorkingDirectory="%(GitProjectDirectory.Identity)" ConsoleToMSBuild="true">
<Output TaskParameter="ConsoleOutput" ItemName="ProjectCommitID" />
</Exec>
<ItemGroup>
<ProjectCommitID Condition="'%(Identity)' != '' AND
'@(ProjectCommitID)' != '' AND
'@(_Temporary)' != ''">
<CommitIDFound>true</CommitIDFound>
</ProjectCommitID>
</ItemGroup>
<Message Importance="high" Text="ProjectCommitID: %(ProjectCommitID.Identity) %(ProjectCommitID.CommitIDFound)" />
<Message Importance="high" Text="IsPackable: $(IsPackable)" />
<Message Importance="high" Text="IsTestProject: $(IsTestProject)" />
<PropertyGroup>
<CommitIDFound Condition="'%(ProjectCommitID.CommitIDFound)'=='true'">true</CommitIDFound>
<CommitIDFound Condition="'$(CommitIDFound)'==''">false</CommitIDFound>
</PropertyGroup>
<Message Importance="high" Text="CommitIDFound: $(CommitIDFound)" />
<ItemGroup>
<_Temporary Remove="@(_Temporary)" />
<_Temporary Include="$(ProjectToBuild)" />
</ItemGroup>
<Message Importance="high" Text="Projects To Build: %(_Temporary.Identity)" />
<PropertyGroup>
<BuildProject>$(CommitIDFound)</BuildProject>
<BuildProject Condition="'$(MSBuildProjectName)'=='%(_Temporary.Identity)'">true</BuildProject>
</PropertyGroup>
<Message Importance="high" Text="BuildProject: $(BuildProject)" />
<ItemGroup>
<_Temporary Remove="@(_Temporary)" />
</ItemGroup>
<!-- Pack libraries -->
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Pack" Condition="'$(IsPackable)'=='true' AND '$(BuildProject)'=='true'" />
<!-- Build sample and test projects to ensure they can build correctly -->
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Build" Condition="'$(IsPackable)'=='false' AND '$(BuildProject)'=='true'" />
<!-- Rebuild test projects with project references for code coverage -->
<MSBuild Projects="$(MSBuildProjectFile)" Targets="Build" Condition="'$(IsTestProject)'=='true' AND '$(BuildProject)'=='true'" />
<Message Importance="high" Text="##vso[build.addbuildtag]$(MSBuildProjectName)" Condition="'$(IsPackable)'=='true' AND '$(BuildProject)'=='true'" />
</Target>
</Project>