Esempio n. 1
0
        public CakeScriptGenerator(
            IBufferedFileSystem fileSystem,
            ICakeEnvironment environment,
            IGlobber globber,
            ICakeConfiguration configuration,
            IScriptProcessor processor,
            IScriptAliasFinder aliasFinder,
            ICakeAliasGenerator aliasGenerator,
            ICakeLog log,
            IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null)
        {
            _fileSystem     = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            _environment    = environment ?? throw new ArgumentNullException(nameof(environment));
            _globber        = globber ?? throw new ArgumentNullException(nameof(globber));
            _log            = log ?? throw new ArgumentNullException(nameof(log));
            _configuration  = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _processor      = processor ?? throw new ArgumentNullException(nameof(processor));
            _aliasFinder    = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder));
            _aliasGenerator = aliasGenerator ?? throw new ArgumentNullException(nameof(aliasGenerator));
            _analyzer       = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders);

            _addinRoot         = GetAddinPath(_environment.WorkingDirectory);
            _cakeRoot          = GetCakePath(GetToolPath(_environment.WorkingDirectory));
            _hostObject        = GetHostObject(_cakeRoot);
            _defaultReferences = new Lazy <ISet <FilePath> >(() => GetDefaultReferences(_cakeRoot));
        }
Esempio n. 2
0
        public CakeScriptGenerator(
            IBufferedFileSystem fileSystem,
            ICakeEnvironment environment,
            IGlobber globber,
            ICakeConfiguration configuration,
            IScriptProcessor processor,
            IScriptAliasFinder aliasFinder,
            ICakeAliasGenerator aliasGenerator,
            ICakeLog log,
            IScriptConventions scriptConventions,
            IReferenceAssemblyResolver referenceAssemblyResolver,
            IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null)
        {
            _fileSystem                = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            _environment               = environment ?? throw new ArgumentNullException(nameof(environment));
            _globber                   = globber ?? throw new ArgumentNullException(nameof(globber));
            _log                       = log ?? throw new ArgumentNullException(nameof(log));
            _configuration             = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _processor                 = processor ?? throw new ArgumentNullException(nameof(processor));
            _aliasFinder               = aliasFinder ?? throw new ArgumentNullException(nameof(aliasFinder));
            _aliasGenerator            = aliasGenerator ?? throw new ArgumentNullException(nameof(aliasGenerator));
            _analyzer                  = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders);
            _scriptConventions         = scriptConventions ?? throw new ArgumentNullException(nameof(scriptConventions));
            _referenceAssemblyResolver = referenceAssemblyResolver ?? throw new ArgumentNullException(nameof(referenceAssemblyResolver));

            _addinRoot  = GetAddinPath(_environment.WorkingDirectory);
            _hostObject = GetHostObject();
        }
Esempio n. 3
0
        public CakeScriptGenerator(
            IBufferedFileSystem fileSystem,
            ICakeEnvironment environment,
            IGlobber globber,
            ICakeConfiguration configuration,
            IScriptProcessor processor,
            IScriptAliasFinder aliasFinder,
            ICakeLog log,
            IEnumerable <ILoadDirectiveProvider> loadDirectiveProviders = null)
        {
            _fileSystem    = fileSystem ?? throw new ArgumentNullException(nameof(fileSystem));
            _environment   = environment ?? throw new ArgumentNullException(nameof(environment));
            _globber       = globber ?? throw new ArgumentNullException(nameof(globber));
            _log           = log ?? throw new ArgumentNullException(nameof(log));
            _configuration = configuration ?? throw new ArgumentNullException(nameof(configuration));
            _processor     = processor ?? throw new ArgumentNullException(nameof(processor));
            _aliasFinder   = aliasFinder ?? throw new ArgumentNullException(nameof(fileSystem));

            _analyzer = new ScriptAnalyzer(_fileSystem, _environment, _log, loadDirectiveProviders);

            var typeEmitter      = new TypeEmitter();
            var parameterEmitter = new ParameterEmitter(typeEmitter);

            _methodGenerator   = new CakeMethodAliasGenerator(typeEmitter, parameterEmitter);
            _propertyGenerator = new CakePropertyAliasGenerator(typeEmitter);
        }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptRunner"/> class.
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <param name="log">The log.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="engine">The session factory.</param>
        /// <param name="aliasFinder">The alias finder.</param>
        /// <param name="analyzer">The script analyzer.</param>
        /// <param name="processor">The script processor.</param>
        /// <param name="conventions">The script conventions.</param>
        /// <param name="assemblyLoader">The assembly loader.</param>
        public ScriptRunner(
            ICakeEnvironment environment,
            ICakeLog log,
            ICakeConfiguration configuration,
            IScriptEngine engine,
            IScriptAliasFinder aliasFinder,
            IScriptAnalyzer analyzer,
            IScriptProcessor processor,
            IScriptConventions conventions,
            IAssemblyLoader assemblyLoader)
        {
            if (environment == null)
            {
                throw new ArgumentNullException(nameof(environment));
            }
            if (log == null)
            {
                throw new ArgumentNullException(nameof(log));
            }
            if (configuration == null)
            {
                throw new ArgumentNullException(nameof(configuration));
            }
            if (engine == null)
            {
                throw new ArgumentNullException(nameof(engine));
            }
            if (aliasFinder == null)
            {
                throw new ArgumentNullException(nameof(aliasFinder));
            }
            if (analyzer == null)
            {
                throw new ArgumentNullException(nameof(analyzer));
            }
            if (processor == null)
            {
                throw new ArgumentNullException(nameof(processor));
            }
            if (conventions == null)
            {
                throw new ArgumentNullException(nameof(conventions));
            }
            if (assemblyLoader == null)
            {
                throw new ArgumentNullException(nameof(assemblyLoader));
            }

            _environment    = environment;
            _log            = log;
            _configuration  = configuration;
            _engine         = engine;
            _aliasFinder    = aliasFinder;
            _analyzer       = analyzer;
            _processor      = processor;
            _conventions    = conventions;
            _assemblyLoader = assemblyLoader;
        }
