-
Notifications
You must be signed in to change notification settings - Fork 217
Implement roll-forward policies for .NET Core SDK resolution. #6953
Implement roll-forward policies for .NET Core SDK resolution. #6953
Conversation
See design document for more information on this feature. |
This commit implements additional roll-forward policies for resolving a .NET Core SDK based upon new SDK settings in `global.json`. Two new values are now supported in `global.json` in the `sdk` settings: * `rollForward` - the roll-forward policy to use (see below). * `allowPrerelease` - controls whether or not preview SDKS may be resolved. The new roll-forward policies are: * `patch` - If the requested SDK is installed, use it. Otherwise, use the latest installed patch level that matches the requested major, minor, and feature band. * `feature` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band and use the latest patch level for that feature band. * `minor` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band available for the same major version and use the latest patch level for that feature band. * `major` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band available without restriction and use the latest patch level for that feature band. * `latestPatch` - Use the latest installed patch level that matches the requested major, minor, and feature band. * `latestFeature` - Use the latest installed patch level for the latest installed feature band that matches the requested major and minor version. * `latestMinor` - Use the latest installed patch level for the latest installed feature band for the latest installed minor version that matches the requested major version. * `latestMajor` - Use the absolutely latest .NET Core SDK available. For backwards compatibility, the policy when a `version` is not specified in `global.json` will be `latestMajor`. The default policy when a `version` is specified but `rollForward` is not specified will be `patch`.
3a97deb
to
763475d
Compare
I thought we agreed to change this to major. |
I wasn't sure if that was now captured in the design document, but you're right. It's easy to change and update the tests. I'll push that up and we can fix any language needed in the doc. |
We're going to discuss changing the default when just a version is specified from |
We've decided not to change the default behavior when a |
b603438
to
4ec4e34
Compare
This commit makes the policy names for the `sdk/rollForward` value in `global.json` case insensitive. It also removes the switch statements used in parsing / displaying the roll forward policy names in favor of a constant array of names indexed by the enum value.
28590b5
to
79ba75f
Compare
* Removed unused members from `sdk_resolver`. * Remove unnecessary logging relating to BOMs. * Change to warnings instead of errors when failing to parse global.json (we fallback to "use latest" behavior). * Use JSON names in logging for values read in from global.json. * Remove underscore prefix from member variables. * Make `matches_policy` and `is_better_match` less redundant in the checks performed. * Rename `exact_match_allowed` to `exact_match_preferred`. * Fix whitespace in test.
This commit "theorizes" the invalid global.json test to eliminate duplicated code.
79ba75f
to
af1b5ec
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
assuming we have all the right approvals - even though in theory this should not be a breaking change, it's large enough to be treated similarly (especially since our test coverage is somewhat sparse and so it's hard to prove with reasonable confidence that this won't break anything).
This commit turns the JSON parsing failure back to an error for backwards compatibility. The new diagnostic messages remain as warnings.
This has been approved by Steve already. I gave him a heads up on this change a few weeks ago. Feel free to merge. Also, just noticed the comment does not say what is the default for allowPrerelease. Should we state that in the description for the PR? |
I'll update the PR description to include that information. |
Oh right, I don't have access to merge 😄. |
Is it possible to use these settings on items in the msbuild-sdks section? With NuGet we would use wildcard versions, but it doesn't seem to accept anything of the sort |
…/core-setup#6953) Implements additional roll-forward policies for resolving a .NET Core SDK based upon new SDK settings in `global.json`. Two new values are now supported in `global.json` in the `sdk` settings: * `rollForward` - the roll-forward policy to use (see below). * `allowPrerelease` - controls whether or not preview SDKS may be resolved (defaults to `true` to allow resolving prerelease SDKs). The new roll-forward policies are: * `patch` - If the requested SDK is installed, use it. Otherwise, use the latest installed patch level that matches the requested major, minor, and feature band. * `feature` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band and use the latest patch level for that feature band. * `minor` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band available for the same major version and use the latest patch level for that feature band. * `major` - If the requested major, minor, and feature band is installed, use the latest patch level for the specified feature band. Otherwise, roll-forward to the next available feature band available without restriction and use the latest patch level for that feature band. * `latestPatch` - Use the latest installed patch level that matches the requested major, minor, and feature band. * `latestFeature` - Use the latest installed patch level for the latest installed feature band that matches the requested major and minor version. * `latestMinor` - Use the latest installed patch level for the latest installed feature band for the latest installed minor version that matches the requested major version. * `latestMajor` - Use the absolutely latest .NET Core SDK available. For backwards compatibility, the policy when a `version` is not specified in `global.json` will be `latestMajor`. The default policy when a `version` is specified but `rollForward` is not specified will be `patch`. Commit migrated from dotnet/core-setup@5cd0245
This PR implements additional roll-forward policies for resolving a .NET
Core SDK based upon new SDK settings in
global.json
.Two new values are now supported in
global.json
in thesdk
settings:rollForward
- the roll-forward policy to use (see below).allowPrerelease
- controls whether or not preview SDKS may be resolved(defaults to
true
to allow resolving prerelease SDKs).The new roll-forward policies are:
patch
- If the requested SDK is installed, use it. Otherwise, use thelatest installed patch level that matches the requested major, minor, and
feature band.
feature
- If the requested major, minor, and feature band is installed, usethe latest patch level for the specified feature band. Otherwise, roll-forward
to the next available feature band and use the latest patch level for that
feature band.
minor
- If the requested major, minor, and feature band is installed, usethe latest patch level for the specified feature band. Otherwise, roll-forward
to the next available feature band available for the same major version and use
the latest patch level for that feature band.
major
- If the requested major, minor, and feature band is installed, usethe latest patch level for the specified feature band. Otherwise, roll-forward
to the next available feature band available without restriction and use the
latest patch level for that feature band.
latestPatch
- Use the latest installed patch level that matches therequested major, minor, and feature band.
latestFeature
- Use the latest installed patch level for the latestinstalled feature band that matches the requested major and minor version.
latestMinor
- Use the latest installed patch level for the latest installedfeature band for the latest installed minor version that matches the requested
major version.
latestMajor
- Use the absolutely latest .NET Core SDK available.For backwards compatibility, the policy when a
version
is not specified inglobal.json
will belatestMajor
. The default policy when aversion
isspecified but
rollForward
is not specified will bepatch
.