Skip to content

Commit 15fe66b

Browse files
committed
Eliminate usages of pre-built packages during source-build
* Don't build MSBuild tasks for netfx during source-build * Don't build Microsoft.Windows.Compatibility during source-build * Don't build test projects during source-build * Don't restore Microsoft.DiaSymReader.Native * Don't build source generators that target older Roslyn versions * Don't build ILStripTask since it uses a Mono.Cecil "sources" NuGet package that isn't part of source-build
1 parent bcd4187 commit 15fe66b

8 files changed

Lines changed: 21 additions & 4 deletions

File tree

Directory.Build.props

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@
6262

6363
<NetFrameworkMinimum>net462</NetFrameworkMinimum>
6464
<NetFrameworkToolCurrent>net472</NetFrameworkToolCurrent>
65+
<!-- Don't build for NETFramework during source-build. -->
66+
<NetFrameworkToolCurrent Condition="'$(DotNetBuildFromSource)' == 'true'" />
6567
</PropertyGroup>
6668

6769
<PropertyGroup>

eng/Subsets.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<DefaultHostSubsets Condition="'$(RuntimeFlavor)' != '$(PrimaryRuntimeFlavor)' and '$(TargetsMobile)' != 'true'">host.native</DefaultHostSubsets>
7373

7474
<DefaultPacksSubsets>packs.product</DefaultPacksSubsets>
75-
<DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets>
75+
<DefaultPacksSubsets Condition="'$(BuildMonoAOTCrossCompilerOnly)' != 'true' and '$(DotNetBuildFromSource)' != 'true'">$(DefaultPacksSubsets)+packs.tests</DefaultPacksSubsets>
7676
<DefaultPacksSubsets Condition="'$(DotNetBuildFromSource)' == 'true'">$(DefaultPacksSubsets)+packs.installers</DefaultPacksSubsets>
7777
</PropertyGroup>
7878

src/installer/pkg/sfx/Microsoft.NETCore.App/Directory.Build.props

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@
237237
<ExcludeFromClosure Include="@(NetFxReference)" />
238238
</ItemGroup>
239239

240-
<ItemGroup>
240+
<ItemGroup Condition="'$(DotNetBuildFromSource)' != 'true'">
241241
<!-- Add a reference to Microsoft.DiaSymReader.Native if one does not already exist. -->
242242
<PackageReference Include="Microsoft.DiaSymReader.Native"
243243
Exclude="@(PackageReference)"

src/libraries/Microsoft.Extensions.Logging.Abstractions/src/Microsoft.Extensions.Logging.Abstractions.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ Microsoft.Extensions.Logging.Abstractions.NullLogger</PackageDescription>
3636
</ItemGroup>
3737

3838
<ItemGroup>
39-
<AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj" />
39+
<AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn3.11.csproj"
40+
Condition="'$(DotNetBuildFromSource)' != 'true'" />
4041
<AnalyzerReference Include="..\gen\Microsoft.Extensions.Logging.Generators.Roslyn4.0.csproj" />
4142
</ItemGroup>
4243

src/libraries/System.Text.Json/src/System.Text.Json.csproj

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,8 @@ System.Text.Json.Utf8JsonReader</PackageDescription>
350350
<ProjectReference Include="$(LibrariesProjectRoot)Microsoft.Bcl.AsyncInterfaces\src\Microsoft.Bcl.AsyncInterfaces.csproj" />
351351
</ItemGroup>
352352
<ItemGroup>
353-
<AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn3.11.csproj" />
353+
<AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn3.11.csproj"
354+
Condition="'$(DotNetBuildFromSource)' != 'true'" />
354355
<AnalyzerReference Include="..\gen\System.Text.Json.SourceGeneration.Roslyn4.0.csproj" />
355356
</ItemGroup>
356357
</Project>

src/libraries/src.proj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
Microsoft.Windows.Compatibility\src\Microsoft.Windows.Compatibility.csproj"
1515
Condition="'$(BuildAllConfigurations)' != 'true'" />
1616

17+
<!-- These projects do not need to be built during source-build. -->
18+
<_allSrc Remove="Microsoft.Extensions.DependencyInjection.Specification.Tests\src\Microsoft.Extensions.DependencyInjection.Specification.Tests.csproj;
19+
Microsoft.Windows.Compatibility\src\Microsoft.Windows.Compatibility.csproj"
20+
Condition="'$(DotNetBuildFromSource)' == 'true'" />
21+
1722
<NonNetCoreAppProject Include="@(_allSrc)"
1823
Exclude="@(NetCoreAppLibrary->'%(Identity)\src\%(Identity).csproj');
1924
$(MSBuildThisFileDirectory)Microsoft.VisualBasic.Core\src\Microsoft.VisualBasic.Core.vbproj;

src/tasks/Directory.Build.props

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
<PropertyGroup>
55
<TargetFrameworkForNETFrameworkTasks>net472</TargetFrameworkForNETFrameworkTasks>
6+
<!-- Don't build for NETFramework during source-build. -->
7+
<TargetFrameworkForNETFrameworkTasks Condition="'$(DotNetBuildFromSource)' == 'true'" />
8+
69
<TargetFrameworkForNETCoreTasks>net6.0</TargetFrameworkForNETCoreTasks>
710
</PropertyGroup>
811
</Project>

src/tasks/tasks.proj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<Project Sdk="Microsoft.Build.Traversal">
22
<ItemGroup>
33
<ProjectReference Include="$(MSBuildThisFileDirectory)**\*.csproj" />
4+
5+
<!-- These projects do not need to be built during source-build. -->
6+
<!-- For example, they may take dependencies on pre-built packages that aren't build-from-source. e.g. 'Microsoft.DotNet.CilStrip.Sources' -->
7+
<ProjectReference Remove="MonoTargetsTasks\MonoTargetsTasks.csproj"
8+
Condition="'$(DotNetBuildFromSource)' == 'true'" />
49
</ItemGroup>
510

611
<!--

0 commit comments

Comments
 (0)