Beispiel #1
0
        protected IEnumerable <IDependencyInfo> CreateDependencyInfos(
            bool remote,
            string versionsCommit)
        {
            foreach (ITaskItem info in DependencyInfo ?? Enumerable.Empty <ITaskItem>())
            {
                IDependencyInfo dependencyInfo;

                string type = info.GetMetadata("DependencyType");
                switch (type)
                {
                case "Build":
                    SetVersionsCommitOverride(info, versionsCommit);
                    dependencyInfo = CreateBuildInfoDependency(info, BuildInfoCacheDir);
                    break;

                case "Submodule":
                    dependencyInfo = SubmoduleDependencyInfo.Create(
                        GetRequiredMetadata(info, "Repository"),
                        GetRequiredMetadata(info, "Ref"),
                        GetRequiredMetadata(info, "Path"),
                        remote);
                    break;

                case "Orchestrated build":
                    SetVersionsCommitOverride(info, versionsCommit);
                    dependencyInfo = OrchestratedBuildDependencyInfo.CreateAsync(
                        info.ItemSpec,
                        new GitHubProject(
                            GetRequiredMetadata(info, "VersionsRepo"),
                            GetRequiredMetadata(info, "VersionsRepoOwner")),
                        GetRequiredMetadata(info, CurrentRefMetadataName),
                        GetRequiredMetadata(info, "BasePath"),
                        new BuildManifestClient(GitHubClient)).Result;
                    break;

                case "Orchestrated build file":
                    dependencyInfo = new OrchestratedBuildDependencyInfo(
                        info.ItemSpec,
                        OrchestratedBuildModel.Parse(
                            XElement.Parse(
                                File.ReadAllText(
                                    GetRequiredMetadata(info, "Path")))));
                    break;

                default:
                    throw new NotSupportedException(
                              $"Unsupported DependencyInfo '{info.ItemSpec}': DependencyType '{type}'.");
                }

                DependencyInfoConfigItems[dependencyInfo] = info;
                yield return(dependencyInfo);
            }
        }
 private static EndpointModel GetBlobFeed(this OrchestratedBuildDependencyInfo info)
 {
     return(info.OrchestratedBuildModel.Endpoints
            .FirstOrDefault(e => e.IsOrchestratedBlobFeed));
 }