Skip to content

Commit e935504

Browse files
authored
Build NuGet from the VMR (#5749)
1 parent bb3993b commit e935504

24 files changed

Lines changed: 245 additions & 189 deletions

Directory.Build.targets

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<Project>
22
<Import Project="build\common.targets" Condition="'$(IsCrossTargetingBuild)' == 'true' And '$(_WasCommonPropsImported)' != 'true'" />
3-
<Import Project="eng\source-build\ExcludeFromSourceBuild.AfterCommonTargets.targets" Condition="'$(DotNetBuildFromSource)' == 'true'" />
3+
<Import Project="eng\dotnet-build\ExcludeFromDotNetBuild.AfterCommonTargets.targets" Condition="'$(DotNetBuildRepo)' == 'true'" />
44
</Project>

Directory.Packages.props

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138

139139
<ItemGroup>
140140
<GlobalPackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" Condition="'$(Shipping)' == 'true' AND '$(IsXPlat)' != 'true'" />
141-
<GlobalPackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" version="1.0.0" Condition=" '$(DotNetBuildFromSource)' != 'true' " />
141+
<GlobalPackageReference Include="Microsoft.VisualStudioEng.MicroBuild.Core" version="1.0.0" Condition=" '$(DotNetBuildSourceOnly)' != 'true' " />
142142
</ItemGroup>
143143

144144
<ItemGroup Condition=" '$(UsePublicApiAnalyzer)' == 'true' ">
@@ -160,14 +160,14 @@
160160
</ItemGroup>
161161

162162
<!-- FxCop Analyzers -->
163-
<ItemGroup Condition="'$(Shipping)' == 'true' AND '$(SkipAnalyzers)' != 'true' AND '$(DotNetBuildFromSource)' != 'true'">
163+
<ItemGroup Condition="'$(Shipping)' == 'true' AND '$(SkipAnalyzers)' != 'true' AND '$(DotNetBuildSourceOnly)' != 'true'">
164164
<GlobalPackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.9.8" />
165165
<GlobalPackageReference Include="Microsoft.CodeAnalysis.BannedApiAnalyzers" Version="3.3.3" />
166166
<AdditionalFiles Include="$(MSBuildThisFileDirectory)build\BannedSymbols.txt" Condition="'$(TestProject)' != 'true'" />
167167
</ItemGroup>
168168

169-
<!-- DotNetBuildFromSource can only use packages that are open source -->
170-
<Target Name="CheckSourceBuildPackageReferences" AfterTargets="CollectPackageReferences" Condition=" '$(DotNetBuildFromSource)' == 'true' ">
169+
<!-- DotNetBuildSourceOnly can only use packages that are open source -->
170+
<Target Name="CheckSourceBuildPackageReferences" AfterTargets="CollectPackageReferences" Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">
171171
<ItemGroup>
172172
<_allowBuildFromSourcePackage Remove="@(_allowBuildFromSourcePackage)" />
173173
<_sourceBuildUnexpectedPackage Remove="@(_sourceBuildUnexpectedPackage)" />
@@ -198,7 +198,7 @@
198198

199199
<_sourceBuildUnexpectedPackage Include="@(PackageReference)" Exclude="@(_allowBuildFromSourcePackage)" />
200200
</ItemGroup>
201-
<Error Text="Found @(_sourceBuildUnexpectedPackage-&gt;Count()) PackageReferences not on DotNetBuildFromSource allow list: '@(_sourceBuildUnexpectedPackage)'" Condition=" '@(_sourceBuildUnexpectedPackage)' != '' " />
201+
<Error Text="Found @(_sourceBuildUnexpectedPackage-&gt;Count()) PackageReferences not on DotNetBuildSourceOnly allow list: '@(_sourceBuildUnexpectedPackage)'" Condition=" '@(_sourceBuildUnexpectedPackage)' != '' " />
202202
</Target>
203203

204204
</Project>

NuGet.sln

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -302,16 +302,11 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "steps", "steps", "{00112503
302302
eng\common\templates\steps\generate-sbom.yml = eng\common\templates\steps\generate-sbom.yml
303303
EndProjectSection
304304
EndProject
305-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source-build", "source-build", "{85D69893-216B-4D97-9E90-39340CA24CA4}"
305+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dotnet-build", "dotnet-build", "{85D69893-216B-4D97-9E90-39340CA24CA4}"
306306
ProjectSection(SolutionItems) = preProject
307-
eng\source-build\build.sh = eng\source-build\build.sh
308-
eng\source-build\global.json = eng\source-build\global.json
309-
eng\source-build\source-build.proj = eng\source-build\source-build.proj
310-
EndProjectSection
311-
EndProject
312-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "source-build-patches", "source-build-patches", "{24038CC5-9A57-472D-825D-9C48F8E4009A}"
313-
ProjectSection(SolutionItems) = preProject
314-
eng\source-build-patches\0001-Rename-NuGet.Config-to-NuGet.config-to-account-for-a.patch = eng\source-build-patches\0001-Rename-NuGet.Config-to-NuGet.config-to-account-for-a.patch
307+
eng\dotnet-build\build.sh = eng\dotnet-build\build.sh
308+
eng\dotnet-build\global.json = eng\dotnet-build\global.json
309+
eng\dotnet-build\dotnet-build.proj = eng\dotnet-build\dotnet-build.proj
315310
EndProjectSection
316311
EndProject
317312
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{EA5A2D72-33C8-442C-AB6D-99EA8739591D}"
@@ -828,7 +823,6 @@ Global
828823
{AC389B99-E1E9-42AE-97AE-9874D0EFAD25} = {4497DE20-D8E5-4DCA-86F8-1993180E0EC2}
829824
{00112503-3502-4331-B6C3-FD3F2D262242} = {AC389B99-E1E9-42AE-97AE-9874D0EFAD25}
830825
{85D69893-216B-4D97-9E90-39340CA24CA4} = {70336E30-C737-4175-BC69-9015D49E496E}
831-
{24038CC5-9A57-472D-825D-9C48F8E4009A} = {70336E30-C737-4175-BC69-9015D49E496E}
832826
{4B35F4D8-A967-40ED-AFA0-CD3AE3DAD77E} = {EA5A2D72-33C8-442C-AB6D-99EA8739591D}
833827
{56D1B750-1FEB-4DAC-8486-6CE5C5655132} = {CE4C7E1B-6883-49C3-A407-F807094777CC}
834828
{A0A6BD09-1AF4-4F16-8118-F0FC17FF8413} = {CE4C7E1B-6883-49C3-A407-F807094777CC}

build/common.project.props

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,31 +12,31 @@
1212
<NETFXTargetFramework>net472</NETFXTargetFramework>
1313
<NetStandardVersion>netstandard2.0</NetStandardVersion>
1414
<NETCoreTargetFramework>net8.0</NETCoreTargetFramework>
15-
<NETCoreTargetFramework Condition="'$(DotNetBuildFromSource)' == 'true'">net9.0</NETCoreTargetFramework>
15+
<NETCoreTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true'">net9.0</NETCoreTargetFramework>
1616
<NETCoreLegacyTargetFramework>netcoreapp3.1</NETCoreLegacyTargetFramework>
17-
<NETCoreLegacyTargetFramework Condition="'$(DotNetBuildFromSource)' == 'true'">net9.0</NETCoreLegacyTargetFramework>
17+
<NETCoreLegacyTargetFramework Condition="'$(DotNetBuildSourceOnly)' == 'true'">net9.0</NETCoreLegacyTargetFramework>
1818
<NETCoreLegacyTargetFrameworkForSigning>netcoreapp5.0</NETCoreLegacyTargetFrameworkForSigning>
1919

2020
<!-- Target frameworks for class libraries-->
2121
<TargetFrameworksLibrary>$(NetStandardVersion)</TargetFrameworksLibrary>
22-
<TargetFrameworksLibrary Condition="'$(DotNetBuildFromSource)' == 'true'">$(NETCoreTargetFramework);$(TargetFrameworksLibrary)</TargetFrameworksLibrary>
23-
<TargetFrameworksLibrary Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildFromSource)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksLibrary)</TargetFrameworksLibrary>
22+
<TargetFrameworksLibrary Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NETCoreTargetFramework);$(TargetFrameworksLibrary)</TargetFrameworksLibrary>
23+
<TargetFrameworksLibrary Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksLibrary)</TargetFrameworksLibrary>
2424

