Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move BuildRID lists to common props #55279

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 37 additions & 4 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,10 @@

<_runtimeOS Condition="$(_runtimeOS.StartsWith('tizen'))">linux</_runtimeOS>
<_runtimeOS Condition="'$(PortableBuild)' == 'true'">$(_portableOS)</_runtimeOS>

<_packageOS Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)</_packageOS>
<_packageOS Condition="'$(_packageOS)' == '' and '$(PortableBuild)' == 'true'">$(_portableOS)</_packageOS>
<_packageOS Condition="'$(_packageOS)' == ''">$(_runtimeOS)</_packageOS>
</PropertyGroup>

<PropertyGroup Label="CalculateRID">
Expand All @@ -158,15 +162,44 @@
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(PortableBuild)' != 'true' and '$(_portableOS)' == 'linux'">linux-$(_hostArch)</MicrosoftNetCoreIlasmPackageRuntimeId>
<MicrosoftNetCoreIlasmPackageRuntimeId Condition="'$(MicrosoftNetCoreIlasmPackageRuntimeId)' == ''">$(_toolRuntimeRID)</MicrosoftNetCoreIlasmPackageRuntimeId>

<_packageRID Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</_packageRID>
<_packageRID Condition="'$(CrossBuild)' == 'true'">$(_hostOS.ToLowerInvariant)-$(TargetArchitecture)</_packageRID>
<PackageRID Condition="'$(PackageRID)' == ''">$(_packageRID)</PackageRID>
<PackageRID Condition="'$(PackageRID)' == ''">$(_runtimeOS)-$(TargetArchitecture)</PackageRID>
<PackageRID>$(_packageOS)-$(TargetArchitecture)</PackageRID>

<!-- Crossgen2 does not support armel, so we will use arm instead. -->
<Crossgen2PackageRID Condition="'$(TargetArchitecture)' == 'armel'">$(_packageOS)-arm</Crossgen2PackageRID>
<Crossgen2PackageRID Condition="'$(TargetArchitecture)' != 'armel'">$(PackageRID)</Crossgen2PackageRID>

<OutputRid Condition="'$(OutputRid)' == ''">$(PackageRID)</OutputRid>
<OutputRid Condition="'$(PortableBuild)' == 'true'">$(_portableOS)-$(TargetArchitecture)</OutputRid>
</PropertyGroup>

<ItemGroup Label="CalculateRIDLists" Condition="'$(RequiresBuildRid)' == 'true'">
<BuildRID Include="linux-arm" Platform="arm" />
<BuildRID Include="linux-arm64" Platform="arm64" />
<BuildRID Include="linux-musl-arm" Platform="arm" />
<BuildRID Include="linux-musl-arm64" Platform="arm64" />
<BuildRID Include="linux-musl-x64" Platform="amd64" />
<BuildRID Include="linux-x64" Platform="amd64" />
<BuildRID Include="osx-x64" Platform="amd64" />
<BuildRID Include="rhel.6-x64" Platform="amd64" />
<BuildRID Include="win-arm" Platform="arm" />
<BuildRID Include="win-arm64" Platform="arm64" />
<BuildRID Include="win-x86" Platform="x86" />
<BuildRID Include="win-x64" Platform="amd64" />

<!-- platforms which are not officially supported -->
<BuildRID Include="freebsd-x64" Platform="amd64" ExcludeFromPlatformManifest="true" />
<BuildRID Include="illumos-x64" Platform="amd64" ExcludeFromPlatformManifest="true" />
<BuildRID Include="netbsd-x64" Platform="amd64" ExcludeFromPlatformManifest="true" />
<BuildRID Include="solaris-x64" Platform="amd64" ExcludeFromPlatformManifest="true" />
<BuildRID Include="tizen.4.0.0-armel" Platform="armel" ExcludeFromPlatformManifest="true" />
<BuildRID Include="tizen.5.0.0-armel" Platform="armel" ExcludeFromPlatformManifest="true" />

<BuildRid Remove="$(ExcludeFromBuildRID)" Condition="'$(ExcludeFromBuildRID)' != ''" />

