示例#1
0
        public CakeHost(CakeHostOptions options, CakeHostServices services, ILifetimeScope scope,
                        IFrostingContext context,
                        IEnumerable <IFrostingTask> tasks = null, IFrostingLifetime lifetime = null, IFrostingTaskLifetime taskLifetime = null)
        {
            Guard.ArgumentNotNull(scope, nameof(scope));
            Guard.ArgumentNotNull(services, nameof(services));
            Guard.ArgumentNotNull(context, nameof(context));
            Guard.ArgumentNotNull(options, nameof(options));

            _options      = options;
            _scope        = scope; // Keep the scope alive.
            _context      = context;
            _tasks        = tasks;
            _lifetime     = lifetime;
            _taskLifetime = taskLifetime;

            _environment       = services.Environment;
            _engine            = services.Engine;
            _log               = services.Log;
            _commandFactory    = services.CommandFactory;
            _engineInitializer = services.EngineInitializer;
        }
示例#2
0
        public CakeHost(IFrostingContext context, Container container, CakeHostOptions options,
                        IFileSystem fileSystem, ICakeEnvironment environment, ICakeEngine engine, ICakeLog log,
                        IToolInstaller installer, IEnumerable <PackageReference> tools,
                        EngineInitializer engineInitializer, CommandFactory commandFactory,
                        WorkingDirectory workingDirectory = null, IEnumerable <IFrostingTask> tasks  = null,
                        IFrostingLifetime lifetime        = null, IFrostingTaskLifetime taskLifetime = null)
        {
            Guard.ArgumentNotNull(context, nameof(context));
            Guard.ArgumentNotNull(container, nameof(container));
            Guard.ArgumentNotNull(options, nameof(options));
            Guard.ArgumentNotNull(fileSystem, nameof(fileSystem));
            Guard.ArgumentNotNull(environment, nameof(environment));
            Guard.ArgumentNotNull(engine, nameof(engine));
            Guard.ArgumentNotNull(log, nameof(log));
            Guard.ArgumentNotNull(engineInitializer, nameof(engineInitializer));
            Guard.ArgumentNotNull(commandFactory, nameof(commandFactory));

            // Mandatory arguments.
            _context           = context;
            _container         = container;
            _options           = options;
            _fileSystem        = fileSystem;
            _environment       = environment;
            _engine            = engine;
            _log               = log;
            _installer         = installer;
            _tools             = new List <PackageReference>(tools ?? Enumerable.Empty <PackageReference>());
            _engineInitializer = engineInitializer;
            _commandFactory    = commandFactory;

            // Optional arguments.
            _workingDirectory = workingDirectory;
            _tasks            = tasks;
            _lifetime         = lifetime;
            _taskLifetime     = taskLifetime;
        }