Example #1
0
 static void AddOwn(Bundle bundle, Dictionary <string, string> packages, BundleScope scope, bool includeOptional)
 {
     foreach (var p in bundle.GetAllPackages(scope, includeOptional))
     {
         packages[p.Key] = p.Value;
     }
 }
Example #2
0
        Dictionary <string, string> GetOptionalPackages(BundleScope scope)
        {
            switch (scope)
            {
            case BundleScope.All:
                return
                    (GetOptionalPackages(BundleGroup.All)
                     .Concat(GetOptionalPackages(BundleGroup.Client))
                     .Concat(GetOptionalPackages(BundleGroup.Server))
                     .ToDictionary(x => x.Key, x => x.Value));

            case BundleScope.Server:
                return
                    (GetOptionalPackages(BundleGroup.All)
                     .Concat(GetOptionalPackages(BundleGroup.Server))
                     .ToDictionary(x => x.Key, x => x.Value));

            case BundleScope.Client:
                return
                    (GetOptionalPackages(BundleGroup.All)
                     .Concat(GetOptionalPackages(BundleGroup.Client))
                     .ToDictionary(x => x.Key, x => x.Value));
            }

            return(null);
        }
Example #3
0
        async Task ResolveDependencies(Bundle bundle, Dictionary <string, string> packages,
                                       List <string> deps, BundleScope scope = BundleScope.All, bool includeOptional = false,
                                       bool remote = true)
        {
            await AddDependencies(bundle, packages, deps, scope, includeOptional, remote).ConfigureAwait(false);

            AddOwn(bundle, packages, scope, includeOptional);
        }
Example #4
0
 async Task<Dictionary<string, string>> GetDependencyTree(Bundle bundle, bool includeOptional, BundleScope scope,
     bool remote = true) {
     var packages = new Dictionary<string, string>();
     var deps = new List<string>();
     PackageManager.StatusRepo.Reset(RepoStatus.Resolving, 1);
     await ResolveDependencies(bundle, packages, deps, scope, includeOptional, remote).ConfigureAwait(false);
     return packages;
 }
Example #5
0
 public async Task<Package[]> Process(string bundleName, bool includeOptional = false,
     BundleScope scope = BundleScope.All, bool? useVersionedPackageFolders = null,
     bool noCheckout = false, bool skipWhenLocalMatch = false) {
     var bundle = await GetCol(bundleName).ConfigureAwait(false);
     return
         await
             Process(bundle, includeOptional, scope, useVersionedPackageFolders, noCheckout,
                 skipWhenLocalMatch).ConfigureAwait(false);
 }
 public async Task<List<Package>> Checkout(Bundle bundle, bool includeOptional = false,
     BundleScope scope = BundleScope.All, bool? useVersionedPackageFolders = null) {
     Repository.Log("Processing bundle: {0}", bundle.GetFullName());
     var packages = await GetDependencyTree(bundle, includeOptional, scope, false).ConfigureAwait(false);
     return
         await PackageManager.Checkout(
             packages.Reverse().Select(x => new Dependency(x.Key, x.Value).GetFullName()).ToArray(),
             useVersionedPackageFolders);
 }
Example #7
0
        public async Task <List <Package> > Checkout(Bundle bundle, bool includeOptional = false,
                                                     BundleScope scope = BundleScope.All, bool?useVersionedPackageFolders = null)
        {
            Repository.Log("Processing bundle: {0}", bundle.GetFullName());
            var packages = await GetDependencyTree(bundle, includeOptional, scope, false).ConfigureAwait(false);

            return
                (await PackageManager.Checkout(
                     packages.Reverse().Select(x => new Dependency(x.Key, x.Value).GetFullName()).ToArray(),
                     useVersionedPackageFolders));
        }
Example #8
0
        public async Task <Package[]> Process(string bundleName, bool includeOptional = false,
                                              BundleScope scope = BundleScope.All, bool?useVersionedPackageFolders = null,
                                              bool noCheckout   = false, bool skipWhenLocalMatch = false)
        {
            var bundle = await GetCol(bundleName).ConfigureAwait(false);

            return
                (await
                 Process(bundle, includeOptional, scope, useVersionedPackageFolders, noCheckout,
                         skipWhenLocalMatch).ConfigureAwait(false));
        }
Example #9
0
        public Dictionary <string, string> GetAllPackages(BundleScope scope, bool includeOptional = false)
        {
            IEnumerable <KeyValuePair <string, string> > packages = new Collection <KeyValuePair <string, string> >();

            if (includeOptional)
            {
                packages = GetOptionalPackages(scope);
            }

            return(packages.Concat(GetPackages(scope)).ToDictionary(x => x.Key, x => x.Value));
        }
