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

Use NuGet.config for restore during package testing #53837

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
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
9 changes: 1 addition & 8 deletions src/libraries/pkg/test/packageTest.targets
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,7 @@

<PropertyGroup>
<ToolsDir>$(MSBuildThisFileDirectory)tools\</ToolsDir>

<RestoreSources>
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet-public/nuget/v3/index.json;
https://dotnetfeed.blob.core.windows.net/dotnet-core/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json;
https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6-transport/nuget/v3/index.json;
$(LocalPackagesPath)
</RestoreSources>
<RestoreAdditionalProjectSources>$(LocalPackagesPath)</RestoreAdditionalProjectSources>
Copy link
Member

Choose a reason for hiding this comment

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

nit: why not replace the LocalPackagesPath property with RestoreAdditionalProjectSources?

Copy link
Member

Choose a reason for hiding this comment

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

I think LocalPackagesPath is easier to remember when running package tests locally?

Copy link
Member

@ViktorHofer ViktorHofer Jun 8, 2021

Choose a reason for hiding this comment

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

That property isn't supposed to be passed in by the user. It's already passed in and by default points to the artifacts packages dir:

<TestRestoreCommand>$(TestRestoreCommand) /p:LocalPackagesPath=$(ArtifactsPackagesDir)</TestRestoreCommand>

Copy link
Member

Choose a reason for hiding this comment

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

Good point. For some reason I thought it was for local testing, I forgot we generated the test restore command.

Copy link
Member Author

Choose a reason for hiding this comment

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

Specifying known properties as global properties can make them effectively readonly in the evaluation, which could break other props/targets which were trying to append to them. This was the case with RestoreSources previously. I'm inclined to keep these seperate since it's not the intent of this to specify all additional restore sources, only one that we want to add.


<!-- Make sure the SDK raises the runtime items so that they are passed to conflict resolution -->
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
Expand Down
3 changes: 3 additions & 0 deletions src/libraries/pkg/test/testPackages.proj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@
<TestSupportFiles Include="$(LibrariesProjectRoot)shims\netfxreference.props">
<DestinationFolder>$(TestToolsDir)</DestinationFolder>
</TestSupportFiles>
<TestSupportFiles Include="$(RepoRoot)NuGet.config">
<DestinationFolder>$(TestSupportDir)</DestinationFolder>
Copy link
Member

@ViktorHofer ViktorHofer Jun 8, 2021

Choose a reason for hiding this comment

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

Are you expecting this to be picked up by the test project as well or just by test.msbuild? The former would not see this file.

Copy link
Member Author

Choose a reason for hiding this comment

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

There appears to be no directory in common with Helix payload structure and local structure. If this is changed to $(TestDir) it produces the correct layout locally but that's not present in helix :/. I guess we only need it to be present in Helix since that's the only place where it wouldn't find it in directory root. (since artifacts is below).

I'm debating just removing nuget.config entirely. We actually don't need to hit any feeds except nuget.org. The only place we need an additional feed is

<PackageReference Include="runtime.native.System.IO.Ports" Version="$(runtimenativeSystemIOPortsVersion)" NoWarn="NU1605" />
but that could be done differently, using an offically released package.

Thoughts?

Copy link
Member

Choose a reason for hiding this comment

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

Why not just put the NuGet.config into a central location and point to it during the restore? There is a switch available for that. I'm changing the layout slightly with #53439 so I would recommend to wait for that to go in (which hopefully will in 1-2h).

Copy link
Member Author

@ericstj ericstj Jun 9, 2021

Choose a reason for hiding this comment

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

Any thoughts on this NuGet.config being more than we need for package restore in testing?

We actually don't need to hit any feeds except nuget.org

In fact, we probably don't want our packages depending on things from the internal feeds.

Copy link
Member

Choose a reason for hiding this comment

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

Any thoughts on this NuGet.config being more than we need for package restore in testing?

Nope I think that's fine. We follow the same approach in the installer tests in the runtime repo (they copy the NuGet.config over and add to it).

In fact, we probably don't want our packages depending on things from the internal feeds.

That's right, but we don't reference any internal feeds from our NuGet.config.

</TestSupportFiles>
<TestSupportFiles Include="$(RepositoryEngineeringDir)versions.props">
<DestinationFolder>$(TestToolsDir)eng/</DestinationFolder>
</TestSupportFiles>
Expand Down