Beispiel #1
0
        /// <summary>
        /// Adds a dependency to the dependency files
        /// </summary>
        /// <returns></returns>
        public async Task AddDependenciesAsync(DependencyDetail dependency, DependencyType dependencyType)
        {
            if (DependencyOperations.TryGetKnownUpdater(dependency.Name, out Delegate function))
            {
                await(Task) function.DynamicInvoke(_fileManager, _repo, dependency);
            }
            else
            {
                await _fileManager.AddDependencyToVersionProps(Path.Combine(_repo, VersionFilePath.VersionProps), dependency);

                await _fileManager.AddDependencyToVersionDetails(Path.Combine(_repo, VersionFilePath.VersionDetailsXml), dependency, dependencyType);
            }
        }
Beispiel #2
0
        public static async Task UpdateGlobalJson(GitFileManager fileManager, string repository, DependencyDetail dependency)
        {
            Dictionary <string, string> dependencyMapping = new Dictionary <string, string>
            {
                { "Microsoft.DotNet.Arcade.Sdk", "msbuild-sdks" },
                { "dotnet", "tools" }
            };

            if (!dependencyMapping.ContainsKey(dependency.Name))
            {
                throw new Exception($"Dependency '{dependency.Name}' has no parent mapping defined.");
            }

            string parent = dependencyMapping[dependency.Name];

            await fileManager.AddDependencyToGlobalJson(Path.Combine(repository, VersionFilePath.GlobalJson), parent, dependency.Name, dependency.Version);

            await fileManager.AddDependencyToVersionDetails(Path.Combine(repository, VersionFilePath.VersionDetailsXml), dependency, DependencyType.Toolset);
        }