public static async Task UpdateGlobalJson(
            GitFileManager fileManager,
            string repository,
            string branch,
            DependencyDetail dependency)
        {
            var dependencyMapping = new Dictionary <string, string>
            {
                { "Microsoft.DotNet.Arcade.Sdk", "msbuild-sdks" },
                { "Microsoft.DotNet.Build.Tasks.SharedFramework.Sdk", "msbuild-sdks" },
                { "Microsoft.DotNet.Helix.Sdk", "msbuild-sdks" },
                { "Microsoft.DotNet.SharedFramework.Sdk", "msbuild-sdks" },
                { "Microsoft.NET.SharedFramework.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(
                repository,
                branch,
                parent,
                dependency.Name,
                dependency.Version);

            await fileManager.AddDependencyToVersionDetailsAsync(
                repository,
                branch,
                dependency);
        }
Exemple #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);
        }