public static void Main(string[] args) { DebugHelper.HandleDebugSwitch(ref args); List <BuildInfo> buildInfos = new List <BuildInfo>(); buildInfos.Add(BuildInfo.Get("CoreFx", s_config.CoreFxVersionUrl, fetchLatestReleaseFile: false)); buildInfos.Add(BuildInfo.Get("CoreClr", s_config.CoreClrVersionUrl, fetchLatestReleaseFile: false)); buildInfos.Add(BuildInfo.Get("Roslyn", s_config.RoslynVersionUrl, fetchLatestReleaseFile: false)); buildInfos.Add(BuildInfo.Get("CoreSetup", s_config.CoreSetupVersionUrl, fetchLatestReleaseFile: false)); IEnumerable <IDependencyUpdater> updaters = GetUpdaters(); GitHubAuth gitHubAuth = new GitHubAuth(s_config.Password, s_config.UserName, s_config.Email); DependencyUpdater dependencyUpdater = new DependencyUpdater( gitHubAuth, s_config.GitHubProject, s_config.GitHubUpstreamOwner, s_config.GitHubUpstreamBranch, s_config.UserName, s_config.GitHubPullRequestNotifications); if (args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase)) { dependencyUpdater.Update(updaters, buildInfos); } else { dependencyUpdater.UpdateAndSubmitPullRequestAsync(updaters, buildInfos); } }
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 BuildInfo CreateBuildInfo(ITaskItem item, string cacheDir) { string rawUrl = item.GetMetadata(RawUrlMetadataName); if (!string.IsNullOrEmpty(rawUrl)) { return(BuildInfo.Get(item.ItemSpec, rawUrl)); } string rawVersionsBaseUrl = item.GetMetadata(RawVersionsBaseUrlMetadataName); string buildInfoPath = item.GetMetadata(BuildInfoPathMetadataName); string currentRef = item.GetMetadata(CurrentRefMetadataName); // Optional: override base url with a local directory. string versionsRepoDir = item.GetMetadata(VersionsRepoDirMetadataName); if (!string.IsNullOrEmpty(versionsRepoDir) && !string.IsNullOrEmpty(buildInfoPath)) { return(BuildInfo.LocalFileGetAsync( item.ItemSpec, versionsRepoDir, buildInfoPath, // Don't fetch latest release file: it may not be present in build from source. fetchLatestReleaseFile: false).Result); } if (!string.IsNullOrEmpty(rawVersionsBaseUrl) && !string.IsNullOrEmpty(buildInfoPath) && !string.IsNullOrEmpty(currentRef)) { return(BuildInfo.CachedGet( item.ItemSpec, rawVersionsBaseUrl, currentRef, buildInfoPath, cacheDir)); } string packageId = item.GetMetadata(PackageIdMetadataName); string version = item.GetMetadata(VersionMetadataName); if (!string.IsNullOrEmpty(packageId) && !string.IsNullOrEmpty(version)) { return(new BuildInfo { Name = item.ItemSpec, LatestPackages = new Dictionary <string, string> { [packageId] = version } }); } throw new Exception($"Unable to create build info with '{item}'."); }
private static BuildInfo CreateBuildInfo(ITaskItem item, string cacheDir) { string rawUrl = item.GetMetadata(RawUrlMetadataName); if (!string.IsNullOrEmpty(rawUrl)) { return(BuildInfo.Get(item.ItemSpec, rawUrl)); } string rawVersionsBaseUrl = item.GetMetadata(RawVersionsBaseUrlMetadataName); string buildInfoPath = item.GetMetadata(BuildInfoPathMetadataName); string currentRef = item.GetMetadata(CurrentRefMetadataName); // Optional string currentBranch = item.GetMetadata(CurrentBranchMetadataName); if (!string.IsNullOrEmpty(rawVersionsBaseUrl) && !string.IsNullOrEmpty(buildInfoPath) && !string.IsNullOrEmpty(currentRef)) { if (!string.IsNullOrEmpty(currentBranch)) { buildInfoPath = $"{buildInfoPath}/{currentBranch}"; } return(BuildInfo.CachedGet( item.ItemSpec, rawVersionsBaseUrl, currentRef, buildInfoPath, cacheDir)); } string packageId = item.GetMetadata(PackageIdMetadataName); string version = item.GetMetadata(VersionMetadataName); if (!string.IsNullOrEmpty(packageId) && !string.IsNullOrEmpty(version)) { return(new BuildInfo { Name = item.ItemSpec, LatestPackages = new Dictionary <string, string> { [packageId] = version } }); } throw new Exception($"Unable to create build info with '{item}'."); }
private static BuildInfo GetBuildInfo(string name, string packageVersionsUrl, bool fetchLatestReleaseFile = true) { const string FileUrlProtocol = "file://"; if (packageVersionsUrl.StartsWith(FileUrlProtocol, StringComparison.Ordinal)) { return(LocalFileGetAsync( name, packageVersionsUrl.Substring(FileUrlProtocol.Length), fetchLatestReleaseFile) .Result); } else { return(BuildInfo.Get(name, packageVersionsUrl, fetchLatestReleaseFile)); } }
private static DependencyUpdateResults UpdateFiles() { // The BuildInfo does not contain the CLI product version, so the version is retrieved from a // particular CLI package (e.g. Microsoft.DotNet.Cli.Utils). Once the BuildInfo includes the // product version, it should be utilized. // // This app does not update the version of the .NET Core runtime/framework in the Dockerfiles // because the infrastructure is not in place to retrieve the version on which the SDK depends. // This version is infrequently updated, so this is acceptable for now, but once the // infrastructure is in place, this app should update the runtime/framework version also. IEnumerable <BuildInfo> buildInfos = new[] { BuildInfo.Get("Cli", s_config.CliVersionUrl, fetchLatestReleaseFile: false) }; IEnumerable <IDependencyUpdater> updaters = GetUpdaters(); DependencyUpdater updater = new DependencyUpdater(); return(updater.Update(updaters, buildInfos)); }
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)); } }
public static void Main(string[] args) { DebugHelper.HandleDebugSwitch(ref args); bool onlyUpdate = args.Length > 0 && string.Equals("--Update", args[0], StringComparison.OrdinalIgnoreCase); 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)); IEnumerable <IDependencyUpdater> updaters = GetUpdaters(); var dependencyBuildInfos = buildInfos.Select(buildInfo => new DependencyBuildInfo( buildInfo, upgradeStableVersions: true, disabledPackages: Enumerable.Empty <string>())); DependencyUpdateResults updateResults = DependencyUpdateUtils.Update(updaters, dependencyBuildInfos); if (updateResults.ChangesDetected() && !onlyUpdate) { GitHubAuth gitHubAuth = new GitHubAuth(s_config.Password, s_config.UserName, s_config.Email); GitHubProject origin = new GitHubProject(s_config.GitHubProject, s_config.UserName); GitHubBranch upstreamBranch = new GitHubBranch( s_config.GitHubUpstreamBranch, new GitHubProject(s_config.GitHubProject, s_config.GitHubUpstreamOwner)); string suggestedMessage = updateResults.GetSuggestedCommitMessage(); string body = string.Empty; if (s_config.GitHubPullRequestNotifications.Any()) { body += PullRequestCreator.NotificationString(s_config.GitHubPullRequestNotifications); } new PullRequestCreator(gitHubAuth, origin, upstreamBranch) .CreateOrUpdateAsync( suggestedMessage, suggestedMessage + $" ({upstreamBranch.Name})", body) .Wait(); } }
private static DependencyBuildInfo GetBuildInfoDependency(string target, string fragment) { BuildInfo buildInfo = BuildInfo.Get(target, $"{config.VersionsUrl}/{fragment}", false); return(new DependencyBuildInfo(buildInfo, true, Enumerable.Empty <string>())); }
private IEnumerable <BuildInfo> GetBuildInfos() { return(DependencyBuildInfo.Select(buildInfoItem => BuildInfo.Get( buildInfoItem.ItemSpec, buildInfoItem.GetMetadata("RawUrl")))); }