Skip to content

Commit d2539ce

Browse files
authored
[release/2.1] Remove test-only prebuilts (#847)
* Remove test-only prebuilts Patch CoreFX to exclude test-related project depending on XUnit.Runtime dependency project. Patch Common and WebSDK to use the roslyn-tools "empty target override" approach to avoid test project restore. Patch SDK to add ExcludeFromSourceBuild=true to test projects. Add Templating build arg that overrides SharedTestProjects to empty to avoid restoring the shared test project's dependencies. Update prebuilt baselines. * Add PR links to patches
1 parent be0bf32 commit d2539ce

7 files changed

+200
-153
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From 9c398b4e9f69089094c22b6e59c5aaf4fd2511c8 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <dagood@microsoft.com>
3+
Date: Wed, 31 Oct 2018 18:05:22 -0500
4+
Subject: [PATCH] Use roslyn-tools technique to skip test restore
5+
6+
Patch PR: https://github.com/aspnet/Extensions/pull/445
7+
---
8+
build/Empty.targets | 23 +++++++++++++++++++++++
9+
test/Directory.Build.targets | 10 ++++++++++
10+
2 files changed, 33 insertions(+)
11+
create mode 100644 build/Empty.targets
12+
create mode 100644 test/Directory.Build.targets
13+
14+
diff --git a/build/Empty.targets b/build/Empty.targets
15+
new file mode 100644
16+
index 0000000..36b4744
17+
--- /dev/null
18+
+++ b/build/Empty.targets
19+
@@ -0,0 +1,23 @@
20+
+<?xml version="1.0" encoding="utf-8"?>
21+
+<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
22+
+<!-- Copied from https://github.com/dotnet/roslyn-tools/blob/c442fe46e02b31e3954a7c669cc309a8b0175115/sdks/RepoToolset/tools/Empty.targets -->
23+
+<Project DefaultTargets="Build">
24+
+
25+
+ <PropertyGroup>
26+
+ <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
27+
+ </PropertyGroup>
28+
+
29+
+ <!--
30+
+ Import this file to suppress all targets while allowing the project to participate in the build.
31+
+ Workaround for https://github.com/dotnet/sdk/issues/2071.
32+
+
33+
+ The targets defined here are not sufficient for the project to be open in Visual Studio without issues though.
34+
+ -->
35+
+
36+
+ <Target Name="_IsProjectRestoreSupported"/>
37+
+ <Target Name="Restore"/>
38+
+ <Target Name="Build"/>
39+
+ <Target Name="Test"/>
40+
+ <Target Name="Pack"/>
41+
+
42+
+</Project>
43+
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
44+
new file mode 100644
45+
index 0000000..037d46b
46+
--- /dev/null
47+
+++ b/test/Directory.Build.targets
48+
@@ -0,0 +1,10 @@
49+
+<?xml version="1.0" encoding="utf-8"?>
50+
+<Project>
51+
+ <!-- Projects in this directory are test-related, and shouldn't participate in source-build. -->
52+
+ <PropertyGroup>
53+
+ <_SuppressAllTargets>false</_SuppressAllTargets>
54+
+ <_SuppressAllTargets Condition="'$(DotNetBuildFromSource)' == 'true'">true</_SuppressAllTargets>
55+
+ </PropertyGroup>
56+
+
57+
+ <Import Project="$(MSBuildThisFileDirectory)..\build\Empty.targets" Condition="$(_SuppressAllTargets)"/>
58+
+</Project>
59+
--
60+
2.17.1.windows.2
61+
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
From 3c58c35b188d80799948917e1e09721ff8316ad2 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <dagood@microsoft.com>
3+
Date: Wed, 31 Oct 2018 22:33:26 -0500
4+
Subject: [PATCH] Skip CoreFx.Private.TestUtilities in source-build
5+
6+
This project referenced the XUnit.Runtime dependency project, causing test-only prebuilt dependencies.
7+
8+
Even though we always pass BuildTests=false, include a condition to handle "true" to make intent clear.
9+
10+
Patch PR: https://github.com/dotnet/corefx/pull/33217
11+
---
12+
dir.props | 8 ++++++++
13+
src/ref.builds | 2 +-
14+
2 files changed, 9 insertions(+), 1 deletion(-)
15+
16+
diff --git a/dir.props b/dir.props
17+
index b75c58047b..530c63c821 100644
18+
--- a/dir.props
19+
+++ b/dir.props
20+
@@ -306,6 +306,14 @@
21+
<SymbolPackageOutputPath Condition="'$(SymbolPackageOutputPath)'==''">$(PackageOutputPath)symbols/</SymbolPackageOutputPath>
22+
</PropertyGroup>
23+
24+
+ <!--
25+
+ Remove test-only dependencies during source-build: disable project that brings in XUnit.Runtime
26+
+ dependencies through 'ReferenceFromRuntime' property.
27+
+ -->
28+
+ <ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true' and '$(BuildTests)' != 'true'">
29+
+ <ProjectExclusions Include="$(SourceDir)CoreFx.Private.TestUtilities/**/*.csproj" />
30+
+ </ItemGroup>
31+
+
32+
<!-- Properties related to multi-file mode for ILC tests -->
33+
<PropertyGroup Condition="'$(TargetGroup)' == 'uapaot'">
34+
<!-- Only enable multi-file for Release-x64 and Debug-x86 for now -->
35+
diff --git a/src/ref.builds b/src/ref.builds
36+
index c7542be16a..79ee0d40a8 100644
37+
--- a/src/ref.builds
38+
+++ b/src/ref.builds
39+
@@ -7,7 +7,7 @@
40+
</PropertyGroup>
41+
42+
<ItemGroup>
43+
- <Project Include="$(MSBuildThisFileDirectory)*\ref\*.*proj" />
44+
+ <Project Include="$(MSBuildThisFileDirectory)*\ref\*.*proj" Exclude="@(ProjectExclusions)" />
45+
</ItemGroup>
46+
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.traversal.targets))\dir.traversal.targets" />
47+
</Project>
48+
\ No newline at end of file
49+
--
50+
2.17.1.windows.2
51+
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 06d3c0dbd226c3f7cd7aafd89ccf2e42f15dfce8 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <dagood@microsoft.com>
3+
Date: Wed, 31 Oct 2018 23:04:45 -0500
4+
Subject: [PATCH] Exclude unit test projects from source-build
5+
6+
Patch PR: https://github.com/dotnet/sdk/pull/2642
7+
---
8+
src/Directory.Build.props | 1 +
9+
1 file changed, 1 insertion(+)
10+
11+
diff --git a/src/Directory.Build.props b/src/Directory.Build.props
12+
index ca3ebe94..396d7b21 100644
13+
--- a/src/Directory.Build.props
14+
+++ b/src/Directory.Build.props
15+
@@ -29,6 +29,7 @@
16+
</PropertyGroup>
17+
18+
<PropertyGroup Condition="'$(IsTestProject)' == 'true'">
19+
+ <ExcludeFromSourceBuild>true</ExcludeFromSourceBuild>
20+
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
21+
<GenerateProgramFile>false</GenerateProgramFile>
22+
<XUnitRunnerAdditionalArguments>-parallel none</XUnitRunnerAdditionalArguments>
23+
--
24+
2.17.1.windows.2
25+
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
From 93e0640c274606a6e2a2c9c07c83df0341247a97 Mon Sep 17 00:00:00 2001
2+
From: Davis Goodin <dagood@microsoft.com>
3+
Date: Thu, 1 Nov 2018 12:50:42 -0500
4+
Subject: [PATCH] Use roslyn-tools technique to skip test restore
5+
6+
Patch PR: https://github.com/aspnet/websdk/pull/421
7+
---
8+
build/Empty.targets | 23 +++++++++++++++++++++++
9+
test/Directory.Build.targets | 10 ++++++++++
10+
2 files changed, 33 insertions(+)
11+
create mode 100644 build/Empty.targets
12+
create mode 100644 test/Directory.Build.targets
13+
14+
diff --git a/build/Empty.targets b/build/Empty.targets
15+
new file mode 100644
16+
index 0000000..36b4744
17+
--- /dev/null
18+
+++ b/build/Empty.targets
19+
@@ -0,0 +1,23 @@
20+
+<?xml version="1.0" encoding="utf-8"?>
21+
+<!-- Copyright (c) Microsoft. All Rights Reserved. Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. -->
22+
+<!-- Copied from https://github.com/dotnet/roslyn-tools/blob/c442fe46e02b31e3954a7c669cc309a8b0175115/sdks/RepoToolset/tools/Empty.targets -->
23+
+<Project DefaultTargets="Build">
24+
+
25+
+ <PropertyGroup>
26+
+ <MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
27+
+ </PropertyGroup>
28+
+
29+
+ <!--
30+
+ Import this file to suppress all targets while allowing the project to participate in the build.
31+
+ Workaround for https://github.com/dotnet/sdk/issues/2071.
32+
+
33+
+ The targets defined here are not sufficient for the project to be open in Visual Studio without issues though.
34+
+ -->
35+
+
36+
+ <Target Name="_IsProjectRestoreSupported"/>
37+
+ <Target Name="Restore"/>
38+
+ <Target Name="Build"/>
39+
+ <Target Name="Test"/>
40+
+ <Target Name="Pack"/>
41+
+
42+
+</Project>
43+
diff --git a/test/Directory.Build.targets b/test/Directory.Build.targets
44+
new file mode 100644
45+
index 0000000..037d46b
46+
--- /dev/null
47+
+++ b/test/Directory.Build.targets
48+
@@ -0,0 +1,10 @@
49+
+<?xml version="1.0" encoding="utf-8"?>
50+
+<Project>
51+
+ <!-- Projects in this directory are test-related, and shouldn't participate in source-build. -->
52+
+ <PropertyGroup>
53+
+ <_SuppressAllTargets>false</_SuppressAllTargets>
54+
+ <_SuppressAllTargets Condition="'$(DotNetBuildFromSource)' == 'true'">true</_SuppressAllTargets>
55+
+ </PropertyGroup>
56+
+
57+
+ <Import Project="$(MSBuildThisFileDirectory)..\build\Empty.targets" Condition="$(_SuppressAllTargets)"/>
58+
+</Project>
59+
--
60+
2.17.1.windows.2
61+

repos/templating.proj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818
<MSBuildProperties Include="BUILD_NUMBER=$(BuildNumber)" />
1919
<MSBuildProperties Include="PackageDateTime=$(PackageDateTime)" />
2020
<MSBuildProperties Include="PackageBuildQuality=$(PackageBuildQuality)" />
21+
<!-- Force SharedTestProjects to be unset, so they aren't restored/built. -->
22+
<MSBuildProperties Include="SharedTestProjects=" />
2123
</ItemGroup>
2224

2325
<ItemGroup>

0 commit comments

Comments
 (0)