Skip to content

Commit 323d2ea

Browse files
committed
[builds] Automatically apply dotnet/runtime#85966.
Ref: dotnet/runtime#85996
1 parent b0fba63 commit 323d2ea

File tree

3 files changed

+115
-0
lines changed

3 files changed

+115
-0
lines changed

builds/85996-modified.patch

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
From c11fa2be22891658a849b9320664057a7c433487 Mon Sep 17 00:00:00 2001
2+
From: Filip Navara <[email protected]>
3+
Date: Tue, 9 May 2023 19:20:19 +0200
4+
Subject: [PATCH] Update ILCompiler paths to handle
5+
PublishAotUsingRuntimePack=true
6+
7+
---
8+
.../Microsoft.NETCore.Native.Publish.targets | 4 +--
9+
.../Microsoft.NETCore.Native.Unix.targets | 10 +++----
10+
.../Microsoft.NETCore.Native.targets | 27 ++++++++++++++-----
11+
3 files changed, 28 insertions(+), 13 deletions(-)
12+
13+
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
14+
index 6f672918b33e0..be1fbde77efc9 100644
15+
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
16+
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets
17+
@@ -70,8 +70,8 @@
18+
Text="Add a PackageReference for '$(_hostPackageName)' to allow cross-compilation for $(_targetArchitecture)" />
19+
20+
<!-- NativeAOT runtime pack assemblies need to be defined to avoid the default CoreCLR implementations being set as compiler inputs -->
21+
- <Error Condition="'@(PrivateSdkAssemblies)' == ''" Text="The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
22+
- <Error Condition="'@(FrameworkAssemblies)' == ''" Text="The FrameworkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
23+
+ <Error Condition="'@(PrivateSdkAssemblies)' == '' and '$(PublishAotUsingRuntimePack)' != 'true'" Text="The PrivateSdkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
24+
+ <Error Condition="'@(FrameworkAssemblies)' == '' and '$(PublishAotUsingRuntimePack)' != 'true'" Text="The FrameworkAssemblies ItemGroup is required for _ComputeAssembliesToCompileToNative" />
25+
26+
<ComputeManagedAssembliesToCompileToNative
27+
Assemblies="@(_ResolvedCopyLocalPublishAssets)"
28+
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
29+
index bb457c8c166bc..6b6b59ab7967b 100644
30+
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
31+
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Unix.targets
32+
@@ -53,11 +53,11 @@ The .NET Foundation licenses this file to you under the MIT license.
33+
34+
<ItemGroup>
35+
<NativeLibrary Condition="'$(IlcMultiModule)' == 'true'" Include="$(SharedLibrary)" />
36+
- <NativeLibrary Condition="'$(NativeLib)' == '' and '$(CustomNativeMain)' != 'true'" Include="$(IlcSdkPath)libbootstrapper.a" />
37+
- <NativeLibrary Condition="'$(NativeLib)' != '' or '$(CustomNativeMain)' == 'true'" Include="$(IlcSdkPath)libbootstrapperdll.a" />
38+
- <NativeLibrary Include="$(IlcSdkPath)$(FullRuntimeName).a" />
39+
- <NativeLibrary Include="$(IlcSdkPath)$(EventPipeName)$(LibFileExt)" />
40+
- <NativeLibrary Condition="'$(LinkStandardCPlusPlusLibrary)' != 'true' and '$(StaticICULinking)' != 'true'" Include="$(IlcSdkPath)libstdc++compat.a" />
41+
+ <NativeLibrary Condition="'$(NativeLib)' == '' and '$(CustomNativeMain)' != 'true'" Include="$(IlcFrameworkSdkPath)libbootstrapper.a" />
42+
+ <NativeLibrary Condition="'$(NativeLib)' != '' or '$(CustomNativeMain)' == 'true'" Include="$(IlcFrameworkSdkPath)libbootstrapperdll.a" />
43+
+ <NativeLibrary Include="$(IlcFrameworkSdkPath)$(FullRuntimeName).a" />
44+
+ <NativeLibrary Include="$(IlcFrameworkSdkPath)$(EventPipeName)$(LibFileExt)" />
45+
+ <NativeLibrary Condition="'$(LinkStandardCPlusPlusLibrary)' != 'true' and '$(StaticICULinking)' != 'true'" Include="$(IlcFrameworkSdkPath)libstdc++compat.a" />
46+
</ItemGroup>
47+
48+
<ItemGroup>
49+
diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
50+
index fbcadcc71b597..afa1cc1a66b9f 100644
51+
--- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
52+
+++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets
53+
@@ -126,26 +126,41 @@ The .NET Foundation licenses this file to you under the MIT license.
54+
55+
<!-- The properties below need to be defined only after we've found the correct runtime package reference -->
56+
<Target Name="SetupProperties" DependsOnTargets="$(IlcSetupPropertiesDependsOn)" BeforeTargets="Publish">
57+
+ <ItemGroup>
58+
+ <_NETCoreAppFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.RuntimePackName)' == 'Microsoft.NETCore.App.Runtime.NativeAOT.$(RuntimeIdentifier)'" />
59+
+ </ItemGroup>
60+
+
61+
<PropertyGroup>
62+
<!-- Define paths used in build targets to point to the runtime-specific ILCompiler implementation -->
63+
<IlcToolsPath Condition="'$(IlcToolsPath)' == ''">$(IlcHostPackagePath)\tools\</IlcToolsPath>
64+
<IlcSdkPath Condition="'$(IlcSdkPath)' == ''">$(RuntimePackagePath)\sdk\</IlcSdkPath>
65+
- <IlcFrameworkPath Condition="'$(IlcFrameworkPath)' == ''">$(RuntimePackagePath)\framework\</IlcFrameworkPath>
66+
- <IlcFrameworkNativePath Condition="'$(IlcFrameworkNativePath)' == ''">$(RuntimePackagePath)\framework\</IlcFrameworkNativePath>
67+
+ <IlcFrameworkPath Condition="'$(IlcFrameworkPath)' == '' and '$(PublishAotUsingRuntimePack)' != 'true'">$(RuntimePackagePath)\framework\</IlcFrameworkPath>
68+
+ <_NETCoreAppRuntimePackPath>%(_NETCoreAppFrameworkReference.RuntimePackPath)/runtimes/$(RuntimeIdentifier)/</_NETCoreAppRuntimePackPath>
69+
+ <IlcFrameworkNativePath Condition="'$(IlcFrameworkNativePath)' == '' and '$(PublishAotUsingRuntimePack)' == 'true'">$(_NETCoreAppRuntimePackPath)\native\</IlcFrameworkNativePath>
70+
+ <IlcFrameworkNativePath Condition="'$(IlcFrameworkNativePath)' == '' and '$(PublishAotUsingRuntimePack)' != 'true'">$(RuntimePackagePath)\framework\</IlcFrameworkNativePath>
71+
+ <IlcFrameworkSdkPath Condition="'$(IlcFrameworkSdkPath)' == '' and '$(PublishAotUsingRuntimePack)' == 'true'">$(IlcFrameworkNativePath)</IlcFrameworkSdkPath>
72+
+ <IlcFrameworkSdkPath Condition="'$(IlcFrameworkSdkPath)' == '' and '$(PublishAotUsingRuntimePack)' != 'true'">$(IlcSdkPath)</IlcFrameworkSdkPath>
73+
<IlcMibcPath Condition="'$(IlcMibcPath)' == ''">$(RuntimePackagePath)\mibc\</IlcMibcPath>
74+
</PropertyGroup>
75+
76+
- <ItemGroup>
77+
- <PrivateSdkAssemblies Include="$(IlcSdkPath)*.dll" />
78+
+ <ItemGroup Condition="'$(PublishAotUsingRuntimePack)' == 'true'">
79+
+ <PrivateSdkAssemblies Include="$(IlcFrameworkSdkPath)*.dll"/>
80+
+ <FrameworkAssemblies Include="@(RuntimePackAsset)" Condition="'%(Extension)' == '.dll'" />
81+
+ <DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />
82+
+ </ItemGroup>
83+
84+
+ <ItemGroup Condition="'$(PublishAotUsingRuntimePack)' != 'true'">
85+
+ <PrivateSdkAssemblies Include="$(IlcFrameworkSdkPath)*.dll"/>
86+
<!-- Exclude unmanaged dlls -->
87+
<FrameworkAssemblies Include="$(IlcFrameworkPath)*.dll" Exclude="$(IlcFrameworkPath)*.Native.dll;$(IlcFrameworkPath)msquic.dll" />
88+
89+
- <MibcFile Include="$(IlcMibcPath)*.mibc" Condition="'$(IlcPgoOptimize)' == 'true'" />
90+
-
91+
<DefaultFrameworkAssemblies Include="@(FrameworkAssemblies)" />
92+
<DefaultFrameworkAssemblies Include="@(PrivateSdkAssemblies)" />
93+
</ItemGroup>
94+
+
95+
+ <ItemGroup>
96+
+ <MibcFile Include="$(IlcMibcPath)*.mibc" Condition="'$(IlcPgoOptimize)' == 'true'" />
97+
+ </ItemGroup>
98+
</Target>
99+
100+
<Target Name="ComputeIlcCompileInputs" DependsOnTargets="$(IlcDynamicBuildPropertyDependencies)" BeforeTargets="Publish">

