Skip to content

Commit 4e1ad9c

Browse files
authored
Pass RID to msbuild task (#103508)
1 parent a54d9e9 commit 4e1ad9c

File tree

5 files changed

+23
-44
lines changed

5 files changed

+23
-44
lines changed

eng/Subsets.props

+7-1
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,8 @@
121121
<!-- CLR NativeAot only builds in a subset of the matrix -->
122122
<_NativeAotSupportedOS Condition="'$(TargetOS)' == 'windows' or '$(TargetOS)' == 'linux' or '$(TargetOS)' == 'osx' or '$(TargetOS)' == 'maccatalyst' or '$(TargetOS)' == 'iossimulator' or '$(TargetOS)' == 'ios' or '$(TargetOS)' == 'tvossimulator' or '$(TargetOS)' == 'tvos' or '$(TargetOS)' == 'freebsd'">true</_NativeAotSupportedOS>
123123
<_NativeAotSupportedArch Condition="'$(TargetArchitecture)' == 'x64' or '$(TargetArchitecture)' == 'arm64' or '$(TargetArchitecture)' == 'arm' or ('$(TargetOS)' == 'windows' and '$(TargetArchitecture)' == 'x86')">true</_NativeAotSupportedArch>
124-
<NativeAotSupported Condition="'$(_NativeAotSupportedOS)' == 'true' and $(_NativeAotSupportedArch) == 'true'">true</NativeAotSupported>
124+
<NativeAotSupported Condition="'$(_NativeAotSupportedOS)' == 'true' and '$(_NativeAotSupportedArch)' == 'true'">true</NativeAotSupported>
125+
<UseNativeAotForComponents Condition="'$(NativeAotSupported)' == 'true' and '$(TargetOS)' == '$(HostOS)' and ('$(TargetOS)' != 'windows' or '$(TargetArchitecture)' != 'x86') and '$(TargetsLinuxBionic)' != 'true' and ('$(TargetsLinuxMusl)' != 'true' or '$(TargetArchitecture)' != 'arm')">true</UseNativeAotForComponents>
125126

126127
<!-- If we're building clr.nativeaotlibs and not building the CLR runtime, compile libraries against NativeAOT CoreLib -->
127128
<UseNativeAotCoreLib Condition="'$(TestNativeAot)' == 'true' or ($(_subset.Contains('+clr.nativeaotlibs+')) and !$(_subset.Contains('+clr.native+')) and !$(_subset.Contains('+clr.runtime+')) and !$(_subset.Contains('+clr.corelib+')))">true</UseNativeAotCoreLib>
@@ -286,7 +287,12 @@
286287
AdditionalProperties="%(AdditionalProperties);
287288
ClrCrossComponentsSubset=true;
288289
HostArchitecture=$(BuildArchitecture);
290+
TargetArchitecture=$(TargetArchitecture);
289291
HostCrossOS=$(HostOS);
292+
HostOS=$(HostOS);
293+
TargetOS=$(TargetOS);
294+
RuntimeIdentifier=$(RuntimeIdentifier);
295+
NETCoreSdkPortableRuntimeIdentifier=$(NETCoreSdkPortableRuntimeIdentifier);
290296
PgoInstrument=false;
291297
NoPgoOptimize=true;
292298
CrossBuild=false;

src/coreclr/tools/aot/ILCompiler/ILCompiler.csproj

+9-14
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,15 @@
1010
<!-- BEGIN: Workaround for https://github.com/dotnet/runtime/issues/67742 -->
1111
<PropertyGroup Condition="'$(BuildingInsideVisualStudio)' != 'true'">
1212
<PublishDir>$(RuntimeBinDir)ilc-published/</PublishDir>
13-
<NativeAotSupported Condition="$(OutputRID.StartsWith('tizen')) == 'true'">false</NativeAotSupported>
14-
<NativeAotSupported Condition="$(OutputRID.EndsWith('-arm')) == 'true'">false</NativeAotSupported>
15-
<NativeAotSupported Condition="$(OutputRID.EndsWith('-x86')) == 'true'">false</NativeAotSupported>
16-
<!-- Disable native AOT on FreeBSD when cross building from Linux. -->
17-
<NativeAotSupported Condition="'$(TargetOS)' == 'freebsd' and '$(CrossBuild)' == 'true'">false</NativeAotSupported>
18-
<PublishAot Condition="'$(NativeAotSupported)' == 'true'">true</PublishAot>
19-
<SysRoot Condition="'$(NativeAotSupported)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
20-
<PublishReadyToRun Condition="'$(NativeAotSupported)' != 'true'">true</PublishReadyToRun>
21-
<PublishSingleFile Condition="'$(NativeAotSupported)' != 'true'">true</PublishSingleFile>
22-
<PublishTrimmed Condition="'$(NativeAotSupported)' != 'true'">true</PublishTrimmed>
13+
<PublishAot Condition="'$(UseNativeAotForComponents)' == 'true'">true</PublishAot>
14+
<SysRoot Condition="'$(UseNativeAotForComponents)' == 'true' and '$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
15+
<PublishReadyToRun Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishReadyToRun>
16+
<PublishSingleFile Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishSingleFile>
17+
<PublishTrimmed Condition="'$(UseNativeAotForComponents)' != 'true'">true</PublishTrimmed>
2318
<SuppressGenerateILCompilerExplicitPackageReferenceWarning>true</SuppressGenerateILCompilerExplicitPackageReferenceWarning>
2419
</PropertyGroup>
2520

26-
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
21+
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
2722
<PackageReference Include="Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
2823
<PackageReference Include="runtime.$(ToolsRID).Microsoft.DotNet.ILCompiler" Version="$(MicrosoftDotNetILCompilerVersion)" />
2924
</ItemGroup>
@@ -53,7 +48,7 @@
5348
</Target>
5449

5550
<Target Name="LocateNativeCompiler"
56-
Condition="'$(NativeAotSupported)' == 'true' and '$(HostOS)' != 'windows'"
51+
Condition="'$(UseNativeAotForComponents)' == 'true' and '$(HostOS)' != 'windows'"
5752
BeforeTargets="SetupOSSpecificProps">
5853
<PropertyGroup>
5954
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>
@@ -75,7 +70,7 @@
7570
<_XcodeVersion>$([System.Text.RegularExpressions.Regex]::Match($(_XcodeVersionString), '[1-9]\d*'))</_XcodeVersion>
7671
</PropertyGroup>
7772

78-
<ItemGroup Condition="'$(NativeAotSupported)' == 'true' and '$(_IsApplePlatform)' == 'true'">
73+
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true' and '$(_IsApplePlatform)' == 'true'">
7974
<CustomLinkerArg Condition="'$(_XcodeVersion)' &gt;= '15'" Include="-ld_classic" />
8075
</ItemGroup>
8176

@@ -86,7 +81,7 @@
8681
</PropertyGroup>
8782
</Target>
8883

89-
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
84+
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
9085
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(BuildArchitecture)' == '$(_targetArchitecture)' and '$(HostOS)' != 'windows' and '$(_IsApplePlatform)' != 'true'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
9186
</ItemGroup>
9287

src/coreclr/tools/aot/crossgen2/crossgen2_publish.csproj

+5-10
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
<Import Project="Sdk.props" Sdk="Microsoft.NET.Sdk" />
88

99
<PropertyGroup>
10-
<NativeAotSupported Condition="$(OutputRID.StartsWith('tizen')) == 'true'">false</NativeAotSupported>
11-
<NativeAotSupported Condition="$(OutputRID.EndsWith('-arm')) == 'true'">false</NativeAotSupported>
12-
<NativeAotSupported Condition="$(OutputRID.EndsWith('-x86')) == 'true'">false</NativeAotSupported>
13-
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
14-
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
1510
<PublishTrimmed>true</PublishTrimmed>
1611
<RuntimeIdentifier>$(PackageRID)</RuntimeIdentifier>
1712
<SelfContained>true</SelfContained>
@@ -21,7 +16,7 @@
2116

2217
<Import Project="crossgen2.props" />
2318

24-
<PropertyGroup Condition="'$(NativeAotSupported)' != 'true'">
19+
<PropertyGroup Condition="'$(UseNativeAotForComponents)' != 'true'">
2520
<PublishSingleFile>true</PublishSingleFile>
2621
<PublishReadyToRun>true</PublishReadyToRun>
2722
<!-- Disable crossgen on NetBSD, illumos, Solaris, and Haiku for now. This can be revisited when we have full support. -->
@@ -41,7 +36,7 @@
4136
<Import Project="$(RepositoryEngineeringDir)targetingpacks.targets" />
4237
<Import Project="$(RepositoryEngineeringDir)codeOptimization.targets" />
4338

44-
<PropertyGroup Condition="'$(NativeAotSupported)' == 'true'">
39+
<PropertyGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
4540
<IlcToolsPath>$(CoreCLRILCompilerDir)</IlcToolsPath>
4641
<IlcToolsPath Condition="'$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)' or '$(EnableNativeSanitizers)' != ''">$(CoreCLRCrossILCompilerDir)</IlcToolsPath>
4742
<SysRoot Condition="('$(CrossBuild)' == 'true' or '$(BuildArchitecture)' != '$(TargetArchitecture)') and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
@@ -58,12 +53,12 @@
5853
<DynamicCodeSupport>false</DynamicCodeSupport>
5954
</PropertyGroup>
6055

61-
<ItemGroup Condition="'$(NativeAotSupported)' == 'true'">
56+
<ItemGroup Condition="'$(UseNativeAotForComponents)' == 'true'">
6257
<CustomLinkerArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_IsApplePlatform)' != 'true' and '$(_hostOS)' != 'windows'" Include="--gcc-toolchain=$(ROOTFS_DIR)/usr" />
6358
</ItemGroup>
6459