<RestoreBuildRID Include="@(BuildRID)" Exclude="@(BuildRID->HasMetadata('ExcludeFromPlatformManifest'))" />
<RestoreBuildRID Remove="$(ExcludeFromBuildRID)" Condition="'$(ExcludeFromBuildRID)' != ''" />
</ItemGroup>

<PropertyGroup Label="CalculateTargetOSName" Condition="'$(SkipInferTargetOSName)' != 'true'">
<TargetsFreeBSD Condition="'$(TargetOS)' == 'FreeBSD'">true</TargetsFreeBSD>
<Targetsillumos Condition="'$(TargetOS)' == 'illumos'">true</Targetsillumos>
Expand Down
85 changes: 4 additions & 81 deletions src/coreclr/.nuget/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<Project>
<PropertyGroup>
<RequiresBuildRid>true</RequiresBuildRid>
</PropertyGroup>

<!-- Packaging projects (.pkgproj) are non-SDK-style, so they need to directly import Directory.Build.props -->
<Import Project="..\Directory.Build.props" />
<Import Project="$(NuGetPackageRoot)\microsoft.dotnet.build.tasks.packaging\$(MicrosoftDotNetBuildTasksPackagingVersion)\build\Microsoft.DotNet.Build.Tasks.Packaging.props" />
Expand Down Expand Up @@ -34,28 +38,8 @@

<!-- indicates that lib prefix is not added to library names for Unix-like operating systems -->
<SkipLibraryPrefixFromUnix>true</SkipLibraryPrefixFromUnix>

<SupportedPackageOSGroups Condition="'$(SupportedPackageOSGroups)' == ''">windows;OSX;Android;Linux;FreeBSD;NetBSD;illumos;Solaris</SupportedPackageOSGroups>
<SupportedPackageOSGroups>;$(SupportedPackageOSGroups);</SupportedPackageOSGroups>

<_isSupportedOSGroup>true</_isSupportedOSGroup>
</PropertyGroup>

<!-- derive an OS Group based on the OS Family -->
<PropertyGroup>
<_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == '' and '$(TargetOS)' != ''">$(TargetOS)</_derivedPackageTargetOSGroup>
<_derivedPackageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == ''">Linux</_derivedPackageTargetOSGroup>

<_isSupportedOSGroup Condition="!$(SupportedPackageOSGroups.Contains(';$(_derivedPackageTargetOSGroup);'))">false</_isSupportedOSGroup>
</PropertyGroup>

<!-- _packageTargetOSGroup is used to control the runtime package imports, don't import runtime package targets for
an unsupported OS Group -->
<PropertyGroup Condition="'$(PackageTargetRuntime)' != '' and '$(_isSupportedOSGroup)' == 'true'">
<!-- Android will use Linux package definitions -->
<_packageTargetOSGroup>$(_derivedPackageTargetOSGroup)</_packageTargetOSGroup>
<_packageTargetOSGroup Condition="'$(_derivedPackageTargetOSGroup)' == 'Android'">Linux</_packageTargetOSGroup>
</PropertyGroup>
<PropertyGroup>
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<OutputPath>$(PackageOutputPath)</OutputPath>
Expand All @@ -66,67 +50,6 @@
<IncludeRuntimeJson>true</IncludeRuntimeJson>
</PropertyGroup>

<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Linux;'))">
<OfficialBuildRID Include="linux-x64" />
<OfficialBuildRID Include="linux-musl-x64" />
<OfficialBuildRID Include="rhel.6-x64" />
<OfficialBuildRID Include="linux-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="linux-musl-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="linux-arm64">
<Platform>arm64</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="linux-musl-arm64">
<Platform>arm64</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="tizen.4.0.0-armel">
<Platform>armel</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="tizen.5.0.0-armel">
<Platform>armel</Platform>
</OfficialBuildRID>
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';OSX;'))">
<OfficialBuildRID Include="osx-x64" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this is why we didn't have arm64 ILAsm

