dotnet / source-build

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

aspnetcore GenerateFiles.csproj uses global package dir #4444

Open corngood opened 1 month ago

corngood commented 1 month ago

In 9.0.0-preview.4, I noticed that this explicit restore operation:

https://github.com/dotnet/dotnet/blob/7b92d4092abc8b04f79a9412a712257966724494/src/aspnetcore/eng/Tools.props#L7

uses $HOME/.packages. This seems like it's probably unintentional. Adding the following causes it to use the inner source build package cache, which is what I would expect it to do:

        Properties="NUGET_PACKAGES='$(CurrentRepoSourceBuildPackageCache)'"
dotnet-issue-labeler[bot] commented 1 month ago

I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label.

MichaelSimons commented 1 month ago

[Triage] @corngood - can you help us understand what the impact of this is?

corngood commented 1 month ago

In nixpkgs we use the per-repo package cache dirs to enumerate dependencies.

We could also look at the default package dir in $HOME, but this just seemed like an oversight, because everything else seems to use CurrentRepoSourceBuildPackageCache.

Here's an example of a similar issue: https://github.com/dotnet/source-build/issues/4293

In that case it was using .packages in the VMR root, rather than $HOME.

MichaelSimons commented 1 week ago

@wtgodbe - Is this something you can take a look at?

wtgodbe commented 5 days ago

Sure, is the ask to just set the package cache correctly when in source build? I don't fully understand why this restore operation is "special", how do repos normally set the packages root in the source build context?