-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathDirectory.Build.props
246 lines (197 loc) · 16.1 KB
/
Directory.Build.props
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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
<!-- Use TreatAsLocalProperty to make the globally passed-in OfficialBuildId property mutable. -->
<Project TreatAsLocalProperty="OfficialBuildId">
<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />
<PropertyGroup>
<RepositoryName>$(MSBuildProjectName)</RepositoryName>
<GitInfoRepoPropsFile>$([MSBuild]::NormalizePath('$(PrereqsDir)', 'git-info', '$(RepositoryName).props'))</GitInfoRepoPropsFile>
<BuildInParallel Condition="'$(BuildInParallel)' == ''">true</BuildInParallel>
<RunEachTargetSeparately>false</RunEachTargetSeparately>
<!-- If this is a dev build with parallelism enabled, ensure that RunEachTargetSeparately is true so that StopOnFirstFailure will be honored.
This improves the dev experience because it will fail the build as soon as an error occurs rather than waiting for all parallel projects
to finish. This isn't enabled in CI builds because it has a slight perf impact. -->
<RunEachTargetSeparately Condition="'$(BuildInParallel)' == 'true' and '$(ContinuousIntegrationBuild)' != 'true'">true</RunEachTargetSeparately>
</PropertyGroup>
<!-- TODO: Remove this import when the default build behavior for source-only builds changes to dev.
https://github.com/dotnet/source-build/issues/4855 -->
<Import Project="$(GitInfoRepoPropsFile)" Condition="Exists('$(GitInfoRepoPropsFile)') and '$(DotNetBuildSourceOnly)' == 'true'" />
<PropertyGroup>
<!-- Fake, to satisfy the SDK. -->
<TargetFramework>netstandard2.0</TargetFramework>
<DisableImplicitFrameworkReferences>true</DisableImplicitFrameworkReferences>
<ProjectDirectory>$([MSBuild]::NormalizeDirectory('$(SrcDir)', '$(RepositoryName)'))</ProjectDirectory>
<!-- Paths to the version props files -->
<PackageVersionsDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsObjDir)', 'PackageVersions'))</PackageVersionsDir>
<PackageVersionPropsPath>$(PackageVersionsDir)PackageVersions.$(RepositoryName).props</PackageVersionPropsPath>
<CurrentSourceBuiltPackageVersionPropsPath>$(PackageVersionsDir)PackageVersions.$(RepositoryName).Current.props</CurrentSourceBuiltPackageVersionPropsPath>
<PreviouslySourceBuiltPackageVersionPropsPath>$(PackageVersionsDir)PackageVersions.$(RepositoryName).Previous.props</PreviouslySourceBuiltPackageVersionPropsPath>
<SnapshotPackageVersionPropsPath>$(PackageVersionsDir)PackageVersions.$(RepositoryName).Snapshot.props</SnapshotPackageVersionPropsPath>
<PackageVersionPropsFlowType>DependenciesOnly</PackageVersionPropsFlowType>
<GlobalJsonFile Condition="'$(GlobalJsonFile)' == '' and Exists('$(ProjectDirectory)global.json')">$(ProjectDirectory)global.json</GlobalJsonFile>
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)NuGet.config')">$(ProjectDirectory)NuGet.config</NuGetConfigFile>
<NuGetConfigFile Condition="'$(NuGetConfigFile)' == '' and Exists('$(ProjectDirectory)NuGet.Config')">$(ProjectDirectory)NuGet.Config</NuGetConfigFile>
<OriginalNuGetConfigFile>$(NuGetConfigFile)</OriginalNuGetConfigFile>
<!-- Update nuget.config property to point to modified file that will be created/updated during build. -->
<NuGetConfigFile Condition="'$(OriginalNuGetConfigFile)' != ''">$(BaseIntermediateOutputPath)$([System.IO.Path]::GetFileName('$(OriginalNuGetConfigFile)'))</NuGetConfigFile>
<RepoAssetManifestsDir>$([MSBuild]::NormalizeDirectory('$(AssetManifestsIntermediateDir)', '$(RepositoryName)'))</RepoAssetManifestsDir>
<IntermediateSymbolsRepoDir>$([MSBuild]::NormalizeDirectory('$(IntermediateSymbolsRootDir)', '$(RepositoryName)'))</IntermediateSymbolsRepoDir>
<RepoArtifactsDir>$([MSBuild]::NormalizeDirectory('$(ProjectDirectory)', 'artifacts'))</RepoArtifactsDir>
<RepoArtifactsPackageCache>$([MSBuild]::NormalizeDirectory('$(RepoArtifactsDir)', 'sb', 'package-cache'))</RepoArtifactsPackageCache>
<SourceBuiltSdksDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'source-built-sdks'))</SourceBuiltSdksDir>
<SbrpCacheNuGetSourceName>source-build-reference-package-cache</SbrpCacheNuGetSourceName>
<SourceBuiltSourceNamePrefix>source-built-</SourceBuiltSourceNamePrefix>
<PreviousBuildPassSourceNamePrefix>previous-build-pass-</PreviousBuildPassSourceNamePrefix>
<!-- Set the bootstrap version to the VMR's version if empty. (no bootstrap set). -->
<ArcadeBootstrapVersion>$([MSBuild]::ValueOrDefault('$(ARCADE_BOOTSTRAP_VERSION)', '$(ArcadeSdkVersion)'))</ArcadeBootstrapVersion>
<ArtifactsLogRepoDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsLogDir)', '$(RepositoryName)'))</ArtifactsLogRepoDir>
<PackageReportRepoDir>$([MSBuild]::NormalizeDirectory('$(PackageReportDir)', '$(RepositoryName)'))</PackageReportRepoDir>
<RidAgnosticVerticalName>Windows_x64</RidAgnosticVerticalName>
<!--
Publish only RID-specific assets when we're not doing source-build and one of the following cases is true:
- This is not the Rid-agnostic vertical
- This is a BuildPass1 build
-->
<EnableDefaultRidSpecificArtifacts
Condition="('$(VerticalName)' != '' and '$(VerticalName)' != '$(RidAgnosticVerticalName)')
and ('$(DotNetBuildPass)' == '' or '$(DotNetBuildPass)' == '1')
and '$(DotNetBuildSourceOnly)' != 'true'">true</EnableDefaultRidSpecificArtifacts>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildOS)' == 'windows'">
<FlagParameterPrefix>-</FlagParameterPrefix>
<ArcadeFalseBoolBuildArg>0</ArcadeFalseBoolBuildArg>
</PropertyGroup>
<PropertyGroup Condition="'$(BuildOS)' != 'windows'">
<FlagParameterPrefix>--</FlagParameterPrefix>
<ArcadeFalseBoolBuildArg>false</ArcadeFalseBoolBuildArg>
</PropertyGroup>
<!-- Add 100 to the revision number for non-source-only builds to avoid clashing with the existing msft official builds.
Source-only builds don't update the revision as the assets don't get published to the same locations as the msft build and
still use the OfficialBuildId from repositories, not the pipeline. -->
<PropertyGroup Condition="'$(OfficialBuildId)' != '' and '$(DotNetBuildSourceOnly)' != 'true'">
<OfficialBuildId>$(OfficialBuildId.Split('.')[0]).$([MSBuild]::Add($(OfficialBuildId.Split('.')[1]), 100))</OfficialBuildId>
</PropertyGroup>
<PropertyGroup>
<!-- By default, use the eng/common/build.cmd/sh script -->
<BuildScript>$([MSBuild]::NormalizePath('$(ProjectDirectory)', 'eng', 'common', 'build$(ShellExtension)'))</BuildScript>
<BuildActions>$(FlagParameterPrefix)restore</BuildActions>
<BuildActions>$(BuildActions) $(FlagParameterPrefix)build</BuildActions>
<BuildActions>$(BuildActions) $(FlagParameterPrefix)pack</BuildActions>
<BuildActions>$(BuildActions) $(FlagParameterPrefix)publish</BuildActions>
<BuildActions Condition="'$(Sign)' == 'true'">$(BuildActions) $(FlagParameterPrefix)sign</BuildActions>
<TestActions>$(FlagParameterPrefix)test</TestActions>
</PropertyGroup>
<!-- Common args used for building and testing. -->
<PropertyGroup>
<!-- TODO: Remove the DotNetBuildSourceOnly condition when the default build behavior for source-only builds changes to dev.
https://github.com/dotnet/source-build/issues/4855 -->
<CommonArgs Condition="'$(ContinuousIntegrationBuild)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'">$(FlagParameterPrefix)ci</CommonArgs>
<!-- Pass down configuration properties -->
<CommonArgs>$(CommonArgs) $(FlagParameterPrefix)configuration $(Configuration)</CommonArgs>
<CommonArgs>$(CommonArgs) /p:TargetRid=$(TargetRid)</CommonArgs>
<!-- Pass through DotNetBuildPass for join point vertical support. -->
<CommonArgs Condition="'$(DotNetBuildPass)' != '' and '$(DotNetBuildPass)' != '1'">$(CommonArgs) /p:DotNetBuildPass=$(DotNetBuildPass)</CommonArgs>
<!-- Only pass these properites through when necessary to reduce command line noise. -->
<CommonArgs Condition="'$(CrossBuild)' == 'true'">$(CommonArgs) /p:CrossBuild=true</CommonArgs>
<CommonArgs Condition="'$(DotNetBuildUseMonoRuntime)' == 'true'">$(CommonArgs) /p:DotNetBuildUseMonoRuntime=$(DotNetBuildUseMonoRuntime)</CommonArgs>
<CommonArgs Condition="'$(OfficialBuildId)' != ''">$(CommonArgs) /p:OfficialBuildId=$(OfficialBuildId)</CommonArgs>
<CommonArgs Condition="'$(ForceDryRunSigning)' != ''">$(CommonArgs) /p:ForceDryRunSigning=$(ForceDryRunSigning)</CommonArgs>
<CommonArgs>$(CommonArgs) /p:GitHubRepositoryName=$(RepositoryName)</CommonArgs>
<!-- Pass locations for assets -->
<CommonArgs>$(CommonArgs) /p:SourceBuiltAssetsDir=$(ArtifactsAssetsDir)</CommonArgs>
<CommonArgs>$(CommonArgs) /p:SourceBuiltAssetManifestsDir=$(RepoAssetManifestsDir)</CommonArgs>
<!-- PGO assets by default are "Vertical" visibilty. Each repo will enable the specific artifacts it must publish externally -->
<DefaultArtifactVisibility Condition="'$(PgoInstrument)' == 'true'">Vertical</DefaultArtifactVisibility>
<!-- ShortStack builds only publish new assets from the root repository. All other assets are duplicates. -->
<DefaultArtifactVisibility Condition="'$(ShortStack)' == 'true' and '$(MSBuildProjectName)' != '$(RootRepo)'">Vertical</DefaultArtifactVisibility>
</PropertyGroup>
<!-- Build specific args -->
<PropertyGroup>
<BuildArgs>$(BuildArgs) -bl</BuildArgs>
<!-- Don't flow these control properties during testing to avoid the outer/inner complexity. -->
<BuildArgs>$(BuildArgs) /p:DotNetBuildRepo=true</BuildArgs>
<BuildArgs>$(BuildArgs) /p:DotNetBuildOrchestrator=true</BuildArgs>
<!-- Pass the repository URL in globally so that we redirect sourcelink package information to the VMR repo. -->
<DotNetRepositoryUrl>https://github.com/dotnet/dotnet</DotNetRepositoryUrl>
<BuildArgs>$(BuildArgs) /p:RepositoryUrl=$(DotNetRepositoryUrl)</BuildArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<BuildArgs>$(BuildArgs) /p:SourceBuiltSymbolsDir=$(IntermediateSymbolsRepoDir)</BuildArgs>
<BuildArgs>$(BuildArgs) /p:DotNetBuildSourceOnly=true</BuildArgs>
<BuildArgs>$(BuildArgs) /p:PreviouslySourceBuiltNupkgCacheDir="$(PreviouslySourceBuiltPackagesPath)"</BuildArgs>
<BuildArgs>$(BuildArgs) /p:ReferencePackageNupkgCacheDir="$(ReferencePackagesDir)"</BuildArgs>
</PropertyGroup>
<!-- Test specific args-->
<PropertyGroup>
<TestArgs>$(TestArgs) /bl:$(ArtifactsLogRepoDir)Test.binlog</TestArgs>
</PropertyGroup>
<PropertyGroup Condition="'$(EnableExtraDebugging)' == 'true'">
<MSBuildDebugPathTargetDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'msbuild-debug'))</MSBuildDebugPathTargetDir>
<RoslynDebugPathTargetDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'roslyn-debug'))</RoslynDebugPathTargetDir>
<AspNetRazorBuildServerLogDir>$([MSBuild]::NormalizeDirectory('$(ArtifactsDir)', 'aspnet-debug'))</AspNetRazorBuildServerLogDir>
<AspNetRazorBuildServerLogFile>$(AspNetRazorBuildServerLogDir)razor-build-server.log</AspNetRazorBuildServerLogFile>
</PropertyGroup>
<ItemGroup>
<!-- Arcade tools.sh picks up DotNetCoreSdkDir, but we can pass DOTNET_INSTALL_DIR directly. -->
<EnvironmentVariables Include="DOTNET_INSTALL_DIR=$(DotNetRoot)" />
<EnvironmentVariables Include="DOTNET_PATH=$(DotNetRoot)" />
<EnvironmentVariables Include="DOTNET_HOST_PATH=$(DotNetTool)" />
<EnvironmentVariables Include="_InitializeDotNetCli=$(DotNetRoot.TrimEnd('/\'))" />
<EnvironmentVariables Include="_DotNetInstallDir=$(DotNetRoot)" />
<EnvironmentVariables Include="_InitializeToolset=$(SourceBuiltSdksDir)Microsoft.DotNet.Arcade.Sdk/tools/Build.proj"
Condition="'$(UseBootstrapArcade)' != 'true'" />
<!-- We pass '-ci', but also apply ci mode via env var for edge cases. (E.g. misbehaving inner builds.).
TODO: Remove the DotNetBuildSourceOnly condition when the default build behavior for source-only builds changes to dev.
https://github.com/dotnet/source-build/issues/4855 -->
<EnvironmentVariables Condition="'$(ContinuousIntegrationBuild)' == 'true' or '$(DotNetBuildSourceOnly)' == 'true'" Include="ContinuousIntegrationBuild=true" />
<!-- Turn off node reuse for source build because repos use conflicting versions
of compilers which cause assembly load errors.
See https://github.com/dotnet/source-build/issues/541 -->
<EnvironmentVariables Include="MSBUILDDISABLENODEREUSE=1" />
<EnvironmentVariables Include="DeterministicSourcePaths=true" Condition="'$(DeterministicBuildOptOut)' != 'true'" />
<EnvironmentVariables Include="DeterministicSourcePaths=false" Condition="'$(DeterministicBuildOptOut)' == 'true'" />
<EnvironmentVariables Include="SourceRoot=$(ProjectDirectory)" />
<!-- Need to be passed in as an env var so that custom Exec tasks in the repo's DotNetBuild.props receive this setting. -->
<EnvironmentVariables Include="DotNetPackageVersionPropsPath=$(PackageVersionPropsPath)" />
<!-- Needed for miscellanous projects in various repos - see https://github.com/dotnet/source-build/issues/4081-->
<EnvironmentVariables Include="RestoreConfigFile=$(NuGetConfigFile)" Condition="'$(NuGetConfigFile)' != ''" />
<!-- Need to be passed in here so that outer and inner builds don't restore into the orchestrator package cache (CI builds)
or the user package cache (local dev builds). -->
<EnvironmentVariables Include="NUGET_PACKAGES=$(RepoArtifactsPackageCache)" />
</ItemGroup>
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
<EnvironmentVariables Include="NuGetAudit=false" />
</ItemGroup>
<ItemGroup Condition="'$(EnableExtraDebugging)' == 'true'">
<!-- If MSBuild exits early, make sure debug output like 'MSBuild_*.failure.txt' ends up in a place we can see it. -->
<EnvironmentVariables Include="MSBUILDDEBUGPATH=$(MSBuildDebugPathTargetDir)" />
<EnvironmentVariables Include="MSBUILDDEBUGCOMM=1" />
<EnvironmentVariables Include="MSBUILDDEBUGSCHEDULER=1" />
<EnvironmentVariables Include="MSBUILDDEBUGFORCECACHING=1" />
<EnvironmentVariables Include="MSBUILDDEBUG=1" />
<EnvironmentVariables Include="MSBUILDDEBUGEVALUATION=1" />
<EnvironmentVariables Include="MSBUILDTARGETOUTPUTLOGGING=1" />
<EnvironmentVariables Include="MSBUILDLOGTASKINPUTS=1" />
<EnvironmentVariables Include="MSBUILDEMITSOLUTION=1" />
<EnvironmentVariables Include="MSBUILDLOGVERBOSERARSEARCHRESULTS=1" />
<!-- Output Roslyn logs to allow debugging compiler errors -->
<EnvironmentVariables Include="RoslynCommandLineLogFile=$(RoslynDebugPathTargetDir)" />
<!--ASP.NET dev server request logs -->
<EnvironmentVariables Include="RAZORBUILDSERVER_LOG=$(AspNetRazorBuildServerLogFile)" />
</ItemGroup>
<!-- If we're using the bootstrapped arcade, we can set the override here. -->
<ItemGroup>
<!-- Configure the bootstrapped Arcade version here. Repositories that build before arcade (and arcade itself) will use the bootstrapped SDK. -->
<BootstrapArcadeSdkOverride Include="Microsoft.DotNet.Arcade.Sdk"
Group="ARCADE"
Version="$(ArcadeBootstrapVersion)"
Location="$(BootstrapPackagesDir)microsoft.dotnet.arcade.sdk/$(ArcadeBootstrapVersion)" />
<!-- Make the WindowsDesktop SDK override opt-in for repos that need it. -->
<WindowsDesktopSdkOverride Include="Microsoft.Net.Sdk.WindowsDesktop" Group="WINDOWS_DESKTOP" Location="$(ToolsDir)EmptySdk" Condition="'$(DotNetBuildSourceOnly)' == 'true'" />
</ItemGroup>
<!-- Additional pseudo-versions that **multiple** repos depend on. -->
<ItemGroup>
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimewinx64Version" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimewinx64PackageVersion" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="MicrosoftNETCoreAppRuntimeVersion" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
<ExtraPackageVersionPropsPackageInfo Include="VSRedistCommonNetCoreSharedFrameworkx64100PackageVersion" Version="%24(MicrosoftNETCoreAppRefPackageVersion)" />
</ItemGroup>
</Project>