6560
<Import Project="$(CoreCLRBuildIntegrationDir)Microsoft.DotNet.ILCompiler.SingleEntry.targets"
66-
Condition="'$(NativeAotSupported)' == 'true'" />
61+
Condition="'$(UseNativeAotForComponents)' == 'true'" />
6762
<Import Project="$(RepositoryEngineeringDir)nativeSanitizers.targets" />
6863

6964
<!-- Needed for the amd64 -> amd64 musl cross-build to pass the target flag. -->
@@ -91,7 +86,7 @@
9186
</Target>
9287

9388
<Target Name="LocateNativeCompiler"
94-
Condition="'$(NativeAotSupported)' == 'true' and '$(HostOS)' != 'windows'"
89+
Condition="'$(UseNativeAotForComponents)' == 'true' and '$(HostOS)' != 'windows'"
9590
BeforeTargets="SetupOSSpecificProps">
9691
<PropertyGroup>
9792
<CppCompilerAndLinker Condition="'$(CppCompilerAndLinker)' == ''">clang</CppCompilerAndLinker>

src/installer/pkg/sfx/Microsoft.NETCore.App/Microsoft.NETCore.App.Crossgen2.sfxproj

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
<PermitDllAndExeFilesLackingFileVersion>true</PermitDllAndExeFilesLackingFileVersion>
1616
<!-- Publishing as single-file or NativeAOT means we can't examine the interior DLLs -->
1717
<ShouldVerifyClosure>false</ShouldVerifyClosure>
18-
<!-- Publish crossgen2 as a single-file app on native-OS builds. Cross-OS NativeAOT compilation is not supported yet -->
19-
<NativeAotSupported Condition="'$(CrossBuild)' == 'true' and '$(TargetOS)' != '$(HostOS)'">false</NativeAotSupported>
2018
</PropertyGroup>
2119

