Skip to content

Commit 43ff4fd

Browse files
authored
Fix fsharp stage 2 source-build (#41197)
1 parent 4ca28cc commit 43ff4fd

File tree

1 file changed

+115
-0
lines changed

1 file changed

+115
-0
lines changed
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
From fce21126577f80d2c06db54ac3be4cba5329b33c Mon Sep 17 00:00:00 2001
2+
From: Viktor Hofer <viktor.hofer@microsoft.com>
3+
Date: Tue, 28 May 2024 07:24:18 +0000
4+
Subject: [PATCH] Fix full source-build product build when running R2R
5+
6+
See https://github.com/dotnet/source-build/issues/4410
7+
When building from source, we must set the
8+
RuntimeIdentifier property explicitly as otherwise
9+
the SDK defaults to the portable RID.
10+
11+
Also make the SDK aware of the R2R build by updating
12+
the Known* items in Directory.Build.targets and
13+
remove the AspNetCore framework references.
14+
15+
Backport: https://github.com/dotnet/fsharp/pull/17259
16+
17+
---
18+
Directory.Build.targets | 16 ++++++++++++++++
19+
buildtools/AssemblyCheck/AssemblyCheck.fsproj | 2 +-
20+
buildtools/fslex/fslex.fsproj | 2 +-
21+
buildtools/fsyacc/fsyacc.fsproj | 2 +-
22+
src/fsc/fscProject/fsc.fsproj | 2 +-
23+
src/fsi/fsiProject/fsi.fsproj | 2 +-
24+
6 files changed, 21 insertions(+), 5 deletions(-)
25+
26+
diff --git a/Directory.Build.targets b/Directory.Build.targets
27+
index cd8633771..8a1a1fa4a 100644
28+
--- a/Directory.Build.targets
29+
+++ b/Directory.Build.targets
30+
@@ -21,4 +21,20 @@
31+
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVersion)" />
32+
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
33+
</ItemGroup>
34+
+
35+
+ <!--
36+
+ When .NET gets built from source, make the SDK aware there are bootstrap packages
37+
+ for Microsoft.NETCore.App.Runtime.<rid> and Microsoft.NETCore.App.Crossgen2.<rid>.
38+
+ -->
39+
+ <ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
40+
+ <KnownRuntimePack Update="Microsoft.NETCore.App">
41+
+ <RuntimePackRuntimeIdentifiers
42+
+ Condition="'%(TargetFramework)' == '$(NetCurrent)'">%(RuntimePackRuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
43+
+ </KnownRuntimePack>
44+
+ <KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2">
45+
+ <Crossgen2RuntimeIdentifiers
46+
+ Condition="'%(TargetFramework)' == '$(NetCurrent)'">%(Crossgen2RuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier)</Crossgen2RuntimeIdentifiers>
47+
+ </KnownCrossgen2Pack>
48+
+ </ItemGroup>
49+
+
50+
</Project>
51+
diff --git a/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/buildtools/AssemblyCheck/AssemblyCheck.fsproj
52+
index 6cfd3b110..bb4b9dd2b 100644
53+
--- a/buildtools/AssemblyCheck/AssemblyCheck.fsproj
54+
+++ b/buildtools/AssemblyCheck/AssemblyCheck.fsproj
55+
@@ -8,7 +8,7 @@
56+
57+
<PropertyGroup>
58+
<PublishReadyToRun>true</PublishReadyToRun>
59+
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
60+
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
61+
</PropertyGroup>
62+
63+
<ItemGroup>
64+
diff --git a/buildtools/fslex/fslex.fsproj b/buildtools/fslex/fslex.fsproj
65+
index 03ed6a77a..f93c26d55 100644
66+
--- a/buildtools/fslex/fslex.fsproj
67+
+++ b/buildtools/fslex/fslex.fsproj
68+
@@ -9,7 +9,7 @@
69+
70+
<PropertyGroup>
71+
<PublishReadyToRun>true</PublishReadyToRun>
72+
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
73+
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
74+
</PropertyGroup>
75+
76+
<ItemGroup>
77+
diff --git a/buildtools/fsyacc/fsyacc.fsproj b/buildtools/fsyacc/fsyacc.fsproj
78+
index 621a2f3c7..8dd8f9f7d 100644
79+
--- a/buildtools/fsyacc/fsyacc.fsproj
80+
+++ b/buildtools/fsyacc/fsyacc.fsproj
81+
@@ -9,7 +9,7 @@
82+
83+
<PropertyGroup>
84+
<PublishReadyToRun>true</PublishReadyToRun>
85+
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
86+
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
87+
</PropertyGroup>
88+
89+
<ItemGroup>
90+
diff --git a/src/fsc/fscProject/fsc.fsproj b/src/fsc/fscProject/fsc.fsproj
91+
index 5f30ad305..1f22c8531 100644
92+
--- a/src/fsc/fscProject/fsc.fsproj
93+
+++ b/src/fsc/fscProject/fsc.fsproj
94+
@@ -11,7 +11,7 @@
95+
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
96+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
97+
<PublishReadyToRun>true</PublishReadyToRun>
98+
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
99+
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
100+
</PropertyGroup>
101+
102+
<ItemGroup Condition="'$(Configuration)' == 'Proto'">
103+
diff --git a/src/fsi/fsiProject/fsi.fsproj b/src/fsi/fsiProject/fsi.fsproj
104+
index 639ab45af..634ed56a9 100644
105+
--- a/src/fsi/fsiProject/fsi.fsproj
106+
+++ b/src/fsi/fsiProject/fsi.fsproj
107+
@@ -11,7 +11,7 @@
108+
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
109+
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
110+
<PublishReadyToRun>true</PublishReadyToRun>
111+
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
112+
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
113+
</PropertyGroup>
114+
115+
<ItemGroup Condition="'$(Configuration)' == 'Proto'">

0 commit comments

Comments
 (0)