Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
115 changes: 115 additions & 0 deletions src/SourceBuild/patches/fsharp/0001-fix-fsharp-r2r-rid.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
From fce21126577f80d2c06db54ac3be4cba5329b33c Mon Sep 17 00:00:00 2001
From: Viktor Hofer <viktor.hofer@microsoft.com>
Date: Tue, 28 May 2024 07:24:18 +0000
Subject: [PATCH] Fix full source-build product build when running R2R

See https://github.com/dotnet/source-build/issues/4410
When building from source, we must set the
RuntimeIdentifier property explicitly as otherwise
the SDK defaults to the portable RID.

Also make the SDK aware of the R2R build by updating
the Known* items in Directory.Build.targets and
remove the AspNetCore framework references.

Backport: https://github.com/dotnet/fsharp/pull/17259

---
Directory.Build.targets | 16 ++++++++++++++++
buildtools/AssemblyCheck/AssemblyCheck.fsproj | 2 +-
buildtools/fslex/fslex.fsproj | 2 +-
buildtools/fsyacc/fsyacc.fsproj | 2 +-
src/fsc/fscProject/fsc.fsproj | 2 +-
src/fsi/fsiProject/fsi.fsproj | 2 +-
6 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/Directory.Build.targets b/Directory.Build.targets
index cd8633771..8a1a1fa4a 100644
--- a/Directory.Build.targets
+++ b/Directory.Build.targets
@@ -21,4 +21,20 @@
<PackageReference Include="xunit.runner.visualstudio" Version="$(XUnitRunnerVersion)" />
<PackageReference Include="NunitXml.TestLogger" Version="$(NunitXmlTestLoggerVersion)" />
</ItemGroup>
+
+ <!--
+ When .NET gets built from source, make the SDK aware there are bootstrap packages
+ for Microsoft.NETCore.App.Runtime.<rid> and Microsoft.NETCore.App.Crossgen2.<rid>.
+ -->
+ <ItemGroup Condition="'$(DotNetBuildFromSource)' == 'true'">
+ <KnownRuntimePack Update="Microsoft.NETCore.App">
+ <RuntimePackRuntimeIdentifiers
+ Condition="'%(TargetFramework)' == '$(NetCurrent)'">%(RuntimePackRuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier)</RuntimePackRuntimeIdentifiers>
+ </KnownRuntimePack>
+ <KnownCrossgen2Pack Update="Microsoft.NETCore.App.Crossgen2">
+ <Crossgen2RuntimeIdentifiers
+ Condition="'%(TargetFramework)' == '$(NetCurrent)'">%(Crossgen2RuntimeIdentifiers);$(NETCoreSdkRuntimeIdentifier)</Crossgen2RuntimeIdentifiers>
+ </KnownCrossgen2Pack>
+ </ItemGroup>
+
</Project>
diff --git a/buildtools/AssemblyCheck/AssemblyCheck.fsproj b/buildtools/AssemblyCheck/AssemblyCheck.fsproj
index 6cfd3b110..bb4b9dd2b 100644
--- a/buildtools/AssemblyCheck/AssemblyCheck.fsproj
+++ b/buildtools/AssemblyCheck/AssemblyCheck.fsproj
@@ -8,7 +8,7 @@

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
diff --git a/buildtools/fslex/fslex.fsproj b/buildtools/fslex/fslex.fsproj
index 03ed6a77a..f93c26d55 100644
--- a/buildtools/fslex/fslex.fsproj
+++ b/buildtools/fslex/fslex.fsproj
@@ -9,7 +9,7 @@

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
diff --git a/buildtools/fsyacc/fsyacc.fsproj b/buildtools/fsyacc/fsyacc.fsproj
index 621a2f3c7..8dd8f9f7d 100644
--- a/buildtools/fsyacc/fsyacc.fsproj
+++ b/buildtools/fsyacc/fsyacc.fsproj
@@ -9,7 +9,7 @@

<PropertyGroup>
<PublishReadyToRun>true</PublishReadyToRun>
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup>
diff --git a/src/fsc/fscProject/fsc.fsproj b/src/fsc/fscProject/fsc.fsproj
index 5f30ad305..1f22c8531 100644
--- a/src/fsc/fscProject/fsc.fsproj
+++ b/src/fsc/fscProject/fsc.fsproj
@@ -11,7 +11,7 @@
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<PublishReadyToRun>true</PublishReadyToRun>
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Proto'">
diff --git a/src/fsi/fsiProject/fsi.fsproj b/src/fsi/fsiProject/fsi.fsproj
index 639ab45af..634ed56a9 100644
--- a/src/fsi/fsiProject/fsi.fsproj
+++ b/src/fsi/fsiProject/fsi.fsproj
@@ -11,7 +11,7 @@
<PropertyGroup Condition="'$(Configuration)' == 'Proto'">
<TargetFramework>$(FSharpNetCoreProductTargetFramework)</TargetFramework>
<PublishReadyToRun>true</PublishReadyToRun>
- <UseCurrentRuntimeIdentifier>true</UseCurrentRuntimeIdentifier>
+ <RuntimeIdentifier>$(NETCoreSdkRuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>

<ItemGroup Condition="'$(Configuration)' == 'Proto'">