dotnet / source-build

A repository to track efforts to produce a source tarball of the .NET Core SDK and all its components
MIT License
266 stars 132 forks source link

Prep bootstrap logic should only pull packages for current rid by default #3631

Open MichaelSimons opened 1 year ago

MichaelSimons commented 1 year ago

The prep bootstrap logic currently pulls packages for a variety of RIDs

    <LinuxRid Include="linux-x64" />
    <LinuxRid Include="linux-musl-x64" />
    <LinuxRid Include="linux-arm64" />
    <LinuxRid Include="linux-musl-arm64" />

This list is continually growing. It is unnecessary/wasteful to pull all of these artifacts except for the one applicable for the current platform. The logic should be updated appropriately to pull packages for a single RID.

When fixing, please consider whether this should be the only behavior or if other options should be supported. e.g. it maybe useful from a testing perspective to be able to pull all rids to ensure packages exist. Today we don't run a linux-musl-arm64 leg in CI.

directhex commented 1 year ago

Longer term, every system-dependent dependency needs to consider the cross-compiler case, i.e. "do I want the package for $BUILD, $HOST or $TARGET. In this case, we care about ilasm/ildasm for $BUILD, but there are cases where we care about $HOST or $TARGET or some combination of the above.

Consider how Mariner is always running on x64 Linux, but building for arm64, musl, etc etc etc. Or we do our osx-arm64/windows-arm64 builds on x64 VMs.

directhex commented 1 year ago

https://github.com/dotnet/emsdk/blob/main/eng/emsdk.proj#L17 is how I do that logic in emsdk - depend on the BuildArchitecture package, depend on the TargetArchitecture package, and bounce the whole PackageReference ItemGroup through a temporary second ItemGroup, using ->Distinct(), to eliminate the native-build case (the same dependency twice breaks things)