Example #10
0
        public Dictionary <string, string> GetAllOptionalPackages(BundleScope scope)
        {
            var packages = new Dictionary <string, string>();

            packages = Dependencies.Select(c => new Bundle("optional-packages"))
                       .Aggregate(packages,
                                  (current, col) =>
                                  current.Concat(col.GetAllOptionalPackages(scope))
                                  .ToDictionary(x => x.Key, x => x.Value));
            return(packages.Concat(GetOptionalPackages(scope)).ToDictionary(x => x.Key, x => x.Value));
        }
Example #11
0
        public async Task<Package[]> Process(Bundle bundle, bool includeOptional = false,
            BundleScope scope = BundleScope.All, bool? useVersionedPackageFolders = null,
            bool noCheckout = false, bool skipWhenLocalMatch = false) {
            Repository.Log("Processing bundle: {0}", bundle.GetFullName());
            var packages = await GetDependencyTree(bundle, includeOptional, scope).ConfigureAwait(false);

            return
                await
                    PackageManager.ProcessPackages(
                        packages.Reverse().Select(x => new SpecificVersion(x.Key, x.Value)).ToArray(),
                        useVersionedPackageFolders, noCheckout, skipWhenLocalMatch).ConfigureAwait(false);
        }
Example #12
0
        public async Task <Package[]> Process(Bundle bundle, bool includeOptional = false,
                                              BundleScope scope = BundleScope.All, bool?useVersionedPackageFolders = null,
                                              bool noCheckout   = false, bool skipWhenLocalMatch = false)
        {
            Repository.Log("Processing bundle: {0}", bundle.GetFullName());
            var packages = await GetDependencyTree(bundle, includeOptional, scope).ConfigureAwait(false);

            return
                (await
                 PackageManager.ProcessPackages(
                     packages.Reverse().Select(x => new SpecificVersion(x.Key, x.Value)).ToArray(),
                     useVersionedPackageFolders, noCheckout, skipWhenLocalMatch).ConfigureAwait(false));
        }
Example #13
0
 async Task AddDependencies(Bundle bundle, Dictionary <string, string> packages, List <string> deps,
                            BundleScope scope, bool includeOptional, bool remote)
 {
     foreach (var dep in bundle.Dependencies)
     {
         var d = new Dependency(dep.Key, dep.Value);
         if (deps.Contains(dep.Key))
         {
             Repository.Log("Conflicting bundle dependency {0}, skipping", dep.Key);
             continue;
         }
         deps.Add(dep.Key);
         var depCol = await GetCol(d.GetFullName(), remote).ConfigureAwait(false);
         await ResolveDependencies(depCol, packages, deps, scope, includeOptional).ConfigureAwait(false);
     }
 }
Example #14
0
 static void AddOwn(Bundle bundle, Dictionary<string, string> packages, BundleScope scope, bool includeOptional) {
     foreach (var p in bundle.GetAllPackages(scope, includeOptional))
         packages[p.Key] = p.Value;
 }
Example #15
0
 async Task AddDependencies(Bundle bundle, Dictionary<string, string> packages, List<string> deps,
     BundleScope scope, bool includeOptional, bool remote) {
     foreach (var dep in bundle.Dependencies) {
         var d = new Dependency(dep.Key, dep.Value);
         if (deps.Contains(dep.Key)) {
             Repository.Log("Conflicting bundle dependency {0}, skipping", dep.Key);
             continue;
         }
         deps.Add(dep.Key);
         var depCol = await GetCol(d.GetFullName(), remote).ConfigureAwait(false);
         await ResolveDependencies(depCol, packages, deps, scope, includeOptional).ConfigureAwait(false);
     }
 }
Example #16
0
        async Task <Dictionary <string, string> > GetDependencyTree(Bundle bundle, bool includeOptional, BundleScope scope,
                                                                    bool remote = true)
        {
            var packages = new Dictionary <string, string>();
            var deps     = new List <string>();

            PackageManager.StatusRepo.Reset(RepoStatus.Resolving, 1);
            await ResolveDependencies(bundle, packages, deps, scope, includeOptional, remote).ConfigureAwait(false);

            return(packages);
        }
Example #17
0
 async Task ResolveDependencies(Bundle bundle, Dictionary<string, string> packages,
     List<string> deps, BundleScope scope = BundleScope.All, bool includeOptional = false,
     bool remote = true) {
     await AddDependencies(bundle, packages, deps, scope, includeOptional, remote).ConfigureAwait(false);
     AddOwn(bundle, packages, scope, includeOptional);
 }