2220
<ItemGroup>

src/native/managed/compile-native.proj

+2-17
Original file line numberDiff line numberDiff line change
@@ -13,26 +13,11 @@
1313
<NativeLibsProjectsToBuild Include="$(MSBuildThisFileDirectory)cdacreader/src/cdacreader.csproj" />
1414
</ItemGroup>
1515

16-
<!-- Decide if we're going to do the NativeAOT builds -->
17-
<PropertyGroup>
18-
<!-- disable on Mono, for now -->
19-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(RuntimeFlavor)' == 'Mono'">false</SupportsNativeAotComponents>
20-
<!-- disable on linux-bionic, for now -->
21-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(TargetsLinuxBionic)' == 'true'">false</SupportsNativeAotComponents>
22-
<!-- NativeAOT doesn't support cross-OS compilation. disable for crossdac-->
23-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(HostOS)' != '$(TargetOS)'">false</SupportsNativeAotComponents>
24-
<!-- unsupported targets -->
25-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and '$(DotNetBuildSourceOnly)' == 'true'">false</SupportsNativeAotComponents>
26-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and ('$(TargetArchitecture)' == 'arm' or '$(TargetArchitecture)' == 'armel' or '$(TargetArchitecture)' == 'x86' or '$(TargetArchitecture)' == 'riscv64')">false</SupportsNativeAotComponents>
27-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == '' and ('$(TargetsWindows)' == 'true' or '$(TargetsOSX)' == 'true' or ('$(TargetsLinux)' == 'true' and '$(TargetsAndroid)' != 'true' and '$(TargetsLinuxMusl)' != 'true'))">true</SupportsNativeAotComponents>
28-
<SupportsNativeAotComponents Condition="'$(SupportsNativeAotComponents)' == ''">false</SupportsNativeAotComponents>
29-
</PropertyGroup>
30-
3116
<!-- some special kinds of runtime builds need extra NativeAOT flags -->
3217
<PropertyGroup>
3318
<SysRoot Condition="'$(CrossBuild)' == 'true' and '$(HostOS)' != 'windows'">$(ROOTFS_DIR)</SysRoot>
3419
<LinkerFlavor Condition="'$(CrossBuild)' == 'true' and '$(TargetsLinux)' == 'true'">lld</LinkerFlavor>
35-
<CustomLinkerArgToolchainArg Condition="'$(CrossBuild)' == 'true' and '$(_hostArchitecture)' == '$(_targetArchitecture)' and '$(_hostOS)' != 'windows'">--gcc-toolchain=$(ROOTFS_DIR)/usr</CustomLinkerArgToolchainArg>
20+
<CustomLinkerArgToolchainArg Condition="'$(CrossBuild)' == 'true' and '$(HostArchitecture)' == '$(TargetArchitecture)' and '$(HostOS)' != 'windows'">--gcc-toolchain=$(ROOTFS_DIR)/usr</CustomLinkerArgToolchainArg>
3621
</PropertyGroup>
3722

3823
<ItemGroup>
@@ -51,6 +36,6 @@
5136
ReferenceOutputAssembly="false"
5237
AdditionalProperties="%(AdditionalProperties);$(SplitSubprojectProps)"
5338
Targets="LinkNative"
54-
Condition="$(SupportsNativeAotComponents)"/>
39+
Condition="'$(UseNativeAotForComponents)' == 'true'"/>
5540
</ItemGroup>
5641
</Project>

0 commit comments

Comments
 (0)