public async Task <List <DependencyDetail> > GetRequiredUpdatesAsync( string repoUri, string branch, string sourceCommit, IEnumerable <AssetData> assets) { CheckForValidGitClient(); _logger.LogInformation($"Check if repo '{repoUri}' and branch '{branch}' needs updates..."); var toUpdate = new List <DependencyDetail>(); IEnumerable <DependencyDetail> dependencyDetails = await _fileManager.ParseVersionDetailsXmlAsync(repoUri, branch); Dictionary <string, DependencyDetail> dependencies = dependencyDetails.ToDictionary(d => d.Name); foreach (AssetData asset in assets) { if (!dependencies.TryGetValue(asset.Name, out DependencyDetail dependency)) { _logger.LogInformation($"No dependency found for updated asset '{asset.Name}'"); continue; } dependency.Version = asset.Version; dependency.Commit = sourceCommit; toUpdate.Add(dependency); } _logger.LogInformation( $"Getting dependencies which need to be updated in repo '{repoUri}' and branch '{branch}' succeeded!"); return(toUpdate); }
/// <summary> /// Determine what dependencies need to be updated given an input repo uri, branch /// and set of produced assets. /// </summary> /// <param name="repoUri">Repository</param> /// <param name="branch">Branch</param> /// <param name="sourceRepoUri">Repository the assets come from.</param> /// <param name="sourceCommit">Commit the assets come from.</param> /// <param name="assets">Assets as inputs for the update.</param> /// <returns>Map of existing dependency->updated dependency</returns> public async Task <List <DependencyUpdate> > GetRequiredNonCoherencyUpdatesAsync( string repoUri, string branch, string sourceRepoUri, string sourceCommit, IEnumerable <AssetData> assets) { CheckForValidGitClient(); _logger.LogInformation($"Check if repo '{repoUri}' and branch '{branch}' needs updates..."); IEnumerable <DependencyDetail> dependencyDetails = await _fileManager.ParseVersionDetailsXmlAsync(repoUri, branch); return(await GetRequiredNonCoherencyUpdatesAsync(sourceRepoUri, sourceCommit, assets, dependencyDetails)); }
private async Task <IEnumerable <DependencyDetail> > GetRequiredUpdatesAsync(string repoUri, string branch, string assetsProducedInCommit, IEnumerable <Microsoft.DotNet.DarcLib.AssetData> assets) { CheckForValidGitClient(); _logger.LogInformation($"Check if repo '{repoUri}' and branch '{branch}' needs updates..."); List <DependencyDetail> toUpdate = new List <DependencyDetail>(); IEnumerable <DependencyDetail> dependencyDetails = await _fileManager.ParseVersionDetailsXmlAsync(repoUri, branch); foreach (DependencyDetail dependency in dependencyDetails) { Microsoft.DotNet.DarcLib.AssetData asset = assets.Where(a => a.Name == dependency.Name).FirstOrDefault(); if (asset == null) { _logger.LogInformation($"Dependency '{dependency.Name}' not found in the updated assets..."); continue; } dependency.Version = asset.Version; dependency.Commit = assetsProducedInCommit; toUpdate.Add(dependency); } _logger.LogInformation($"Getting dependencies which need to be updated in repo '{repoUri}' and branch '{branch}' succeeded!"); return(toUpdate); }
/// <summary> /// Gets the local dependencies /// </summary> /// <returns></returns> public async Task <IEnumerable <DependencyDetail> > GetDependenciesAsync(string name = null) { return((await _fileManager.ParseVersionDetailsXmlAsync(_repo, null)).Where( dependency => string.IsNullOrEmpty(name) || dependency.Name.Equals(name, StringComparison.OrdinalIgnoreCase))); }
/// <summary> /// Gets the local dependencies /// </summary> /// <returns></returns> public async Task <IEnumerable <DependencyDetail> > GetDependenciesAsync(string name) { return(await _fileManager.ParseVersionDetailsXmlAsync(Path.Combine(_repo, VersionFilePath.VersionDetailsXml), null)); }