Implement roll-forward policies for .NET Core SDK resolution. (dotnet/core-setup...
authorPeter Huene <pehuene@microsoft.com>
Wed, 10 Jul 2019 08:59:28 +0000 (01:59 -0700)
committerVitek Karas <vitek.karas@microsoft.com>
Wed, 10 Jul 2019 08:59:28 +0000 (01:59 -0700)
commit9441ec93b9e1c9c3db226ba9c12fd8edf9acfdcb
treec1b60d188144f6c2d0e955f8ffffff4ea42ebfc0
parentcd67390bb1d34b2419460c8dee6daad29414d9c0
Implement roll-forward policies for .NET Core SDK resolution. (dotnet/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 https://github.com/dotnet/core-setup/commit/5cd0245860335e0b307f6a46b99c6f9244887318
src/installer/corehost/cli/fxr/fx_muxer.cpp
src/installer/corehost/cli/fxr/hostfxr.cpp
src/installer/corehost/cli/fxr/sdk_resolver.cpp
src/installer/corehost/cli/fxr/sdk_resolver.h
src/installer/test/HostActivationTests/MultilevelSDKLookup.cs
src/installer/test/HostActivationTests/NativeHostApis.cs
src/installer/test/HostActivationTests/SDKLookup.cs