コード例 #1
0
        public static ProjectData SetupProjectData(this ICakeContext context)
        {
            var service = context.Data as ICakeDataService;

            if (service == null)
            {
                throw new ArgumentNullException("service", "Could not parse context.Data to ICakeDataService");
            }

            context.AddErrorListener((task, error) => {
                context.Error($"{task} : {error.Message}");
                context.Error($"{error.StackTrace}");
            });

            var data = new ProjectData(context, context.GlobalArguments());

            service.Add(data);

            if (context is ISetupContext setupContext)
            {
                setupContext.TasksToExecute.Select(c => c as CakeTask).Execute(t => {
                    t.AddDelayedAction(delayContext => {
                        data.CurrentTask = t;
                    });
                });
                setupContext.InvokeSetup(data);
            }



            return(data);
        }