/// <summary> /// Returns null if no dependency needs updating, otherwise returns the new content for the `bot-provisioning/dependencies.csx` file. /// </summary> /// <returns>The bump dependencies.</returns> public async Task <Tuple <ProvisionatorProfile, ProvisionatorProfile> > TryBumpDependencies() { var profileContent = await Designer.GetFileContent(ProvisionatorFile); var profile = ProvisionatorProfileParser.Parse(profileContent); var statuses = Enumerable.Empty <Octokit.CommitStatus> (); var githubRepos = profile.Dependencies.Distinct(t => t.GitHubUrl).ToArray(); foreach (var dependency in githubRepos) { var client = Designer.WithRepository(new Repository(dependency.GitHubUrl)); if (dependency.Name == "Mono") { client = client.WithBranch(BranchMapper.ToMonoBranch(client.BranchName)); } if (dependency.Name == "Visual Studio Mac") { client = client.WithBranch(BranchMapper.ToVSMBranch(client.BranchName)); } if (dependency.Name == "Xamarin.iOS" || dependency.Name == "Xamarin.Mac") { client = client.WithBranch(BranchMapper.ToXamariniOSBranch(client.BranchName)); } if (dependency.Name == "Xamarin.Android") { client = client.WithBranch(BranchMapper.ToXamarinAndroidBranch(client.BranchName)); } statuses = statuses.Concat(await GetLatestStatuses(client, dependency.InstallerPrefix)); } var newUrls = statuses .Select(t => t.TargetUrl.ToString()) .ToArray(); var newProfile = profile; foreach (var dependency in profile.Dependencies) { try { var newDependency = dependency.WithUrl(newUrls.Where(t => t.Contains(dependency.Prefix)).FirstOrDefault() ?? dependency.InstallerUrl); newProfile = newProfile.WithDependency(newDependency); } catch (Exception ex) { Console.WriteLine($"Unexpected exception trying to map back to the original git commit for {dependency.Name}: {ex}"); } } if (profile.Content == newProfile.Content) { return(null); } return(Tuple.Create(profile, newProfile)); }
public BumpVSMRoslynController(GitClient client) { Designer = client; VisualStudioMac = client.WithRepository(new Repository(VisualStudioMacUri)).WithBranch(BranchMapper.ToVSMBranch(client.BranchName)); }