Consume local info support from VersionTools

Davis added support for VersionTools to be able to pull from a local
filesystem layout that looks like what we have in GitHub on
dotnet/versions.

Start to consume this so a composed build can use this logic to update
dependencies using local version information produced during the build.
This commit is contained in:
Matt Ellis 2017-02-20 14:20:27 -08:00
parent 99f7eb4843
commit 921c116c65
3 changed files with 37 additions and 16 deletions

View file

@ -25,8 +25,8 @@ namespace Microsoft.DotNet.Scripts
List<BuildInfo> buildInfos = new List<BuildInfo>();
buildInfos.Add(BuildInfo.Get("Roslyn", s_config.RoslynVersionUrl, fetchLatestReleaseFile: false));
buildInfos.Add(BuildInfo.Get("CoreSetup", s_config.CoreSetupVersionUrl, fetchLatestReleaseFile: false));
buildInfos.Add(GetBuildInfo("Roslyn", s_config.RoslynVersionFragment, fetchLatestReleaseFile: false));
buildInfos.Add(GetBuildInfo("CoreSetup", s_config.CoreSetupVersionFragment, fetchLatestReleaseFile: false));
IEnumerable<IDependencyUpdater> updaters = GetUpdaters();
var dependencyBuildInfos = buildInfos.Select(buildInfo =>
@ -60,6 +60,25 @@ namespace Microsoft.DotNet.Scripts
}
}
private static BuildInfo GetBuildInfo(string name, string buildInfoFragment, bool fetchLatestReleaseFile = true)
{
const string FileUrlProtocol = "file://";
if (s_config.DotNetVersionUrl.StartsWith(FileUrlProtocol, StringComparison.Ordinal))
{
return BuildInfo.LocalFileGetAsync(
name,
s_config.DotNetVersionUrl.Substring(FileUrlProtocol.Length),
buildInfoFragment.Replace('/', Path.DirectorySeparatorChar),
fetchLatestReleaseFile)
.Result;
}
else
{
return BuildInfo.Get(name, $"{s_config.DotNetVersionUrl}/{buildInfoFragment}", fetchLatestReleaseFile);
}
}
private static IEnumerable<IDependencyUpdater> GetUpdaters()
{
yield return CreateRegexUpdater(Path.Combine("build", "Microsoft.DotNet.Cli.DependencyVersions.props"), "CLI_SharedFrameworkVersion", "Microsoft.NETCore.App");