Ejemplo n.º 1
0
        public void Execute(RippleInput input, IRippleStepRunner runner)
        {
            var feeds = Solution.Feeds.ToArray();

            if (input is IOverrideFeeds)
            {
                var overrides = input.As<IOverrideFeeds>().Feeds();
                if (overrides.Any())
                {
                    Solution.ClearFeeds();
                    Solution.AddFeeds(overrides);
                }
            }

            var missing = Solution.MissingNugets().ToList();
            var nugets = new List<INugetFile>();
            var report = new MissingNugetReport();

            if (missing.Any())
            {
                var tasks = missing.Select(x => restore(x, Solution, report, nugets)).ToArray();
                Task.WaitAll(tasks);
            }

            Solution.ClearFeeds();
            Solution.AddFeeds(feeds);

            if (!report.IsValid())
            {
                RippleLog.InfoMessage(report);
                RippleAssert.Fail("Could not restore dependencies");
            }

            runner.Set(new DownloadedNugets(nugets));
        }
Ejemplo n.º 2
0
        public void Execute(RippleInput input, IRippleStepRunner runner)
        {
            var feeds = Solution.Feeds.ToArray();

            if (input is IOverrideFeeds)
            {
                var overrides = input.As <IOverrideFeeds>().Feeds();
                if (overrides.Any())
                {
                    Solution.ClearFeeds();
                    Solution.AddFeeds(overrides);
                }
            }

            if (input is IAllowExplicitBranch)
            {
                var branchingInput = input.As <IAllowExplicitBranch>();
                if (branchingInput.BranchFlag.IsNotEmpty())
                {
                    BranchDetector.SetBranch(branchingInput.BranchFlag);
                }
            }

            var missing = Solution.MissingNugets().ToList();
            var nugets  = new List <INugetFile>();
            var report  = new MissingNugetReport();

            if (missing.Any())
            {
                var tasks = missing.Select(x => restore(x, Solution, report, nugets)).ToArray();
                Task.WaitAll(tasks);
            }

            Solution.ClearFeeds();
            Solution.AddFeeds(feeds);

            if (!report.IsValid())
            {
                RippleLog.InfoMessage(report);
                RippleAssert.Fail("Could not restore dependencies");
            }

            runner.Set(new DownloadedNugets(nugets));
        }
Ejemplo n.º 3
0
        private static Task restore(Dependency query, Solution solution, MissingNugetReport report, List<INugetFile> nugets)
        {
            RippleLog.Debug("Restoring " + query);

            var result = solution.Restore(query);
            return result.ContinueWith(task =>
            {
                if (!task.Result.Found)
                {
                    report.Add(query);
                    report.AddProblems(task.Result.Problems);
                    return;
                }

                var nuget = task.Result.Nuget;
                RippleLog.Debug("Downloading " + nuget);

                nugets.Add(nuget.DownloadTo(solution, solution.PackagesDirectory()));
            }, TaskContinuationOptions.NotOnFaulted);
        }
Ejemplo n.º 4
0
        private static Task restore(Dependency query, Solution solution, MissingNugetReport report, List <INugetFile> nugets)
        {
            RippleLog.Debug("Restoring " + query);

            var result = solution.Restore(query);

            return(result.ContinueWith(task =>
            {
                if (!task.Result.Found)
                {
                    report.Add(query);
                    report.AddProblems(task.Result.Problems);
                    return;
                }

                var nuget = task.Result.Nuget;
                RippleLog.Debug("Downloading " + nuget);

                nugets.Add(nuget.DownloadTo(solution, solution.PackagesDirectory()));
            }, TaskContinuationOptions.NotOnFaulted));
        }