Esempio n. 5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ScriptRunner"/> class.
        /// </summary>
        /// <param name="environment">The environment.</param>
        /// <param name="log">The log.</param>
        /// <param name="configuration">The configuration.</param>
        /// <param name="engine">The session factory.</param>
        /// <param name="aliasFinder">The alias finder.</param>
        /// <param name="analyzer">The script analyzer.</param>
        /// <param name="processor">The script processor.</param>
        /// <param name="conventions">The script conventions.</param>
        public ScriptRunner(
            ICakeEnvironment environment,
            ICakeLog log,
            ICakeConfiguration configuration,
            IScriptEngine engine,
            IScriptAliasFinder aliasFinder,
            IScriptAnalyzer analyzer,
            IScriptProcessor processor,
            IScriptConventions conventions)
        {
            if (environment == null)
            {
                throw new ArgumentNullException("environment");
            }
            if (log == null)
            {
                throw new ArgumentNullException("log");
            }
            if (configuration == null)
            {
                throw new ArgumentNullException("configuration");
            }
            if (engine == null)
            {
                throw new ArgumentNullException("engine");
            }
            if (aliasFinder == null)
            {
                throw new ArgumentNullException("aliasFinder");
            }
            if (analyzer == null)
            {
                throw new ArgumentNullException("analyzer");
            }
            if (processor == null)
            {
                throw new ArgumentNullException("processor");
            }
            if (conventions == null)
            {
                throw new ArgumentNullException("conventions");
            }

            _environment   = environment;
            _log           = log;
            _configuration = configuration;
            _engine        = engine;
            _aliasFinder   = aliasFinder;
            _analyzer      = analyzer;
            _processor     = processor;
            _conventions   = conventions;
        }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ScriptRunner"/> class.
 /// </summary>
 /// <param name="engine">The session factory.</param>
 /// <param name="aliasFinder">The alias finder.</param>
 /// <param name="scriptProcessor">The script processor.</param>
 public ScriptRunner(IScriptEngine engine, IScriptAliasFinder aliasFinder, IScriptProcessor scriptProcessor)
 {
     if (engine == null)
     {
         throw new ArgumentNullException("engine");
     }
     if (aliasFinder == null)
     {
         throw new ArgumentNullException("aliasFinder");
     }
     _engine          = engine;
     _aliasFinder     = aliasFinder;
     _scriptProcessor = scriptProcessor;
 }
Esempio n. 7
0
 public CachingScriptAliasFinder(IScriptAliasFinder scriptAliasFinder, ICakeEnvironment environment)
 {
     _scriptAliasFinder = scriptAliasFinder ?? throw new ArgumentNullException(nameof(scriptAliasFinder));
     _cache             = new Dictionary <FilePath, IReadOnlyCollection <CakeScriptAlias> >(new PathComparer(environment));
 }