Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow opting-in to NativeAOT publishing using runtime packs #32100

Merged
merged 1 commit into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ public class ProcessFrameworkReferences : TaskBase

public bool AotEnabled { get; set; }

public bool AotUseKnownRuntimePackForTarget { get; set; }

public string RuntimeIdentifier { get; set; }

public string[] RuntimeIdentifiers { get; set; }
Expand Down Expand Up @@ -678,9 +680,10 @@ private bool AddToolPack(
case ToolPackType.ILCompiler:
HostILCompilerPacks = new[] { runtimePackItem };

// ILCompiler supports cross target compilation. If there is a cross-target request, we need to download that package as well
// ILCompiler supports cross target compilation. If there is a cross-target request,
// we need to download that package as well unless we use KnownRuntimePack entries for the target.
// We expect RuntimeIdentifier to be defined during publish but can allow during build
if (RuntimeIdentifier != null)
if (RuntimeIdentifier != null && !AotUseKnownRuntimePackForTarget)
{
var targetRuntimeIdentifier = NuGetUtils.GetBestMatchingRid(runtimeGraph, RuntimeIdentifier, packSupportedRuntimeIdentifiers, out bool wasInGraph2);
if (targetRuntimeIdentifier == null)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ Copyright (c) .NET Foundation. All rights reserved.
RuntimePackLabels="Mono"
Condition="'$(UseMonoRuntime)' == 'true' And ('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '6.0')" />

<!-- Allow opt-in to NativeAOT runtime pack for .NET 8.0 or higher -->
<FrameworkReference Update="Microsoft.NETCore.App"
RuntimePackLabels="NativeAOT"
Condition="'$(PublishAotUsingRuntimePack)' == 'true' And ('$(_TargetFrameworkVersionWithoutV)' != '') And ('$(_TargetFrameworkVersionWithoutV)' >= '8.0')" />

</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ Copyright (c) .NET Foundation. All rights reserved.
ReadyToRunUseCrossgen2="$(PublishReadyToRunUseCrossgen2)"
TrimmingEnabled="$(_IsTrimmingEnabled)"
AotEnabled="$(PublishAot)"
AotUseKnownRuntimePackForTarget="$(PublishAotUsingRuntimePack)"
RuntimeIdentifier="$(RuntimeIdentifier)"
RuntimeIdentifiers="$(RuntimeIdentifiers)"
RuntimeFrameworkVersion="$(RuntimeFrameworkVersion)"
Expand Down