private static DependencyUpdateResults UpdateFiles() { // Ideally this logic would depend on the CLI produces and consumes metadata. Since it doesn't // exist various version information is inspected to obtain the latest CLI version along with // the runtime (e.g. shared framework) it depends on. BuildInfo cliBuildInfo = BuildInfo.Get(CliBuildInfoName, s_config.CliVersionUrl, fetchLatestReleaseFile: false); // Adjust the LatestReleaseVersion since it is not the full version and all consumers here need it to be. cliBuildInfo.LatestReleaseVersion = $"{s_config.RuntimeReleasePrefix}-{cliBuildInfo.LatestReleaseVersion}"; string sharedFrameworkVersion = CliDependencyHelper.GetSharedFrameworkVersion(cliBuildInfo.LatestReleaseVersion); IEnumerable <DependencyBuildInfo> buildInfos = new[] { new DependencyBuildInfo(cliBuildInfo, false, Enumerable.Empty <string>()), new DependencyBuildInfo( new BuildInfo() { Name = SharedFrameworkBuildInfoName, LatestReleaseVersion = sharedFrameworkVersion, LatestPackages = new Dictionary <string, string>() }, false, Enumerable.Empty <string>()), }; IEnumerable <IDependencyUpdater> updaters = GetUpdaters(); return(DependencyUpdateUtils.Update(updaters, buildInfos)); }
private static IEnumerable <IDependencyUpdater> GetUpdaters(CliDependencyHelper cliDependencyHelper) { string majorMinorVersion = s_config.CliReleasePrefix.Substring(0, s_config.CliReleasePrefix.LastIndexOf('.')); string[] dockerfiles = GetDockerfiles(majorMinorVersion); Trace.TraceInformation("Updating the following Dockerfiles:"); Trace.TraceInformation($"{string.Join(Environment.NewLine, dockerfiles)}"); IEnumerable <IDependencyUpdater> updaters = dockerfiles .Select(path => CreateSDKDockerfileEnvUpdater(path, CliBuildInfoName)) .Concat(dockerfiles.Select(path => CreateDockerfileEnvUpdater(path, "DOTNET_VERSION", SharedFrameworkBuildInfoName))); if (cliDependencyHelper.CliMajorVersion > 1) { updaters = updaters.Concat(dockerfiles.Select(path => new DockerfileShaUpdater(path))); } else if (s_config.CliReleasePrefix.StartsWith("1.1")) { dockerfiles = GetDockerfiles("1.0"); updaters = updaters.Concat(dockerfiles.Select(path => CreateSDKDockerfileEnvUpdater(path, CliBuildInfoName))); } return(updaters); }