Exemplo n.º 1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="DownloadPackageAction"/> class.
 /// </summary>
 /// <param name="deploymentContext">The deployment context.</param>
 /// <param name="isUpdate"><see cref="DeploymentAction.IsUpdate"/></param>
 /// <param name="deploymentPackage">The associated package</param>
 /// <param name="nuGetEngine">NuGet engine to use</param>
 /// <param name="path">Download path</param>
 /// <seealso cref="DeploymentPackageInfo"/>
 /// <seealso cref="INuGetEngine"/>
 public DownloadPackageAction(DeploymentContext deploymentContext, bool isUpdate, DeploymentPackageInfo deploymentPackage,
                              INuGetEngine nuGetEngine, string path) : base(deploymentContext, isUpdate)
 {
     _nuGetEngine       = nuGetEngine;
     _path              = path;
     _deploymentPackage = deploymentPackage;
 }
Exemplo n.º 2
0
        /// <summary>
        /// Translates NuGet package graph into <see cref="PackageGraph"/> using <see cref="PackageGraphBuilder"/>
        /// </summary>
        /// <param name="node">NuGet package node</param>
        /// <param name="graphBuilder">The graph builder.</param>
        /// <param name="resolvedPackagesDictionary">The resolved packages dictionary.</param>
        /// <returns>PackageId for the translated package</returns>
        /// <exception cref="System.ArgumentException"></exception>
        protected PackageId TranslateNuGetGraphNode(GraphNode <RemoteResolveResult> node, PackageGraphBuilder graphBuilder,
                                                    Dictionary <PackageId, DeploymentPackageInfo> resolvedPackagesDictionary)
        {
            if (node.Key.TypeConstraint != LibraryDependencyTarget.Package &&
                node.Key.TypeConstraint != LibraryDependencyTarget.PackageProjectExternal)
            {
                throw new ArgumentException($"Package {node.Key.Name} cannot be resolved from the sources");
            }

            var package = new DeploymentPackageInfo
            {
                Id = new PackageId(node.Item.Key.Name, node.Item.Key.Version.ToNormalizedString(),
                                   node.Item.Key.Version.IsPrerelease),
                Match = node.Item.Data.Match
            };

            graphBuilder.Append(package.Id,
                                node.InnerNodes.Select(x => TranslateNuGetGraphNode(x, graphBuilder, resolvedPackagesDictionary)));

            if (!resolvedPackagesDictionary.ContainsKey(package.Id))
            {
                resolvedPackagesDictionary.Add(package.Id, package);
            }

            return(package.Id);
        }
Exemplo n.º 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="InstallPackageAction"/> class.
 /// </summary>
 /// <param name="deploymentContext">The deployment context.</param>
 /// <param name="isUpdate"><see cref="DeploymentAction.IsUpdate"/></param>
 /// <param name="deploymentPackage">The deployment package.</param>
 /// <param name="deploymentStrategy">The deployment strategy.</param>
 /// <seealso cref="DeploymentPackageInfo"/>
 public InstallPackageAction(DeploymentContext deploymentContext, bool isUpdate, DeploymentPackageInfo deploymentPackage,
                             IDeploymentStrategyProvider deploymentStrategy) : base(deploymentContext, isUpdate)
 {
     _deploymentPackage     = deploymentPackage;
     _packageConfigProvider = DeploymentContext.PackageConfigurationProvider;
     _deploymentStrategy    = deploymentStrategy;
 }