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

Add mechanism to restore RID-specific intermediate nupkgs #1722

Closed dagood closed 4 years ago

dagood commented 4 years ago

When building a tarball with arcade-powered source-build, we have to build at least a linux-x64 and osx-x64 tarball to validate what we aim to support. In practice, we also have to build intermediate nupkgs for non-portable RIDs like fedora.32-x64, ubuntu.20.04-x64, etc., because the non-portable infra can also be brittle and we want to validate that.

However, many repos build only managed code. If we assume that testing on a single platform (a Linux distro) is sufficient, then we can just build that once and use the same intermediate nupkg for all builds.

The problem is: how does a downstream repo know if its upstream is managed-only or not? This info is required to calculate the right ID for the intermediate nuget package.

We should encode this in Version.Details.xml and read it during intermediate nupkg restore. Right now we have an element that we can change to include this (nobody uses this schema yet):

    <Dependency Name="Microsoft.NETCore.ILAsm" Version="5.0.0-preview.4.20202.18">
      <Uri>https://github.com/dotnet/runtime</Uri>
      <Sha>0375524a91a47ca4db3ee1be548f74bab7e26e76</Sha>
-      <SourceBuildRepoName>runtime</SourceBuildRepoName>
+      <SourceBuild RepoName="runtime" />
     </Dependency>
     <Dependency Name="Foo" Version="5.0.0-preview.4.20202.18">
       <Uri>https://github.com/dotnet/sdk</Uri>
       <Sha>abcdef123</Sha>
-      <SourceBuildRepoName>sdk</SourceBuildRepoName>
+      <SourceBuild RepoName="sdk" ManagedOnly="true" />
     </Dependency>

We could teach Darc/BAR to auto-update this value. But I don't see why this value would flip routinely (if at all), so I don't think we should bother with that as part of the initial work.

/cc @dseefeld @crummel

dagood commented 4 years ago

Capability implemented by https://github.com/dotnet/arcade/pull/6197. It hasn't been particularly well validated through real usage, but we can handle any problems that come up as new issues.