Skip to content

Commit

Permalink
source-build: bundle NativeAOT libraries with the SDK.
Browse files Browse the repository at this point in the history
This includes the libraries that are needed for source-built NativeAOT with the source-built SDK:
- runtime.<rid>.Microsoft.DotNet.ILCompiler extracted under 'packs'.
- Microsoft.DotNet.ILCompiler and Microsoft.NET.ILLink.Tasks as NuGet packages under 'library-packs'.
  • Loading branch information
tmds committed May 28, 2024
1 parent bb53ee6 commit 7fe5ee2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 5 deletions.
16 changes: 16 additions & 0 deletions src/Installer/redist-installer/targets/GenerateLayout.targets
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,17 @@
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>

<BundledLayoutPackage Include="MicrosoftDotNetILCompilerPackNupkg" Condition="'$(BundleNativeAotCompiler)' == 'true'">
<PackageName>runtime.$(SharedFrameworkRid).Microsoft.DotNet.ILCompiler</PackageName>
<PackageVersion>$(MicrosoftNETCoreAppRuntimePackageVersion)</PackageVersion>
<TargetFramework>$(TargetFramework)</TargetFramework>
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>

<BundledLayoutLibraryPackage Include="$(SourceBuiltShippingPackagesDir)/../runtime/Microsoft.DotNet.ILCompiler.$(MicrosoftNETCoreAppRuntimePackageVersion).nupkg" Condition="'$(BundleNativeAotCompiler)' == 'true'" />

<BundledLayoutLibraryPackage Include="$(SourceBuiltShippingPackagesDir)/../runtime/Microsoft.NET.ILLink.Tasks.$(MicrosoftNETILLinkTasksPackageVersion).nupkg" Condition="'$(BundleNativeAotCompiler)' == 'true'" />

<BundledInstallerComponent Include="DownloadedRuntimeDepsInstallerFile"
Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
<BaseUrl>$(NetRuntimeRootUrl)</BaseUrl>
Expand Down Expand Up @@ -460,6 +471,11 @@
SkipUnchangedFiles="true"
/>

<Copy SourceFiles="@(BundledLayoutLibraryPackage)"
DestinationFolder="$(RedistLayoutPath)/library-packs"
SkipUnchangedFiles="true"
/>

<!-- From Version.targets in SDK redist -->
<PropertyGroup>
<ArtifactNameSdk>dotnet-toolset-internal</ArtifactNameSdk>
Expand Down
15 changes: 10 additions & 5 deletions src/Tasks/Microsoft.NET.Build.Tasks/ProcessFrameworkReferences.cs
Original file line number Diff line number Diff line change
Expand Up @@ -788,17 +788,22 @@ private ToolPackSupport AddToolPack(

var runtimePackName = packNamePattern.Replace("**RID**", hostRuntimeIdentifier);

if (EnableRuntimePackDownload)
var runtimePackItem = new TaskItem(runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageId, runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageVersion, packVersion);

string runtimePackPath = GetPackPath(runtimePackName, packVersion);
if (runtimePackPath != null)
{
runtimePackItem.SetMetadata(MetadataKeys.PackageDirectory, runtimePackPath);
}
else if (EnableRuntimePackDownload)
{
// We need to download the runtime pack
runtimePackToDownload = new TaskItem(runtimePackName);
runtimePackToDownload.SetMetadata(MetadataKeys.Version, packVersion);
}

var runtimePackItem = new TaskItem(runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageId, runtimePackName);
runtimePackItem.SetMetadata(MetadataKeys.NuGetPackageVersion, packVersion);

switch (toolPackType)
{
case ToolPackType.Crossgen2:
Expand Down

0 comments on commit 7fe5ee2

Please sign in to comment.