This repository has been archived by the owner on Oct 18, 2022. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.proj
189 lines (145 loc) · 6.81 KB
/
build.proj
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright 2014 Daniel Cazzulino
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<Project ToolsVersion="4.0"
InitialTargets="CheckPrerequisites"
DefaultTargets="Build"
xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="build.props" Condition="Exists('build.props')" />
<PropertyGroup>
<Configuration Condition="'$(Configuration)' == ''">Release</Configuration>
<TrackFileAccess>false</TrackFileAccess>
<SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildProjectDirectory)</SolutionDir>
<SolutionDir Condition="!HasTrailingSlash('$(SolutionDir)')">$(SolutionDir)\</SolutionDir>
<NuGetExePath Condition="'$(NuGetExePath)' == ''">$(SolutionDir).nuget\nuget.exe</NuGetExePath>
</PropertyGroup>
<ItemGroup>
<!-- Solutions at the root directory are all built automatically unless overriden -->
<SolutionFile Include="*.sln" Condition="'$(SolutionFile)' == ''" />
<SolutionFile Include="$(SolutionFile)" Condition="'$(SolutionFile)' != ''" />
<!-- NuSpec definitions alongside a .csproj cause us to call NuGet Pack on the project instead -->
<_PackageProject Include="**\*.csproj">
<!-- We must do this metadata annotation here. Inside a target, it doesn't work :( -->
<NuSpec>%(RecursiveDir)%(Filename).nuspec</NuSpec>
</_PackageProject>
</ItemGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
<PackageSource Include="https://nuget.org/api/v2/" />
<!-- Additional package sources to restore from -->
<!--
<PackageSource Include="http://www.myget.org/F/b4ff5f68eccf4f6bbfed74f055f88d8f/" />
-->
</ItemGroup>
<PropertyGroup>
<BuildDependsOn>
BeforeBuild;
BuildSources;
PackageRestore;
CoreBuild;
AfterBuild;
</BuildDependsOn>
</PropertyGroup>
<Target Name="Build" DependsOnTargets="$(BuildDependsOn)" />
<Target Name="BeforeBuild" />
<Target Name="AfterBuild" />
<PropertyGroup>
<CleanDependsOn>
BeforeClean;
CoreClean;
AfterClean;
</CleanDependsOn>
</PropertyGroup>
<Target Name="Clean" DependsOnTargets="$(CleanDependsOn)" />
<Target Name="BeforeClean" />
<Target Name="AfterClean" />
<Target Name="Rebuild" DependsOnTargets="Clean;Build" />
<Target Name="CoreClean">
<MSBuild
Projects="@(SolutionFile)"
Targets="Clean"
Properties="TrackFileAccess=$(TrackFileAccess)"/>
<!-- Delete all .nupkg files since they aren't needed anymore and may confuse CI servers about what packages were actually generated -->
<ItemGroup>
<PackageBinaries Include="**\*.nupkg" />
</ItemGroup>
<Delete Files="@(PackageBinaries)" />
</Target>
<Target Name="CoreBuild" DependsOnTargets="CoreBuildNoVersion;CoreBuildVersion" />
<Target Name="CoreBuildNoVersion" Condition="'$(Version)' == ''">
<Message Text="Building without specific Version override." Importance="high" />
<MSBuild
Projects="@(SolutionFile)"
Targets="Build"
Properties="Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess)"/>
<Exec Command='"$(NuGetExePath)" Pack "@(PackageProject)" -NoPackageAnalysis -NonInteractive'
Condition="'%(Identity)' != ''" />
<Exec Command='"$(NuGetExePath)" Pack "@(PackageSpec)" -NoPackageAnalysis -NonInteractive'
Condition="'%(Identity)' != ''" />
</Target>
<Target Name="CoreBuildVersion" Condition="'$(Version)' != ''">
<Message Text="Building with specific Version override '$(Version)'." Importance="high" />
<MSBuild
Projects="@(SolutionFile)"
Targets="Build"
Properties="Configuration=$(Configuration);TrackFileAccess=$(TrackFileAccess);Version=$(Version)"/>
<Exec Command='"$(NuGetExePath)" Pack "@(PackageProject)" -NoPackageAnalysis -NonInteractive -Version $(Version) -Symbols'
Condition="'%(Identity)' != ''" />
<Exec Command='"$(NuGetExePath)" Pack "@(PackageSpec)" -NoPackageAnalysis -NonInteractive -Version $(Version)'
Condition="'%(Identity)' != ''" />
</Target>
<Target Name="BuildPackage"
Inputs="@(NuSpec)"
Outputs="%(Identity)-BATCH"
DependsOnTargets="RestorePackages;SemanticGit:GetVersion">
<PropertyGroup>
<ReleaseNotesPath>%(NuSpec.RootDir)%(NuSpec.Directory)ReleaseNotes.txt</ReleaseNotesPath>
<ReleaseNotes Condition="Exists('$(ReleaseNotesPath)')">$([System.IO.File]::ReadAllText('$(ReleaseNotesPath)'))</ReleaseNotes>
</PropertyGroup>
<Message Text="Updating %(NuSpec.Filename)%(NuSpec.Extension) release notes from existing file"
Condition="'$(ReleaseNotes)' != ''"
Importance="normal" />
<XmlPoke XmlInputPath="@(NuSpec)"
Query="/package/metadata/releaseNotes"
Value="$(ReleaseNotes)"
Condition="'$(ReleaseNotes)' != ''" />
<Exec Command=""$(NuGetCommand)" pack -NoPackageAnalysis "%(NuSpec.FullPath)" -Version "$(_Major).$(_Minor).$(_Patch)$(_PreRelease)""
ContinueOnError="false" />
</Target>
<Target Name="PackageRestore">
<Message Text="Restoring NuGet packages..." Importance="normal" />
<Exec Command='"$(NuGetExePath)" restore "%(SolutionFile.Identity)" -NonInteractive -Source @(PackageSource) -Verbosity quiet' />
<!--
Add GitHubLink OOB?
<Exec Command=""$(NuGetExePath)" install githublink -Pre -Source http://www.myget.org/F/b4ff5f68eccf4f6bbfed74f055f88d8f/ -SolutionDir "$(SolutionDir)" -Verbosity quiet -ExcludeVersion" Condition="!Exists('$(SolutionDir)\packages\githublink\')" />
-->
<!-- Delete all .nupkg files since they aren't needed anymore and may confuse CI servers about what packages were actually generated -->
<ItemGroup>
<PackageBinaries Include="**\*.nupkg" />
</ItemGroup>
<Delete Files="@(PackageBinaries)" />
</Target>
<Target Name="BuildSources">
<!-- The conditionals on the item metadata don't work outside a target -->
<ItemGroup>
<!-- We only keep those that do have a nuspec at the .csproj level -->
<PackageProject Include="@(_PackageProject)" Condition="Exists('%(NuSpec)')" />
<!-- Grab the rest of the spec files. -->
<PackageSpec Include="**\*.nuspec" Exclude="@(PackageProject -> '%(NuSpec)')" />
</ItemGroup>
</Target>
<Target Name="CheckPrerequisites">
<Error Text=".nuget\NuGet.exe does not exist. Run build.ps1 at least once."
Condition="!Exists('.nuget\NuGet.exe')" />
</Target>
<Import Project="build.targets" Condition="Exists('build.targets')" />
</Project>