Skip to content

Commit aefa4ca

Browse files
authored
Enable unified build (#54084)
* Unified build support
1 parent 55e125c commit aefa4ca

File tree

55 files changed

+94
-91
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+94
-91
lines changed

Directory.Build.BeforeCommonTargets.targets

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22
<PropertyGroup>
33
<!-- Only build Microsoft.AspNetCore.App, Microsoft.AspNetCore.App.Ref, ref/ assemblies, and ProjectTemplates in source build. -->
44
<!-- Analyzer package are needed in source build for WebSDK -->
5-
<ExcludeFromSourceBuild
6-
Condition="'$(ExcludeFromSourceBuild)' == '' and
7-
'$(DotNetBuildFromSource)' == 'true' and
5+
<ExcludeFromSourceOnlyBuild
6+
Condition="'$(ExcludeFromSourceOnlyBuild)' == '' and
7+
'$(DotNetBuildSourceOnly)' == 'true' and
88
'$(IsAspNetCoreApp)' != 'true' and
99
'$(MSBuildProjectName)' != '$(TargetingPackName)' and
1010
'$(IsAnalyzersProject)' != 'true' and
11-
'$(IsProjectTemplateProject)' != 'true'">true</ExcludeFromSourceBuild>
11+
'$(IsProjectTemplateProject)' != 'true'">true</ExcludeFromSourceOnlyBuild>
1212

1313
<!-- If the user has specified that they want to skip building any test related projects with SkipTestBuild,
1414
suppress all targets for TestProjects using ExcludeFromBuild. -->
1515
<ExcludeFromBuild Condition="'$(IsPackable)' != 'true' and
16-
'$(SkipTestBuild)' == 'true' and
16+
('$(SkipTestBuild)' == 'true' or ('$(DotNetBuild)' == 'true' and '$(DotNetBuildTests)' != 'true')) and
1717
($(IsTestProject) or
1818
'$(IsPublishedAppTestProject)' == 'true' or
1919
'$(IsTestAssetProject)' == 'true' or

Directory.Build.props

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@
192192
<!-- The location of the local installation of the .NET Core shared framework. -->
193193
<PropertyGroup>
194194
<LocalDotNetRoot>$(RepoRoot).dotnet\</LocalDotNetRoot>
195+
<LocalDotNetRoot Condition="'$(DotNetBuild)' == 'true'">DontDareMutateThisSDK</LocalDotNetRoot>
196+
195197
<!--
196198
Override the SDK default and point to local .dotnet folder. This is done to work around
197199
limitations in the way the .NET SDK finds shared frameworks and targeting packs. It allows
@@ -203,7 +205,12 @@
203205
to restore the AppHost pack as a prebuilt rather than using the one that's present in the SDK.
204206
Source-build doesn't run tests, so the property is simply conditioned out.
205207
-->
206-
<NetCoreTargetingPackRoot Condition="'$(DotNetBuildFromSource)' != 'true'">$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
208+
<NetCoreTargetingPackRoot Condition="'$(DotNetBuild)' != 'true'">$(LocalDotNetRoot)packs\</NetCoreTargetingPackRoot>
209+
<!-- This is not correct and needs attention eventually. This is primarily used to find the nethost headers in the apphost pack.
210+
These should be coming from a restored apphost pack, rather than a hard-coded local SDK. In fact, aspnetcore
211+
should not rely on a local SDK or mutating one to build. -->
212+
<NetCoreTargetingPackRoot Condition="'$(DotNetBuild)' == 'true'">$(DotNetRoot)packs\</NetCoreTargetingPackRoot>
213+
207214
</PropertyGroup>
208215

209216
<Import Project="eng\tools\RepoTasks\RepoTasks.tasks" Condition="'$(MSBuildProjectName)' != 'RepoTasks' AND '$(DesignTimeBuild)' != 'true'" />

Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@
157157
</PropertyGroup>
158158

159159
<!-- Properties for Package Validation -->
160-
<PropertyGroup Condition="'$(ExcludeFromSourceBuild)' != 'true'">
160+
<PropertyGroup Condition="'$(ExcludeFromSourceOnlyBuild)' != 'true'">
161161
<EnablePackageValidation Condition="'$(EnablePackageValidation)' == ''">true</EnablePackageValidation>
162162
<DisablePackageBaselineValidation Condition="'$(IsServicingBuild)' != 'true'">true</DisablePackageBaselineValidation>
163163
<GenerateCompatibilitySuppressionFile>true</GenerateCompatibilitySuppressionFile>

eng/Dependencies.props

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ and are generated based on the last package release.
137137
<LatestPackageReference Include="@(_LatestRuntimePackageReference->Distinct())" />
138138
</ItemGroup>
139139

140-
<ItemGroup Label=".NET team dependencies (Non-source-build)" Condition="'$(DotNetBuildFromSource)' != 'true'">
140+
<ItemGroup Label=".NET team dependencies (Non-source-build)" Condition="'$(DotNetBuildSourceOnly)' != 'true'">
141141
<LatestPackageReference Include="Microsoft.AspNet.WebApi.Client" />
142142
<LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.2.1" />
143143
<LatestPackageReference Include="Microsoft.AspNetCore.AzureAppServices.SiteExtension.3.1.x64" />
@@ -191,7 +191,7 @@ and are generated based on the last package release.
191191
<LatestPackageReference Include="Newtonsoft.Json" />
192192
</ItemGroup>
193193

194-
<ItemGroup Label="External dependencies" Condition="'$(DotNetBuildFromSource)' != 'true'">
194+
<ItemGroup Label="External dependencies" Condition="'$(DotNetBuildSourceOnly)' != 'true'">
195195
<LatestPackageReference Include="AngleSharp" />
196196
<LatestPackageReference Include="Azure.Identity" />
197197
<LatestPackageReference Include="BenchmarkDotNet" />

eng/SourceBuild.props renamed to eng/DotNetBuild.props

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -8,32 +8,24 @@
88
<SourceBuildTargetFrameworkFilter>netstandard2.0%3bnetstandard2.1%3bnetcoreapp2.1%3bnetcoreapp3.1%3bnet5.0%3bnet6.0%3bnet7.0%3bnet8.0%3bnet9.0</SourceBuildTargetFrameworkFilter>
99
</PropertyGroup>
1010

11-
<!-- Only run this target in source-build only mode. -->
12-
<Target Name="PrepareGlobalJsonForSourceBuild"
13-
AfterTargets="PrepareInnerSourceBuildRepoRoot"
14-
BeforeTargets="RunInnerSourceBuildCommand"
15-
Condition="'$(ArcadeBuildFromSource)' == 'true'">
16-
<Exec
17-
Command="./eng/scripts/prepare-sourcebuild-globaljson.sh"
18-
WorkingDirectory="$(InnerSourceBuildRepoRoot)" />
19-
</Target>
20-
2111
<!--
2212
Remove inner source .globalconfig file as both the inner and outer config files get loaded and cause a conflict.
2313
Leaving the inner will cause all conflicting settings to be ignored.
24-
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files#general-options
14+
https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files#general-options.
15+
This only needs to be done if there is an inner clone.
2516
-->
2617
<Target Name="RemoveInnerGlobalConfig"
2718
DependsOnTargets="PrepareInnerSourceBuildRepoRoot"
28-
BeforeTargets="RunInnerSourceBuildCommand">
19+
BeforeTargets="RunInnerSourceBuildCommand"
20+
Condition="'$(DotNetBuildOrchestrator)' != 'true'">
2921

3022
<Delete Files="$(InnerSourceBuildRepoRoot).globalconfig" />
3123
</Target>
3224

3325
<!-- Build RepoTasks - this is normally triggered via the build script but the inner ArPow source-build is run via msbuild.
3426
https://github.com/dotnet/source-build/issues/3807 -->
3527
<Target Name="BuildRepoTasks"
36-
Condition="'$(ArcadeInnerBuildFromSource)' == 'true'"
28+
Condition="'$(DotNetBuildInnerRepo)' == 'true' and '$(DotNetBuildSourceOnly)' == 'true'"
3729
BeforeTargets="Execute">
3830
<!-- If the alternative runtime location and key are present, pass those through -->
3931
<PropertyGroup>
@@ -46,8 +38,6 @@
4638
<ItemGroup>
4739
<!-- We need to flow FullAssemblySigningSupported even when building repo tasks because they use full signing -->
4840
<InnerBuildEnv Condition="'$(FullAssemblySigningSupported)' != ''" Include="FullAssemblySigningSupported=$(FullAssemblySigningSupported)" />
49-
<InnerBuildEnv Include="DotNetBuildFromSource=$(ArcadeBuildFromSource)" />
50-
<InnerBuildEnv Include="DotNetBuildVertical=$(ArcadeBuildVertical)" />
5141
<InnerBuildEnv Include="DotNetBuildSourceOnly=$(DotNetBuildSourceOnly)" />
5242
</ItemGroup>
5343

@@ -90,11 +80,15 @@
9080
-->
9181
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore-runtime-*.tar.gz" />
9282
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore_base_runtime.version" />
83+
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore-runtime-*.msi" />
84+
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore-runtime-*.pkg" />
85+
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore-runtime-*.deb" />
86+
<IntermediateNupkgArtifactFile Include="$(InstallersArtifactsDir)aspnetcore-runtime-*.rpm" />
9387
</ItemGroup>
9488
</Target>
9589

9690
<Target Name="RestoreNpmPackages"
97-
Condition="'$(BuildNodeJS)' == 'true'"
91+
Condition="'$(BuildNodeJS)' == 'true' and '$(DotNetBuildSourceOnly)' == 'true'"
9892
BeforeTargets="RunInnerSourceBuildCommand">
9993

10094
<Message Text="Checking node version..." Importance="high" />
@@ -120,7 +114,7 @@
120114
</Target>
121115

122116
<Target Name="BuildNpmFiles"
123-
Condition="'$(BuildNodeJS)' == 'true'"
117+
Condition="'$(BuildNodeJS)' == 'true' and '$(DotNetBuildSourceOnly)' == 'true'"
124118
DependsOnTargets="RestoreNpmPackages"
125119
BeforeTargets="RunInnerSourceBuildCommand">
126120

eng/Npm.Workspace.nodeproj

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@
55

66
<PropertyGroup>
77
<IsShippingPackage>true</IsShippingPackage>
8-
<ExcludeFromSourceBuild>false</ExcludeFromSourceBuild>
8+
<!-- This explicitly includes this project even though it's a test project, unit test project,
9+
etc. which would be excluded by default. -->
10+
<ExcludeFromDotNetBuild>false</ExcludeFromDotNetBuild>
911
<IsTestProject>true</IsTestProject>
1012
<IsUnitTestProject>true</IsUnitTestProject>
1113
<TestDependsOnAspNetPackages>false</TestDependsOnAspNetPackages>

eng/Publishing.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
<!-- Do not push .nupkg files from Linux and macOS builds. They'll be packed up separately and signed on Windows.
6363
Do not remove if post build sign is true, as we avoid the xplat codesign jobs, and need to have
6464
the nupkgs pushed. Do not do this if building from source, since we want the source build intermediate package
65-
to be published. Use ArcadeBuildFromSource as DotNetBuildFromSource is only set in the internal source build,
65+
to be published. Use DotNetBuildRepo is only set in the internal source build,
6666
and Build.proj is invoked from the wrapper build. -->
6767
<ItemsToPushToBlobFeed Remove="@(ItemsToPushToBlobFeed)" Condition="'$(OS)' != 'Windows_NT' and '$(PostBuildSign)' != 'true' and '$(DotNetBuildRepo)' != 'true'" />
6868

eng/configure-toolset.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# We could potentially try to find an existing installation that has all the required runtimes,
33
# but it's unlikely one will be available.
44

5-
if [ "${DotNetBuildFromSource:-false}" = false ]; then
5+
if [ "${DotNetBuild:-false}" = false ]; then
66
use_installed_dotnet_cli="false"
77
fi
88

eng/targets/CSharp.Common.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
<Using Include="Xunit" Condition=" $(IsTestProject) " />
6161
</ItemGroup>
6262

63-
<ItemGroup Condition=" '$(DotNetBuildFromSource)' != 'true' AND $(AddPublicApiAnalyzers) ">
63+
<ItemGroup Condition=" '$(DotNetBuildSourceOnly)' != 'true' AND $(AddPublicApiAnalyzers) ">
6464
<Reference Include="Microsoft.CodeAnalysis.PublicApiAnalyzers" ExcludeAssets="Compile" PrivateAssets="All" />
6565
</ItemGroup>
6666
<Target Name="_CheckIgnoredPublicApiFiles"

eng/targets/FunctionalTestWithAssets.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<Target Name="PublishTestAssets"
1212
BeforeTargets="Build;Publish;RunTests;VSTest"
1313
Condition=" '$(ExcludeFromBuild)' != 'true' AND
14-
'$(DotNetBuildFromSource)' != 'true' AND
14+
('$(DotNetBuild)' != 'true' or '$(DotNetBuildTests)' == 'true') AND
1515
'@(TestAssetProjectReference->Count())' != '0' ">
1616
<ItemGroup>
1717
<_ProjectsToPublish Include="@(TestAssetProjectReference)" />

0 commit comments

Comments
 (0)