Exemple #1
0
        public void InstallCommand(ResolutionContext resolutionContext, IEnumerable<PackageDownloadClient> downloadClients, string targetPath, string id, SemanticVersion version = null, PackageInventory localInventory = null)
        {
            /// 1. Resolve the dependency graph
            ///     a. Get metadata for id (all versions if null, or specific version if specified),
            ///        including all first-level dependency statements
            ///     b. Get metadata for all first-level dependency packages (not yet in local inventory)
            ///        for all versions of id.  Repeat on these packages' dependencies until no deeper.
            ///     c. Resolve the graph of dependencies to one where no conflicts exist with local inventory.
            /// 2. Get all missing packages
            ///     a. Download and store as zip files in the targetPath
            ///     b. Unzip the packages into subfolders within targetPath
            ///         * Note that there will be callers that need to
            /// 3. Update local inventory object

            DependencyResolution resolution = DependencyResolver.Resolve(resolutionContext, id, version, localInventory);

            // This foreach should be parallel
            foreach (IPackageIdentity package in resolution.Installs)
            {
                string packagePath = Path.Combine(targetPath, package.Id, package.Version.ToString());
                DownloadAndUnzipSinglePackage(downloadClients, package, packagePath);
            }

            UpdateInventory(localInventory, resolution);
        }
Exemple #2
0
        private static void UpdateInventory(PackageInventory localInventory, DependencyResolution resolution)
        {
            foreach (IPackageIdentity uninstall in resolution.Uninstalls)
            {
                Logger.LogPackageUninstalled(uninstall);
                localInventory.Remove(uninstall);
            }

            foreach (IPackageIdentity install in resolution.Installs)
            {
                Logger.LogPackageInstalled(install);
                localInventory.Add(install);
            }
        }
        public static DependencyResolution Resolve(ResolutionContext context, string id, SemanticVersion version, PackageInventory localInventory)
        {
            IPackageMetadata metadata = context.GetMetadata(id, version);

            throw new NotImplementedException();
        }