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() { // 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)); }
public override bool Execute() { MsBuildTraceListener[] listeners = Trace.Listeners.AddMsBuildTraceListeners(Log); try { IDependencyUpdater[] updaters = GetDependencyUpdaters().ToArray(); BuildInfo[] buildInfos = GetBuildInfos().ToArray(); var updater = new DependencyUpdater(); DependencyUpdateResults updateResults = updater.Update(updaters, buildInfos); if (updateResults.ChangesDetected()) { var gitHubAuth = new GitHubAuth(GitHubAuthToken, GitHubUser, GitHubEmail); var origin = new GitHubProject(ProjectRepoName, GitHubUser); var upstreamBranch = new GitHubBranch( ProjectRepoBranch, new GitHubProject(ProjectRepoName, ProjectRepoOwner)); string suggestedMessage = updateResults.GetSuggestedCommitMessage(); string body = string.Empty; if (NotifyGitHubUsers != null) { body += PullRequestCreator.NotificationString(NotifyGitHubUsers.Select(item => item.ItemSpec)); } var prCreator = new PullRequestCreator(gitHubAuth, origin, upstreamBranch, GitHubAuthor); prCreator.CreateOrUpdateAsync( suggestedMessage, suggestedMessage + $" ({ProjectRepoBranch})", body, forceCreate: AlwaysCreateNewPullRequest).Wait(); } } finally { Trace.Listeners.RemoveMsBuildTraceListeners(listeners); } return(true); }