builds/Makefile

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,15 @@ dotnet-install.sh: Makefile
103103
fix-maccatalyst-assembly/bin/Debug/fix-maccatalyst-assembly.exe: $(wildcard fix-maccatalyst-assembly/*.cs*) Makefile
104104
$(Q) $(SYSTEM_MSBUILD) "/bl:$@.binlog" /r fix-maccatalyst-assembly/fix-maccatalyst-assembly.csproj $(MSBUILD_VERBOSITY)
105105

106+
apply-filip-patch:
107+
$(Q) $(MAKE) .stamp-apply-filip-patch-$(DOTNET_VERSION)
108+
109+
.stamp-apply-filip-patch-$(DOTNET_VERSION):
110+
$(Q) cd $(abspath $(TOP)/packages/microsoft.dotnet.ilcompiler/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/build) && git init . && git config user.email "[email protected]" && git config user.name "Temporary" && git add . && git commit -m "Start" && cat $(CURDIR)/85996-modified.patch | git am -p 5 --ignore-space-change
111+
$(Q) cd $(abspath $(TOP)/packages/runtime.osx-x64.microsoft.dotnet.ilcompiler/$(BUNDLED_NETCORE_PLATFORMS_PACKAGE_VERSION)/build) && git init . && git config user.email "[email protected]" && git config user.name "Temporary" && git add . && git commit -m "Start" && cat $(CURDIR)/85996-modified.patch | git am -p 5 --ignore-space-change
112+
$(Q) touch $@
113+
$(Q) echo "Applied Filip's fixes"
114+
106115
define FixMacCatalystAssembly
107116
$(MONO_MACCATALYST_SDK_DESTDIR)/maccat-bcl/monotouch/$(1).dll: .stamp-$(MONO_BUILD_MODE)
108117

@@ -161,6 +170,7 @@ package-download/all-package-references.csproj: $(TOP)/.git/HEAD $(TOP)/.git/ind
161170
/bl \
162171
$(DOTNET_BUILD_VERBOSITY)
163172
$(MAKE) .stamp-install-custom-dotnet-runtime-workloads
173+
$(Q) make apply-filip-patch
164174
$(Q) touch $@
165175

166176
.stamp-install-t4: $(TOP)/.config/dotnet-tools.json .stamp-download-dotnet-packages

builds/package-download/download-packages.csproj

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,11 @@
2525

2626
<!-- and get the emscripten workload(s) as well -->
2727
<PackageDownload Include="Microsoft.NET.Workload.Emscripten.net7.Manifest-$(EmscriptenManifestVersionBand)" Version="[$(Emscriptennet7WorkloadVersion)]" Condition="'$(TrackingDotNetRuntimeSeparately)' != ''" />
28+
29+
30+
<!-- ILCompiler -->
31+
<PackageDownload Include="Microsoft.DotNet.ILCompiler" Version="[$(ActualPackageVersion)]" />
32+
<PackageDownload Include="Runtime.osx-x64.Microsoft.DotNet.ILCompiler" Version="[$(ActualPackageVersion)]" />
2833
</ItemGroup>
2934

3035
<Import Project="all-package-references.csproj" />

0 commit comments

Comments
 (0)