Skip to content

Commit 2a9c271

Browse files
authored
Use the BaseOS property as the "portable" rid for building installers (#44800)
1 parent 83c542b commit 2a9c271

6 files changed

+61
-17
lines changed

src/SourceBuild/content/repo-projects/Directory.Build.props

+1-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@
126126
<ItemGroup>
127127
<!-- TODO: Remove once net10.0 migration is complete -->
128128
<EnvironmentVariables Include="SuppressTfmSupportBuildWarnings=True" />
129-
129+
130130
<!-- Arcade tools.sh picks up DotNetCoreSdkDir, but we can pass DOTNET_INSTALL_DIR directly. -->
131131
<EnvironmentVariables Include="DOTNET_INSTALL_DIR=$(DotNetRoot)" />
132132
<EnvironmentVariables Include="DOTNET_PATH=$(DotNetRoot)" />

src/SourceBuild/content/repo-projects/Directory.Build.targets

+10
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,16 @@
2020
<BuildArgs>$(BuildArgs) /p:SourceBuiltShippingPackagesDir=$(RepoArtifactsShippingPackagesDir)</BuildArgs>
2121
<!-- Trim the trailing slash as it breaks argument parsing on Windows if this is the last argument. -->
2222
<BuildArgs>$(BuildArgs) /p:SourceBuiltNonShippingPackagesDir=$(RepoArtifactsNonShippingPackagesDir.TrimEnd('\'))</BuildArgs>
23+
24+
<!-- Pass RID and Portable/non-portable information -->
25+
<_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
26+
<RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
27+
28+
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
29+
<BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))-$(TargetArchitecture)</BaseOS>
30+
<BuildArgs>$(BuildArgs) /p:PortableBuild=$(PortableBuild)</BuildArgs>
31+
<BuildArgs Condition="'$(ShortStack)' != 'true' and '$(TargetOS)' != 'linux-musl'">$(BuildArgs) /p:RuntimeOS=$(RuntimeOS)</BuildArgs>
32+
<BuildArgs Condition="'$(ShortStack)' != 'true' and '$(TargetOS)' != 'linux-musl'">$(BuildArgs) /p:BaseOS=$(BaseOS)</BuildArgs>
2333
</PropertyGroup>
2434

2535
<PropertyGroup>

src/SourceBuild/content/repo-projects/aspnetcore.proj

-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
</PropertyGroup>
2121

2222
<PropertyGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
23-
<BuildArgs>$(BuildArgs) /p:PortableBuild=$(PortableBuild)</BuildArgs>
2423
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)no-build-repo-tasks</BuildArgs>
2524
</PropertyGroup>
2625

src/SourceBuild/content/repo-projects/runtime.proj

+1-15
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,20 @@
33
<PropertyGroup>
44
<LogVerbosityOptOut>true</LogVerbosityOptOut>
55

6-
<_platformIndex>$(NETCoreSdkRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
7-
<RuntimeOS>$(NETCoreSdkRuntimeIdentifier.Substring(0, $(_platformIndex)))</RuntimeOS>
8-
9-
<_platformIndex>$(NETCoreSdkPortableRuntimeIdentifier.LastIndexOf('-'))</_platformIndex>
10-
<BaseOS>$(NETCoreSdkPortableRuntimeIdentifier.Substring(0, $(_platformIndex)))-$(TargetArchitecture)</BaseOS>
11-
126
<!-- Use the repo root build script -->
137
<BuildScript>$(ProjectDirectory)build$(ShellExtension)</BuildScript>
148

159
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)arch $(TargetArchitecture)</BuildArgs>
1610
<BuildArgs>$(BuildArgs) $(FlagParameterPrefix)os $(TargetOS)</BuildArgs>
1711
<BuildArgs>$(BuildArgs) /p:TargetRid=$(TargetRid)</BuildArgs>
18-
<BuildArgs>$(BuildArgs) /p:PortableBuild=$(PortableBuild)</BuildArgs>
19-
<BuildArgs Condition="'$(ShortStack)' != 'true' and '$(TargetOS)' != 'linux-musl'">$(BuildArgs) /p:RuntimeOS=$(RuntimeOS)</BuildArgs>
20-
<BuildArgs Condition="'$(ShortStack)' != 'true' and '$(TargetOS)' != 'linux-musl'">$(BuildArgs) /p:BaseOS=$(BaseOS)</BuildArgs>
2112
<BuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(BuildArgs) /p:DotNetBuildRuntimeWasmEnableThreads=true</BuildArgs>
2213
<BuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">$(BuildArgs) /p:DotNetBuildRuntimeNativeAOTRuntimePack=true</BuildArgs>
2314
<BuildArgs Condition="'$(DotNetBuildMonoEnableLLVM)' != ''">$(BuildArgs) /p:DotNetBuildMonoEnableLLVM=$(DotNetBuildMonoEnableLLVM)</BuildArgs>
2415
<BuildArgs Condition="'$(DotNetBuildMonoAOTEnableLLVM)' != ''">$(BuildArgs) /p:DotNetBuildMonoAOTEnableLLVM=$(DotNetBuildMonoAOTEnableLLVM)</BuildArgs>
2516
<BuildArgs Condition="'$(DotNetBuildMonoBundleLLVMOptimizer)' != ''">$(BuildArgs) /p:DotNetBuildMonoBundleLLVMOptimizer=$(DotNetBuildMonoBundleLLVMOptimizer)</BuildArgs>
2617
<BuildArgs Condition="'$(PgoInstrument)' == 'true'">$(BuildArgs) $(FlagParameterPrefix)pgoinstrument</BuildArgs>
2718
<BuildArgs Condition="'$(UseSystemLibs)' != ''">$(BuildArgs) /p:UseSystemLibs=$(UseSystemLibs)</BuildArgs>
28-
19+
2920
<!-- Needed until https://github.com/dotnet/runtime/issues/109329 is fixed. -->
3021
<BuildArgs>$(BuildArgs) /p:NetCoreAppToolCurrentVersion=10.0</BuildArgs>
3122
</PropertyGroup>
@@ -34,11 +25,6 @@
3425
<BuildArgs>$(BuildArgs) /p:UsingToolMicrosoftNetCompilers=false</BuildArgs>
3526
</PropertyGroup>
3627

