Skip to content

Recognize pinned pre-release package references #544

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

Merged
merged 1 commit into from
Jun 5, 2020

Conversation

atifaziz
Copy link
Contributor

@atifaziz atifaziz commented Jun 4, 2020

This PR addresses #407 by fixing the regular expression used to determine whether a package reference is pinned or not.

Steps to Test

Before this PR, using the latest version (0.52.0), the following:

PS> dotnet script eval '#r \"nuget: Microsoft.Data.SqlClient,2.0.0-preview3.20122.2\"'

would issue the warning:

warn: Dotnet.Script.DependencyModel.Context.CachedRestorer[0]
      Unable to cache C:\Users\johndoe\AppData\Local\Temp\dotnet-script\A\Dotnet.Script\Eval\interactive\interactive\netcoreapp3.1\script.csproj. For caching and optimal performance, ensure that the script(s) references Nuget packages with a pinned version.

After checking out this PR's branch, the following:

PS> dotnet run -p .\src\Dotnet.Script -f netcoreapp3.1 -- eval '#r \"nuget: Microsoft.Data.SqlClient,2.0.0-preview3.20122.2\"'

will issue no warning about non-cache-ability of a floating (or an unpinned) reference.

Additional Notes

This PR also refactored parts to share the regular expressions for package references more consistently between ScriptParser and NuGetSourceReferenceResolver. Since these two reside in separate projects, I avoided a dependency between the two by rendering ScriptParser partial, moving shared parts to another partial definition of the same class in a separate file called ScriptParserInternals.cs, and finally linking that into the Dotnet.Script.DependencyModel.NuGet project. The partial definition in ScriptParserInternals.cs has no public modifier so ScriptParser will not get introduced into the public API of Dotnet.Script.DependencyModel.NuGet.

@seesharper seesharper requested review from filipw and seesharper June 4, 2020 19:40
Copy link
Collaborator

@seesharper seesharper left a comment

Choose a reason for hiding this comment

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

This has been on my TODO list for quite a while. LGTM 👍

@atifaziz
Copy link
Contributor Author

atifaziz commented Jun 4, 2020

This has been on my TODO list for quite a while. LGTM 👍

@seesharper Glad to hear and help. Looking forward to the merge.

Copy link
Member

@filipw filipw left a comment

Choose a reason for hiding this comment

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

LGTM thanks

@filipw filipw merged commit de064b9 into dotnet-script:master Jun 5, 2020
@atifaziz atifaziz deleted the fix-issue-407 branch June 5, 2020 07:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants