source-build: bundle runtime packs with the sdk. (#16499)

Co-authored-by: Daniel Plaisted <dsplaisted@gmail.com>
This commit is contained in:
Tom Deseyn 2023-05-30 20:14:52 +02:00 committed by GitHub
parent b9ce02be7c
commit 5ddd9e43e6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 45 additions and 10 deletions

View file

@ -6,6 +6,7 @@
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>none</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<BundleRuntimePacks Condition="'$(BundleRuntimePacks)' == '' And '$(DotNetBuildFromSource)' == 'true'">true</BundleRuntimePacks>
</PropertyGroup>
<ItemGroup>

View file

@ -199,18 +199,24 @@
<!--
In source-build, we build the current RID from source, which may be
non-portable and/or not an official RID. However, we can only use the
apphost pack, not the runtime pack, because:
- Apphost packs are distributed in the SDK.
- Runtime packs are not shipped with the SDK, only on NuGet.
Adding the ability to distribute and use source-built runtime packs is
tracked by: https://github.com/dotnet/source-build/issues/1215
non-portable and/or not an official RID.
These packs for the non-portable RID are distributed with the SDK:
- NETCore.App.Host
- NETCore.App.Runtime (when BundleRuntimePacks)
- AspNetCore.App.Runtime (when BundleRuntimePacks)
-->
<NetCoreAppHostRids
Condition="'$(DotNetBuildFromSource)' == 'true'"
Include="$(ProductMonikerRid)" />
<NetCoreRuntimePackRids
Condition="'$(BundleRuntimePacks)' == 'true'"
Include="$(ProductMonikerRid)" />
<AspNetCoreRuntimePackRids
Condition="'$(BundleRuntimePacks)' == 'true'"
Include="$(ProductMonikerRid)" />
<MonoRuntimePackRids Include="
@(NetCoreRuntimePackRids);
browser-wasm;
@ -279,7 +285,7 @@
<AspNetCore50RuntimePackRids Include="@(AspNetCore31RuntimePackRids);linux-musl-arm;win-arm64" />
<AspNetCore60RuntimePackRids Include="@(AspNetCore50RuntimePackRids);osx-arm64;linux-s390x" />
<AspNetCore70RuntimePackRids Include="@(AspNetCore60RuntimePackRids);linux-ppc64le" />
<AspNetCore80RuntimePackRids Include="@(AspNetCore70RuntimePackRids)" />
<AspNetCoreRuntimePackRids Include="@(AspNetCore70RuntimePackRids)" />
<WindowsDesktop30RuntimePackRids Include="win-x64;win-x86" />
<WindowsDesktop31RuntimePackRids Include="@(WindowsDesktop30RuntimePackRids)" />
@ -487,7 +493,7 @@ Copyright (c) .NET Foundation. All rights reserved.
TargetingPackName="Microsoft.AspNetCore.App.Ref"
TargetingPackVersion="$(MicrosoftAspNetCoreAppRefPackageVersion)"
RuntimePackNamePatterns="Microsoft.AspNetCore.App.Runtime.**RID**"
RuntimePackRuntimeIdentifiers="@(AspNetCore80RuntimePackRids, '%3B')"
RuntimePackRuntimeIdentifiers="@(AspNetCoreRuntimePackRids, '%3B')"
RuntimePackExcludedRuntimeIdentifiers="android"
/>

View file

@ -183,6 +183,20 @@
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>
<BundledLayoutPackage Include="MicrosoftNetCoreAppRuntimePackNupkg" Condition="'$(BundleRuntimePacks)' == 'true'">
<PackageName>Microsoft.NETCore.App.Runtime.$(SharedFrameworkRid)</PackageName>
<PackageVersion>$(MicrosoftNETCoreAppRuntimePackageVersion)</PackageVersion>
<TargetFramework>$(TargetFramework)</TargetFramework>
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>
<BundledLayoutPackage Include="MicrosoftAspNetCoreAppRuntimePackNupkg" Condition="'$(BundleRuntimePacks)' == 'true'">
<PackageName>Microsoft.AspNetCore.App.Runtime.$(SharedFrameworkRid)</PackageName>
<PackageVersion>$(MicrosoftAspNetCoreAppRuntimePackageVersion)</PackageVersion>
<TargetFramework>$(TargetFramework)</TargetFramework>
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage>
<BundledInstallerComponent Include="DownloadedRuntimeDepsInstallerFile"
Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
@ -550,6 +564,19 @@
<ResolveAssemblyReference AssemblyFiles="@(AssembliesToResolve)" Silent="$(ResolveAssemblyReferencesSilent)" AssemblyInformationCacheOutputPath="$(RedistLayoutPath)sdk\$(Version)\SDKPrecomputedAssemblyReferences.cache" SearchPaths="{RawFileName}" WarnOrErrorOnTargetArchitectureMismatch="$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)" />
</Target>
<!-- Replace duplicate files with hard links so that when the same files from a runtime pack
and the corresponding shared frameworks are included in a distro package their data is shared instead of duplicated. -->
<Target Name="ReplaceDuplicateFilesWithHardLinks" DependsOnTargets="LayoutBundledComponents"
Condition="'$(BundleRuntimePacks)' == 'true'">
<Exec Command="rdfind --help" StandardOutputImportance="low" StandardErrorImportance="low" IgnoreExitCode="True">
<Output TaskParameter="ExitCode" PropertyName="RdFindInfoExitCode" />
</Exec>
<Message Text="rdfind is not available to make hard links." Condition="'$(RdFindInfoExitCode)' != '0'" Importance="high" />
<Exec Command="rdfind -makehardlinks true -makeresultsfile false '$(RedistLayoutPath)'" Condition="'$(RdFindInfoExitCode)' == '0'" />
</Target>
<Target Name="GenerateLayout"
DependsOnTargets="DownloadBundledComponents;
CleanLayoutPath;
@ -566,7 +593,8 @@
RetargetTools;
CrossgenLayout;
LayoutAppHostTemplate;
GeneratePrecomputedRarCache"
GeneratePrecomputedRarCache;
ReplaceDuplicateFilesWithHardLinks"
BeforeTargets="AfterBuild">
</Target>