37-
<ItemGroup Condition="'$(DotNetBuildSourceOnly)' == 'true'">
38-
<!-- temporary workaround for https://github.com/dotnet/source-build/issues/4728 -->
39-
<EnvironmentVariables Include="InstallerRuntimeIdentifier=linux-$(TargetArchitecture)" />
40-
</ItemGroup>
41-
4228
<ItemGroup>
4329
<RepositoryReference Include="arcade" />
4430
<RepositoryReference Include="cecil" />
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
From caf86fe9338fb779512cd8295b15df8f7bc88d12 Mon Sep 17 00:00:00 2001
2+
From: Jeremy Koritzinsky <[email protected]>
3+
Date: Mon, 11 Nov 2024 11:11:48 -0800
4+
Subject: [PATCH] Fall-back to the portable parent RID for the installer RID
5+
for non-portable builds.
6+
7+
Backport: https://github.com/dotnet/arcade/pull/15237
8+
---
9+
.../build/installer.targets | 2 ++
10+
1 file changed, 2 insertions(+)
11+
12+
diff --git a/src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.targets b/src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.targets
13+
index 2bb8687ae9c..a48fcf4e3f6 100644
14+
--- a/src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.targets
15+
+++ b/src/Microsoft.DotNet.Build.Tasks.Installers/build/installer.targets
16+
@@ -149,6 +149,8 @@
17+
<PropertyGroup>
18+
<InstallerRuntimeIdentifiers Condition="'$(InstallerRuntimeIdentifiers)' == ''">$(RuntimeIdentifiers)</InstallerRuntimeIdentifiers>
19+
<InstallerRuntimeIdentifier Condition="'$(InstallerRuntimeIdentifier)' == ''">$(RuntimeIdentifier)</InstallerRuntimeIdentifier>
20+
+ <!-- When building a non-portable build, BaseOS specifies a known (portable) RID that is a parent of the curent runtime identifier. -->
21+
+ <InstallerRuntimeIdentifier Condition="'$(PortableBuild)' != 'true' and '$(BaseOS)' != '$(RuntimeIdentifier)'">$(BaseOS)</InstallerRuntimeIdentifier>
22+
</PropertyGroup>
23+
24+
<Import Project="$(MSBuildThisFileDirectory)installer.singlerid.targets"
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From 6d0bb3e7357226db58b6514c8de5a324f36df023 Mon Sep 17 00:00:00 2001
2+
From: Jeremy Koritzinsky <[email protected]>
3+
Date: Mon, 11 Nov 2024 11:12:47 -0800
4+
Subject: [PATCH] Pass BaseOS property down to the inner build as well
5+
6+
This will be used by dotnet/arcade#15237
7+
8+
Backport: https://github.com/dotnet/runtime/pull/109705
9+
---
10+
eng/DotNetBuild.props | 2 +-
11+
1 file changed, 1 insertion(+), 1 deletion(-)
12+
13+
diff --git a/eng/DotNetBuild.props b/eng/DotNetBuild.props
14+
index a202a1bfd723e..a1a8affb5cd6e 100644
15+
--- a/eng/DotNetBuild.props
16+
+++ b/eng/DotNetBuild.props
17+
@@ -62,7 +62,7 @@
18+
<InnerBuildArgs Condition="'$(RuntimeOS)' != ''">$(InnerBuildArgs) /p:PackageOS=$(RuntimeOS) /p:ToolsOS=$(RuntimeOS)</InnerBuildArgs>
19+
<!-- BaseOS is an expected known rid in the graph that TargetRid is compatible with.
20+
It's used to add TargetRid in the graph if the parent can't be detected. -->
21+
- <InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS)</InnerBuildArgs>
22+
+ <InnerBuildArgs>$(InnerBuildArgs) /p:AdditionalRuntimeIdentifierParent=$(BaseOS) /p:BaseOS=$(BaseOS)</InnerBuildArgs>
23+
<!-- Pass through special build modes controlled by properties -->
24+
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeWasmEnableThreads)' == 'true'">$(InnerBuildArgs) /p:WasmEnableThreads=true</InnerBuildArgs>
25+
<InnerBuildArgs Condition="'$(DotNetBuildRuntimeNativeAOTRuntimePack)' == 'true'">$(InnerBuildArgs) $(FlagParameterPrefix)s clr.nativeaotlibs+clr.nativeaotruntime+libs+packs /p:BuildNativeAOTRuntimePack=true /p:SkipLibrariesNativeRuntimePackages=true</InnerBuildArgs>

0 commit comments

Comments
 (0)