Exemplo n.º 1
0
        public PackageInstaller(PackageReaderFactory packageReaderFactory, string rootDirectory, VersionResolutionTable versionTable,
                                PackageManifest manifest, ICollection <IRepository> cacheRepositories, InstalledPackagesManager installedPackagesManager)
        {
            Guard.NotNull(packageReaderFactory, nameof(packageReaderFactory));
            Guard.NotNull(rootDirectory, nameof(rootDirectory));
            Guard.NotNull(versionTable, nameof(rootDirectory));
            Guard.NotNull(manifest, nameof(rootDirectory));
            Guard.NotNull(cacheRepositories, nameof(rootDirectory));

            _packageReaderFactory     = packageReaderFactory;
            _rootDirectory            = rootDirectory;
            _versionTable             = versionTable;
            _manifest                 = manifest;
            _cacheRepositories        = cacheRepositories;
            _installedPackagesManager = installedPackagesManager;

            _libFolderPath     = Path.Combine(rootDirectory, "lib");
            _includeFolderPath = Path.Combine(rootDirectory, "include");
            _toolsFolderPath   = Path.Combine(rootDirectory, "tools");
            _otherFolderPath   = Path.Combine(rootDirectory, "other");

            _index = _installedPackagesManager.ReadFromFolder(_rootDirectory);

            foreach (var package in versionTable.GetPackages())
            {
                _manifest.Dependencies.Add(new PackageDependency(package.PackageId, new NuGet.Versioning.VersionRange(package.Version)));
            }
        }
Exemplo n.º 2
0
        public PackageInstallerFactory(PackageReaderFactory packageReaderFactory, RepositoryFactory repositoryFactory, InstalledPackagesManager installedPackagesManager)
        {
            Guard.NotNull(packageReaderFactory, nameof(packageReaderFactory));
            Guard.NotNull(repositoryFactory, nameof(repositoryFactory));

            _packageReaderFactory     = packageReaderFactory;
            _repositoryFactory        = repositoryFactory;
            _installedPackagesManager = installedPackagesManager;
        }