</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';FreeBSD;'))">
<OfficialBuildRID Include="freebsd-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';NetBSD;'))">
<OfficialBuildRID Include="netbsd-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';illumos;'))">
<OfficialBuildRID Include="illumos-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';Solaris;'))">
<OfficialBuildRID Include="solaris-x64" />
</ItemGroup>
<ItemGroup Condition="$(SupportedPackageOSGroups.Contains(';windows;'))">
<OfficialBuildRID Include="win-x86">
<Platform>x86</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="win-x64" />
<OfficialBuildRID Include="win-arm">
<Platform>arm</Platform>
</OfficialBuildRID>
<OfficialBuildRID Include="win-arm64">
<Platform>arm64</Platform>
</OfficialBuildRID>
</ItemGroup>
<ItemGroup>
<!-- Ensure we have a RID-specific package for the current build, even if it isn't in our official set, but
don't build the RID-specific package if we're in an unsupported os family -->
<BuildRID Include="@(OfficialBuildRID)" Exclude="$(OutputRid)"/>
<BuildRID Include="$(OutputRid)"
Condition="'$(_isSupportedOSGroup)' == 'true'">
<Platform Condition="'$(TargetArchitecture)' == 'x64'">amd64</Platform>
<Platform Condition="'$(TargetArchitecture)' != 'x64'">$(TargetArchitecture)</Platform>
</BuildRID>
</ItemGroup>

<ItemGroup>
<_project Include="@(BuildRID)">
<Platform Condition="'%(Platform)' == ''">amd64</Platform>
Expand Down
5 changes: 1 addition & 4 deletions src/coreclr/tools/aot/crossgen2/crossgen2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,7 @@
<!-- The default value for macOS is false -->
<UseAppHost>true</UseAppHost>

<TargetArchitectureAppHost>$(TargetArchitecture)</TargetArchitectureAppHost>
<TargetArchitectureAppHost Condition="'$(TargetArchitectureAppHost)'=='armel'">arm</TargetArchitectureAppHost>

<AppHostRuntimeIdentifier>$(PackageRID)</AppHostRuntimeIdentifier>
<AppHostRuntimeIdentifier>$(Crossgen2PackageRID)</AppHostRuntimeIdentifier>
</PropertyGroup>
<Import Project="crossgen2.props" />
</Project>
25 changes: 4 additions & 21 deletions src/installer/pkg/projects/Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
<Project>
<PropertyGroup>
<RequiresBuildRid>true</RequiresBuildRid>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props, $(MSBuildThisFileDirectory)..))" />

<PropertyGroup>
Expand Down Expand Up @@ -64,27 +68,6 @@
<TargetFramework Condition="'$(TargetFramework)' == ''">$(NetCoreAppCurrent)</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<RIDPropsFile Condition="'$(RIDPropsFile)' == ''">$(MSBuildThisFileDirectory)\netcoreappRIDs.props</RIDPropsFile>
</PropertyGroup>

<Import Project="$(RIDPropsFile)" />

<ItemGroup>
<_buildingOnRID Include="$(PackageRID)" Condition="'$(BuildOnUnknownPlatforms)' != 'false'">
<Platform>$(Platform)</Platform>
</_buildingOnRID>
<!-- Ensure we have a RID-specific package for the current build, even if it isn't in our official set -->
<BuildRID Include="@(OfficialBuildRID)" Exclude="@(_buildingOnRID)"/>
<!-- Include Unofficial Build RIDs in runtime.json's but do not include in the platform manifest -->
<BuildRID Include="@(UnofficialBuildRID)" Exclude="@(_buildingOnRID)">
<ExcludeFromPlatformManifest>true</ExcludeFromPlatformManifest>
</BuildRID>
<BuildRID Include="@(_buildingOnRID)"/>

<RestoreBuildRID Include="@(BuildRID)" Exclude="@(UnofficialBuildRID)" />
</ItemGroup>

<PropertyGroup>
<!--
By default, lineup and runtime packages are built by the same project. Allow overriding so
Expand Down
50 changes: 0 additions & 50 deletions src/installer/pkg/projects/netcoreappRIDs.props

This file was deleted.

14 changes: 0 additions & 14 deletions src/libraries/pkg/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,6 @@
<HarvestStablePackage>false</HarvestStablePackage>
</PropertyGroup>

