From aad48c1f67f69704a6f7ac571221022ab5b14975 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 27 Jan 2025 14:55:30 -0800 Subject: [PATCH 1/4] Allow the NativeAOT runtime pack to be specified as the ILC runtime package --- ...soft.DotNet.ILCompiler.SingleEntry.targets | 7 ++++- .../Microsoft.NETCore.Native.Publish.targets | 4 +-- .../Microsoft.NETCore.Native.targets | 31 +++++++++++++------ 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index c2627502f9ddd6..6998196882edb1 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -24,6 +24,8 @@ <_hostPackageName Condition="'$(_targetsNonPortableSdkRid)' == 'true'">runtime.$(RuntimeIdentifier).Microsoft.DotNet.ILCompiler <_targetPackageName>runtime.$(_originalTargetOS)-$(_targetArchitecture).Microsoft.DotNet.ILCompiler <_targetPackageName Condition="'$(_targetsNonPortableSdkRid)' == 'true'">runtime.$(RuntimeIdentifier).Microsoft.DotNet.ILCompiler + <_targetRuntimePackName>Microsoft.NETCore.App.Runtime.NativeAOT.$(_originalTargetOS)-$(_targetArchitecture) + <_targetRuntimePackName Condition="'$(_targetsNonPortableSdkRid)' == 'true'">Microsoft.NETCore.App.Runtime.NativeAOT.$(RuntimeIdentifier) <_targetOS>$(_originalTargetOS) @@ -64,8 +66,11 @@ @(ResolvedILCompilerPack->'%(PackageDirectory)') - @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') @(ResolvedILCompilerPack->'%(PackageDirectory)') + @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') + + @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') + true diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets index 0e633f34e3b24f..656e525ca32eb7 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.Publish.targets @@ -68,8 +68,8 @@ Text="Add a PackageReference for '$(_hostPackageName)' to allow cross-compilation for $(_targetArchitecture)" /> - - + + <_NETCoreAppFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.RuntimePackName)' == 'Microsoft.NETCore.App.Runtime.NativeAOT.$(RuntimeIdentifier)'" /> + $(PublishAotUsingRuntimePack) + + + <_NETCoreAppRuntimePackPath Condition="'$(PublishAotUsingRuntimePack)' == 'true'">%(_NETCoreAppFrameworkReference.RuntimePackPath)/runtimes/$(RuntimeIdentifier)/ + <_NETCoreAppRuntimePackPath Condition="'$(PublishAotUsingRuntimePack)' != 'true'">$(RuntimePackagePath)/runtimes/$(RuntimeIdentifier)/ + $(_NETCoreAppRuntimePackPath)\native\ + $(IlcFrameworkNativePath) + + + + $(RuntimePackagePath)\framework\ + $(RuntimePackagePath)\framework\ + $(RuntimePackagePath)\sdk\ + + $(IlcHostPackagePath)\tools\ - $(RuntimePackagePath)\framework\ - <_NETCoreAppRuntimePackPath>%(_NETCoreAppFrameworkReference.RuntimePackPath)/runtimes/$(RuntimeIdentifier)/ - $(_NETCoreAppRuntimePackPath)\native\ - $(RuntimePackagePath)\framework\ - $(IlcFrameworkNativePath) - $(RuntimePackagePath)\sdk\ - $(RuntimePackagePath)\mibc\ + $(RuntimePackagePath)\mibc\ + $(IlcHostPackagePath)\mibc\ - + - + From 6e81e9926d5849fc63f766c4a896e7b0d3efed3e Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 27 Jan 2025 15:26:45 -0800 Subject: [PATCH 2/4] Put the property in a PropertyGroup --- .../BuildIntegration/Microsoft.NETCore.Native.targets | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 3875309e47dd7a..5d0e433caaf113 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -129,9 +129,12 @@ The .NET Foundation licenses this file to you under the MIT license. <_NETCoreAppFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.RuntimePackName)' == 'Microsoft.NETCore.App.Runtime.NativeAOT.$(RuntimeIdentifier)'" /> - $(PublishAotUsingRuntimePack) + + $(PublishAotUsingRuntimePack) + + <_NETCoreAppRuntimePackPath Condition="'$(PublishAotUsingRuntimePack)' == 'true'">%(_NETCoreAppFrameworkReference.RuntimePackPath)/runtimes/$(RuntimeIdentifier)/ <_NETCoreAppRuntimePackPath Condition="'$(PublishAotUsingRuntimePack)' != 'true'">$(RuntimePackagePath)/runtimes/$(RuntimeIdentifier)/ From 52d2bca8d89120fdcafe69e54420218145d8ab71 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 4 Feb 2025 15:52:11 -0800 Subject: [PATCH 4/4] PR feedback --- .../Microsoft.DotNet.ILCompiler.SingleEntry.targets | 5 ++--- .../BuildIntegration/Microsoft.NETCore.Native.targets | 7 +------ .../Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj | 3 +++ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets index 6998196882edb1..059d1754c68263 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.DotNet.ILCompiler.SingleEntry.targets @@ -67,10 +67,9 @@ @(ResolvedILCompilerPack->'%(PackageDirectory)') @(ResolvedILCompilerPack->'%(PackageDirectory)') - @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') - - @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') + @(ResolvedTargetILCompilerPack->'%(PackageDirectory)') true + $(PublishAotUsingRuntimePack) diff --git a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets index 29cf233259e94d..2bc334f013d80a 100644 --- a/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets +++ b/src/coreclr/nativeaot/BuildIntegration/Microsoft.NETCore.Native.targets @@ -131,10 +131,6 @@ The .NET Foundation licenses this file to you under the MIT license. <_NETCoreAppFrameworkReference Include="@(ResolvedFrameworkReference)" Condition="'%(ResolvedFrameworkReference.RuntimePackName)' == 'Microsoft.NETCore.App.Runtime.NativeAOT.$(RuntimeIdentifier)'" /> - - $(PublishAotUsingRuntimePack) - - $(IlcHostPackagePath)\tools\ - $(RuntimePackagePath)\mibc\ - $(IlcHostPackagePath)\mibc\ + $(RuntimePackagePath)\mibc\ diff --git a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj index 336574ffe10fc7..34587e9fa80607 100644 --- a/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj +++ b/src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Runtime.NativeAOT.sfxproj @@ -20,8 +20,11 @@ + +