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> <ProduceReferenceAssembly>false</ProduceReferenceAssembly>
<ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent> <ResolveAssemblyReferencesSilent>true</ResolveAssemblyReferencesSilent>
<ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>none</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch> <ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>none</ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch>
<BundleRuntimePacks Condition="'$(BundleRuntimePacks)' == '' And '$(DotNetBuildFromSource)' == 'true'">true</BundleRuntimePacks>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

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

View file

@ -183,6 +183,20 @@
<RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath> <RelativeLayoutPath>packs/%(PackageName)/%(PackageVersion)</RelativeLayoutPath>
</BundledLayoutPackage> </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" <BundledInstallerComponent Include="DownloadedRuntimeDepsInstallerFile"
Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))"> Condition="('$(IsDebianBaseDistro)' == 'true' OR '$(IsRPMBasedDistro)' == 'true') And '$(SkipBuildingInstallers)' != 'true' And '$(InstallerExtension)' != '' And !$(Architecture.StartsWith('arm'))">
<BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl> <BaseUrl>$(CoreSetupRootUrl)$(CoreSetupBlobVersion)</BaseUrl>
@ -550,6 +564,19 @@
<ResolveAssemblyReference AssemblyFiles="@(AssembliesToResolve)" Silent="$(ResolveAssemblyReferencesSilent)" AssemblyInformationCacheOutputPath="$(RedistLayoutPath)sdk\$(Version)\SDKPrecomputedAssemblyReferences.cache" SearchPaths="{RawFileName}" WarnOrErrorOnTargetArchitectureMismatch="$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)" /> <ResolveAssemblyReference AssemblyFiles="@(AssembliesToResolve)" Silent="$(ResolveAssemblyReferencesSilent)" AssemblyInformationCacheOutputPath="$(RedistLayoutPath)sdk\$(Version)\SDKPrecomputedAssemblyReferences.cache" SearchPaths="{RawFileName}" WarnOrErrorOnTargetArchitectureMismatch="$(ResolveAssemblyWarnOrErrorOnTargetArchitectureMismatch)" />
</Target> </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" <Target Name="GenerateLayout"
DependsOnTargets="DownloadBundledComponents; DependsOnTargets="DownloadBundledComponents;
CleanLayoutPath; CleanLayoutPath;
@ -566,7 +593,8 @@
RetargetTools; RetargetTools;
CrossgenLayout; CrossgenLayout;
LayoutAppHostTemplate; LayoutAppHostTemplate;
GeneratePrecomputedRarCache" GeneratePrecomputedRarCache;
ReplaceDuplicateFilesWithHardLinks"
BeforeTargets="AfterBuild"> BeforeTargets="AfterBuild">
</Target> </Target>