2525
<!-- Target frameworks for class libraries which require signing APIs which need to target NET 5.0 -->
2626
<TargetFrameworksLibraryForSigning>$(TargetFrameworksLibrary)</TargetFrameworksLibraryForSigning>
27-
<TargetFrameworksLibraryForSigning Condition="'$(DotNetBuildFromSource)' != 'true'">$(TargetFrameworksLibraryForSigning);$(NETCoreLegacyTargetFrameworkForSigning)</TargetFrameworksLibraryForSigning>
27+
<TargetFrameworksLibraryForSigning Condition="'$(DotNetBuildSourceOnly)' != 'true'">$(TargetFrameworksLibraryForSigning);$(NETCoreLegacyTargetFrameworkForSigning)</TargetFrameworksLibraryForSigning>
2828

2929
<!-- Target framework for runnable apps -->
3030
<TargetFrameworksExe>$(NETCoreTargetFramework)</TargetFrameworksExe>
31-
<TargetFrameworksExe Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildFromSource)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksExe)</TargetFrameworksExe>
31+
<TargetFrameworksExe Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksExe)</TargetFrameworksExe>
3232

3333
<!-- Target frameworks for unit tests -->
3434
<TargetFrameworksUnitTest>$(NETCoreTargetFramework)</TargetFrameworksUnitTest>
35-
<TargetFrameworksUnitTest Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildFromSource)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksUnitTest)</TargetFrameworksUnitTest>
35+
<TargetFrameworksUnitTest Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksUnitTest)</TargetFrameworksUnitTest>
3636