<!-- Packages opt-in to automatic RID-specific builds by placing a *.RID.props next to their project
that defines the OfficialBuildRID item: all RIDs targeted by the package -->
<Import Project="$(MSBuildProjectDirectory)\*.rids.props" Condition="'$(BuildingAnOfficialBuildLeg)' != 'true' or '$(RuntimeFlavor)' != 'Mono'"/>

<!-- create the "BuildRID" item which is the set of all supported RIDs, with metadata.
We'll add a RID for the current platform even if it isn't in the officially supported set -->
<ItemGroup Condition="'@(OfficialBuildRID)' != ''">
<BuildRID Include="@(OfficialBuildRID)" Exclude="$(OutputRid)"/>
<BuildRID Include="$(OutputRid)">
<Platform Condition="'$(TargetArchitecture)' == 'x64'">amd64</Platform>
<Platform Condition="'$(TargetArchitecture)' != 'x64'">$(TargetArchitecture)</Platform>
</BuildRID>
</ItemGroup>

<!-- create the "Project" item which is the current $(MSBuildProjectName).pkgproj with meta-data for all
supported RIDs -->
<ItemGroup>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<SkipPackageFileCheck>true</SkipPackageFileCheck>
<SkipValidatePackage>true</SkipValidatePackage>
</PropertyGroup>
<ItemGroup Condition="'$(PackageTargetRuntime)' == 'linux-arm' or '$(PackageTargetRuntime)' == 'linux-arm64' or '$(PackageTargetRuntime)' == 'linux-x64' or '$(PackageTargetRuntime)' == 'osx-x64' or '$(PackageTargetRuntime)' == 'freebsd-x64'">
<ItemGroup Condition="'$(PackageTargetRuntime)' != '' and !$(PackageTargetRuntime.ToLowerInvariant.StartsWith('win'))">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This somehow didn't consider ARM64 before. It also now considers linux-musl variants when it didn't before.

Copy link
Member Author

@am11 am11 Jul 10, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ARM64 is present before and after the change. linux-musl is not (that restriction does not seem intentional either). I think this is not causing the validation error. I think the issue is that we have three ways of including pkgproj, one from src/libraries/libraries-packages, one from .proj file and then again from Directory.Build.props. We should try to simplify it, so transition to SDK/dotnet-pack in future become easier.

In this PR, I have changed complex whitelisting to "require a flat list and exclude" mechanism.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

osx-arm64 I mean

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not saying I am against it. I am just saying we might start seeing assets we didn't see before. I'll all for a single list of support and then projects that need can opt out.

<File Include="$(NativeBinDir)$(LibPrefix)System.IO.Ports.Native$(LibSuffix)" >
<TargetPath>runtimes/$(OutputRid)/native</TargetPath>
</File>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
<Project DefaultTargets="Build">
<PropertyGroup>
<RequiresBuildRid Condition="'$(RuntimeFlavor)' != 'Mono'">true</RequiresBuildRid>
<ExcludeFromBuildRID>win*</ExcludeFromBuildRID>
</PropertyGroup>

<Import Project="$([MSBuild]::GetPathOfFileAbove(Directory.Build.props))" />

<ItemGroup Condition="'$(BuildAllConfigurations)' == 'true'">
<!-- identity project built in AllConfigurations leg, runtime specific projects are included through netcoreapp.rids.props -->
<!-- identity project built in AllConfigurations leg -->
<Project Include="$(MSBuildProjectName).pkgproj" />
</ItemGroup>

Expand Down
7 changes: 0 additions & 7 deletions src/tests/Common/publishdependency.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
</TestTargetFramework>
</ItemGroup>

<PropertyGroup>
<PackagePlatform Condition="'$(PackagePlatform)' == ''">$(TargetArchitecture)</PackagePlatform>
<MinOSForArch>win7</MinOSForArch>
<MinOSForArch Condition="'$(PackagePlatform)' == 'arm'">win8</MinOSForArch>
<MinOSForArch Condition="'$(PackagePlatform)' == 'arm64'">win10</MinOSForArch>
</PropertyGroup>

<ItemGroup>
<!-- These projects are individually restored in order. Each
subsequent restore only copies files that don't already exist
Expand Down