Skip to content

Add --local flag to restore#191

Merged
agocke merged 5 commits intodn-vm:mainfrom
MattKotsenas:feature/restore-to-manifest
Apr 12, 2025
Merged

Add --local flag to restore#191
agocke merged 5 commits intodn-vm:mainfrom
MattKotsenas:feature/restore-to-manifest

Conversation

@MattKotsenas
Copy link
Contributor

@MattKotsenas MattKotsenas commented Apr 4, 2025

This changes the behavior of dnvm restore.

Before, restore always did a local restore to the .dotnet directory that matched the global.json. Now the default behavior is to install to the "global" dnvm directory for the user.

This is likely a better default because it allows the user to use dnvm restore across many repos without installing duplicate SDK versions. The previous behavior is available via --local|-l.

I also added a log statement to show the global.json parsed and roll forward calculated values. A few times I forgot about roll forward rules and got unexpected results, so the log statement helps explain where blame resides 🙃.

@MattKotsenas MattKotsenas force-pushed the feature/restore-to-manifest branch 2 times, most recently from 92c7516 to c45d255 Compare April 4, 2025 20:21
}
else
{
var error = await InstallCommand.Run(env, logger, new CommandArguments.InstallArguments { SdkVersion = component.Version, Force = options.Force, Verbose = options.Verbose });
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like a bit too much reuse. We probably want to call InstallCommand.InstallSdk instead of InstallCommand.Run, since we are not executing an explicitly requested install as requested by the user. If I were going to put any logging associated specifically with the install command, it would probably be in that function.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated. If this isn't what you had in mind please let me know. Thanks!

@MattKotsenas MattKotsenas force-pushed the feature/restore-to-manifest branch from 9cec54c to 85f3e95 Compare April 11, 2025 19:32
@MattKotsenas
Copy link
Contributor Author

Updated! @agocke , would you mind taking another look?

@MattKotsenas MattKotsenas requested a review from agocke April 11, 2025 20:35
Copy link
Collaborator

@agocke agocke 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!

Looks like updating the tests involved lots of boilerplate, but the result looks very thorough. Thanks!

@agocke agocke merged commit 1e7d187 into dn-vm:main Apr 12, 2025
3 checks passed
@MattKotsenas MattKotsenas deleted the feature/restore-to-manifest branch April 16, 2025 02:03
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.

2 participants