3737
<!-- Target frameworks for unit tests that test libaries using signing APIs -->
3838
<TargetFrameworksUnitTestForSigning>$(NETCoreTargetFramework)</TargetFrameworksUnitTestForSigning>
39-
<TargetFrameworksUnitTestForSigning Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildFromSource)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksUnitTestForSigning);$(NETCoreLegacyTargetFramework)</TargetFrameworksUnitTestForSigning>
39+
<TargetFrameworksUnitTestForSigning Condition="'$(IsXPlat)' != 'true' And '$(DotNetBuildSourceOnly)' != 'true'">$(NETFXTargetFramework);$(TargetFrameworksUnitTestForSigning);$(NETCoreLegacyTargetFramework)</TargetFrameworksUnitTestForSigning>
4040
</PropertyGroup>
4141

4242
<!-- Common -->
@@ -59,7 +59,7 @@
5959
<LocalizationWorkDirectory>$(RepositoryRootDirectory)localize</LocalizationWorkDirectory>
6060
<NoWarn>$(NoWarn);NU5105;MSB3277;NETSDK1138</NoWarn>
6161
<!-- additional warnings new in .NET 6 that we need to disable when building with source-build -->
62-
<NoWarn Condition="'$(DotNetBuildFromSource)' == 'true'">$(NoWarn);CS1998;CA1416;CS0618;CS1574</NoWarn>
62+
<NoWarn Condition="'$(DotNetBuildSourceOnly)' == 'true'">$(NoWarn);CS1998;CA1416;CS0618;CS1574</NoWarn>
6363
<SuppressTfmSupportBuildWarnings>true</SuppressTfmSupportBuildWarnings>
6464
</PropertyGroup>
6565

@@ -96,7 +96,7 @@
9696
<!-- Same as SDK default, but without CandidateAssemblyFiles in front, which would search in Content items -->
9797
<AssemblySearchPaths>{HintPathFromItem};{TargetFrameworkDirectory};{RawFileName}</AssemblySearchPaths>
9898
<LangVersion>12</LangVersion>
99-
<LangVersion Condition="'$(DotNetBuildFromSource)' == 'true'">latest</LangVersion>
99+
<LangVersion Condition="'$(DotNetBuildSourceOnly)' == 'true'">latest</LangVersion>
100100
</PropertyGroup>
101101

102102
<!-- NuGet's dev branch always targets the next upcoming version of .NET, so we always use the preview SDK -->

build/common.targets

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@
5656
</ItemGroup>
5757

5858
<!-- Don't use PublicApiAnalyzer on source-build .NET -->
59-
<PropertyGroup Condition=" '$(DotNetBuildFromSource)' == 'true' ">
59+
<PropertyGroup Condition=" '$(DotNetBuildSourceOnly)' == 'true' ">
6060
<UsePublicApiAnalyzer>false</UsePublicApiAnalyzer>
6161
</PropertyGroup>
6262

6363
<!-- Projects we pack become public APIs that others can use -->
64-
<PropertyGroup Condition=" '$(DotNetBuildFromSource)' != 'true' and '$(PackProject)' == 'true' ">
64+
<PropertyGroup Condition=" '$(DotNetBuildSourceOnly)' != 'true' and '$(PackProject)' == 'true' ">
6565
<UsePublicApiAnalyzer Condition=" '$(UsePublicApiAnalyzer)' == '' " >true</UsePublicApiAnalyzer>
6666
</PropertyGroup>
6767

docs/updating-target-frameworks.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Updating the target frameworks in our repository can be challenging.
44
Our repository builds code for Visual Studio, .NET SDK, NuGet.exe in addition to [shipping packages to NuGet.org](https://www.nuget.org/profiles/nuget).
55

66
Given that so many of our projects have different frameworks, these frameworks are defined in [common.projects.props](../build/common.project.props).
7-
Note that `DotnetBuildFromSource` tends to build against different frameworks than the ones our repo builds against.
7+
Note that `DotNetBuildSourceOnly` tends to build against different frameworks than the ones our repo builds against.
88

99
To make it easier to determine the correct changes were made, you can use utility targets such as `GetAllTargetFrameworks` in [build.proj](../build/build.proj).
1010
It is important to pay attention to that changing frameworks.
@@ -14,6 +14,6 @@ The recommended way to invoke these helper commands is by running the following
1414
1515
or
1616

17-
> msbuild .\build\build.proj /t:GetAllTargetFrameworks /v:m /restore:false /p:DotnetBuildFromSource="true"
17+
> msbuild .\build\build.proj /t:GetAllTargetFrameworks /v:m /restore:false /p:DotNetBuildSourceOnly="true"
1818
1919
This would generate an output that you can diff for before/after list of the frameworks.

eng/SourceBuildPrebuiltBaseline.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
<!--
2626
Packages owned by .NET - exclusion of all versions.
2727
-->
28+
<UsagePattern IdentityGlob="Microsoft.AspNetCore.App.Ref/*" />
2829
<UsagePattern IdentityGlob="Microsoft.Bcl.AsyncInterfaces/*" />
2930
<UsagePattern IdentityGlob="Microsoft.Build.Framework/*" />
3031
<UsagePattern IdentityGlob="Microsoft.Build.Tasks.Core/*" />
@@ -33,12 +34,15 @@
3334
<UsagePattern IdentityGlob="Microsoft.Build/*" />
3435
<UsagePattern IdentityGlob="Microsoft.CSharp/*" />
3536
<UsagePattern IdentityGlob="Microsoft.DotNet.Arcade.Sdk/*" />
37+
<UsagePattern IdentityGlob="Microsoft.DotNet.Build.Tasks.Feed/*" />
3638
<UsagePattern IdentityGlob="Microsoft.DotNet.SourceBuild.Tasks/*" />
3739
<UsagePattern IdentityGlob="Microsoft.Extensions.CommandLineUtils.Sources/*" />
3840
<UsagePattern IdentityGlob="Microsoft.Extensions.FileProviders.Abstractions/*" />
3941
<UsagePattern IdentityGlob="Microsoft.Extensions.FileSystemGlobbing/*" />
4042
<UsagePattern IdentityGlob="Microsoft.Extensions.Primitives/*" />
4143
<UsagePattern IdentityGlob="Microsoft.NET.StringTools/*" />
44+
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Ref/*" />
45+
<UsagePattern IdentityGlob="Microsoft.NETCore.App.Host*/*" />
4246
<UsagePattern IdentityGlob="Microsoft.NETCore.Platforms/*" />
4347
<UsagePattern IdentityGlob="Microsoft.NETCore.Targets/*" />
4448
<UsagePattern IdentityGlob="Microsoft.SourceLink.AzureRepos.Git/*2" />

eng/Version.Details.xml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,4 +47,11 @@
4747
<Sha>55fb7ef977e7d120dc12f0960edcff0739d7ee0e</Sha>
4848
</Dependency>
4949
</ProductDependencies>
50+
<ToolsetDependencies>
51+
<Dependency Name="Microsoft.SourceBuild.Intermediate.arcade" Version="9.0.0-beta.24203.1">
52+
<Uri>https://github.com/dotnet/arcade</Uri>
53+
<Sha>986a55a9c7f1ef547bc705d6adada5e0c2217819</Sha>
54+
<SourceBuild RepoName="arcade" ManagedOnly="true" />
55+
</Dependency>
56+
</ToolsetDependencies>
5057
</Dependencies>

eng/source-build/ExcludeFromSourceBuild.AfterCommonTargets.targets renamed to eng/dotnet-build/ExcludeFromDotNetBuild.AfterCommonTargets.targets

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,11 @@
66
-->
77
<PropertyGroup>
88
<_SuppressAllTargets>false</_SuppressAllTargets>
9-
<_SuppressAllTargets Condition="'$(DotNetBuildFromSource)' == 'true' and '$(ExcludeFromSourceBuild)' == 'true'">true</_SuppressAllTargets>
9+
<_SuppressAllTargets Condition="'$(DotNetBuildSourceOnly)' == 'true' and '$(ExcludeFromSourceOnlyBuild)' == 'true'">true</_SuppressAllTargets>
10+
<_SuppressAllTargets Condition="'$(DotNetBuild)' == 'true' and '$(ExcludeFromDotNetBuild)' == 'true'">true</_SuppressAllTargets>
11+
<!-- General exclusion -->
12+
<_SuppressAllTargets Condition="'$(ExcludeFromBuild)' == 'true'">true</_SuppressAllTargets>
13+
1014
<!-- If excluding, then disable a restore warning, which will fire on newer SDKs, as well as set the NuGetRestoreTargets property to empty,
1115
which will avoid importing the restore targets inside the .NET SDK. If the restore targets exist, then static graph restore will attempt tpo
1216
execute. -->

0 commit comments

Comments
 (0)