Example #1
0
 internal DependencyScanner(InMemoryIndex index, Config config, IFileAccess fileSystem, PackagePolicies packagePolicies)
 {
     this.versionResolver = new PackageVersionResolver(index);
     this.registry        = new NuGetDependencies(index, config);
     this.fileSystem      = fileSystem;
     this.packagePolicies = packagePolicies;
     this.followLocations = config.FollowLocations;
 }
Example #2
0
 public NuGetDependencies(InMemoryIndex index, Config config)
 {
     this.index  = index;
     this.config = config.DiskCache;
     this.ignoreDuplicatePackages = config.IgnoreDuplicatePackages;
     this.versionResolver         = new PackageVersionResolver(index);
     this.detailsPathFormatStr    = Path.Combine(this.config.CacheRoot, "packageDetails", "{0}_{1}.json");
     this.resolvedPathFormatStr   = Path.Combine(this.config.CacheRoot, "resolvedDependencies", "{0}_{1}.json");
     this.packagePolicies         = PackagePolicies.LoadFrom(config.PackagePolicies);
 }
        public async Task <InMemoryIndex> GetIndex()
        {
            if (DiskCache.TryGetValue(this.indexFileName, this.config.NuGetIndex, out InMemoryIndex.Content? cached))
            {
                Log.Debug("Using cached index");
                return(new InMemoryIndex(cached));
            }

            Log.Debug("Will fetch fresh index..");
            InMemoryIndex       index = new InMemoryIndex();
            IList <CatalogPage> pages = await GetAllPages();

            foreach (var page in pages)
            {
                index.Add(page);
            }

            File.WriteAllText(this.indexFileName, index.Serialized());
            return(index);
        }