protected async Task <ZipArchive> DownloadPackageAsync(DependencyBuildInfo info, PackageIdentity package)
        {
            if (PackageDownloadBaseUrl == null)
            {
                // This isn't checked in the constructor because build-info may contain a download URL in the future.
                throw new InvalidOperationException(
                          $"A {nameof(PackageDownloadBaseUrl)} must be configured, " +
                          "as build-infos do not have package feed details.");
            }

            string downloadUrl = $"{PackageDownloadBaseUrl}/package/{package.Id}/{package.Version}";

            Trace.TraceInformation($"Downloading '{package}' from '{downloadUrl}'");

            HttpClient client      = DownloadClient.Value;
            Stream     nupkgStream = await client.GetStreamAsync(downloadUrl);

            return(new ZipArchive(nupkgStream));
        }
Пример #2
0
 private IEnumerable <BuildInfo> GetBuildInfos()
 {
     return(DependencyBuildInfo.Select(buildInfoItem => BuildInfo.Get(
                                           buildInfoItem.ItemSpec,
                                           buildInfoItem.GetMetadata("RawUrl"))));
 }
 protected IEnumerable <DependencyBuildInfo> CreateBuildInfoDependencies()
 {
     return(DependencyBuildInfo
            ?.Select(item => CreateBuildInfoDependency(item, BuildInfoCacheDir))
            ?? Enumerable.Empty <DependencyBuildInfo>());
 }
Пример #4
0
 private ITaskItem FindDependencyBuildInfo(string name)
 {
     return(DependencyBuildInfo.SingleOrDefault(item => item.ItemSpec == name));
 }