src/Microsoft.DotNet.Darc/src/DarcLib/Helpers/GitFileManager.cs
/// <summary>
/// Add a new dependency to the repository
/// </summary>
/// <param name="dependency">Dependency to add.</param>
/// <param name="dependencyType">Type of dependency.</param>
/// <param name="repoUri">Repository URI to add the dependency to.</param>
/// <param name="branch">Branch to add the dependency to.</param>
/// <returns>Async task.</returns>
Add a new dependency to the repository
Add a new dependency to the repository
public async Task AddDependencyAsync(
            DependencyDetail dependency,
            DependencyType dependencyType,
            string repoUri,
            string branch)
        {
            if ((await ParseVersionDetailsXmlAsync(repoUri, branch)).Any(
                existingDependency => existingDependency.Name.Equals(dependency.Name, StringComparison.OrdinalIgnoreCase)))
            {
                throw new DependencyException($"Dependency {dependency.Name} already exists in this repository");
            }
            if (DependencyOperations.TryGetKnownUpdater(dependency.Name, out Delegate function))
            {
                await (Task)function.DynamicInvoke(this, repoUri, branch, dependency);
            }
            else
            {
                await AddDependencyToVersionsPropsAsync(
                    repoUri,
                    branch,
                    dependency);
                await AddDependencyToVersionDetailsAsync(
                    repoUri,
                    branch,
                    dependency,
                    dependencyType);
            }
        }
public async Task AddDependencyAsync ( DependencyDetail dependency , DependencyType dependencyType , string repoUri , string branch ) { if ( ( await ParseVersionDetailsXmlAsync ( repoUri , branch ) ) . Any ( existingDependency => existingDependency . Name . Equals ( dependency . Name , StringComparison . OrdinalIgnoreCase ) ) ) { throw new DependencyException ( $" Dependency  { dependency . Name }  already exists in this repository " ) ; } if ( DependencyOperations . TryGetKnownUpdater ( dependency . Name , out Delegate function ) ) { await ( Task ) function . DynamicInvoke ( this , repoUri , branch , dependency ) ; } else { await AddDependencyToVersionsPropsAsync ( repoUri , branch , dependency ) ; await AddDependencyToVersionDetailsAsync ( repoUri , branch , dependency , dependencyType ) ; } }
Add a new dependency to the repository
Add a new dependency to the repository
None
dependency
DependencyDetail
Dependency to add.
Dependency to add .
dependencyType
DependencyType
Type of dependency.
Type of dependency .
repoUri
string
Repository URI to add the dependency to.
Repository URI to add the dependency to .
branch
string
Branch to add the dependency to.
Branch to add the dependency to .