示例#1
0
        public void Register(ICakeContainerRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }

            registry.RegisterInstance(_options).As <CakeOptions>();
            registry.RegisterType <CakeArguments>().As <ICakeArguments>().Singleton();
        }
示例#2
0
        /// <summary>
        /// Performs custom registrations in the provided registry.
        /// </summary>
        /// <param name="registry">The container registry.</param>
        public void Register(ICakeContainerRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }

            // NuGet addins support
            registry.RegisterType <NuGetVersionUtilityAdapter>().As <INuGetFrameworkCompatibilityFilter>().As <IFrameworkNameParser>().Singleton();
            registry.RegisterType <NuGetPackageAssembliesLocator>().As <INuGetPackageAssembliesLocator>().Singleton();
            registry.RegisterType <NuGetPackageReferenceBundler>().As <INuGetPackageReferenceBundler>().Singleton();
            registry.RegisterType <NuGetAssemblyCompatibilityFilter>().As <INuGetAssemblyCompatibilityFilter>().Singleton();
            registry.RegisterType <AssemblyFrameworkNameParser>().As <IAssemblyFrameworkNameParser>().Singleton();

            // URI resource support.
            registry.RegisterType <NuGetPackageInstaller>().As <IPackageInstaller>().Singleton();
            registry.RegisterType <NuGetPackageContentResolver>().As <INuGetPackageContentResolver>().Singleton();
        }
示例#3
0
        public void Register(ICakeContainerRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }

            // Are we running on Mono?
            var mono = _options.Mono;

            if (!mono)
            {
                mono = Type.GetType("Mono.Runtime") != null;
            }

            if (mono)
            {
                // Mono compiler
                registry.RegisterType <MonoScriptEngine>().As <IScriptEngine>().Singleton();
            }
            else
            {
                // Roslyn
                registry.RegisterType <RoslynScriptEngine>().As <IScriptEngine>().Singleton();

                if (_options.PerformDebug)
                {
                    // Debug
                    registry.RegisterType <DebugRoslynScriptSessionFactory>().As <RoslynScriptSessionFactory>().Singleton();
                    registry.RegisterType <DebugRoslynNightlyScriptSessionFactory>().As <RoslynNightlyScriptSessionFactory>().Singleton();
                }
                else
                {
                    // Default
                    registry.RegisterType <DefaultRoslynScriptSessionFactory>().As <RoslynScriptSessionFactory>().Singleton();
                    registry.RegisterType <DefaultRoslynNightlyScriptSessionFactory>().As <RoslynNightlyScriptSessionFactory>().Singleton();
                }
            }
        }
示例#4
0
        public void Register(ICakeContainerRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }

            // Core services.
            registry.RegisterType <CakeReportPrinter>().As <ICakeReportPrinter>().Singleton();
            registry.RegisterType <CakeConsole>().As <IConsole>().Singleton();

            // Modules
            registry.RegisterType <ModuleSearcher>().Singleton();
            registry.RegisterType <ModuleLoader>().Singleton();

            // Configuration
            registry.RegisterType <CakeConfigurationProvider>().Singleton();

            // Cake services.
            registry.RegisterType <ArgumentParser>().As <IArgumentParser>().Singleton();
            registry.RegisterType <CommandFactory>().As <ICommandFactory>().Singleton();
            registry.RegisterType <CakeApplication>().Singleton();
            registry.RegisterType <CakeBuildLog>().As <ICakeLog>().Singleton();
            registry.RegisterType <VerbosityParser>().Singleton();
            registry.RegisterType <CakeDebugger>().As <IDebugger>().Singleton();

            // Scripting
            registry.RegisterType <BuildScriptHost>().Singleton();
            registry.RegisterType <DescriptionScriptHost>().Singleton();
            registry.RegisterType <DryRunScriptHost>().Singleton();

            // Register commands.
            registry.RegisterType <BuildCommand>().AsSelf().Transient();
            registry.RegisterType <DebugCommand>().AsSelf().Transient();
            registry.RegisterType <DescriptionCommand>().AsSelf().Transient();
            registry.RegisterType <DryRunCommand>().AsSelf().Transient();
            registry.RegisterType <HelpCommand>().AsSelf().Transient();
            registry.RegisterType <VersionCommand>().AsSelf().Transient();
        }
示例#5
0
 public void Register(ICakeContainerRegistry registry)
 {
     registry.RegisterType <GithubPackageInstaller>().As <IPackageInstaller>().Singleton();
 }
示例#6
0
        /// <summary>
        /// Performs custom registrations in the provided registry.
        /// </summary>
        /// <param name="registry">The container registry.</param>
        public void Register(ICakeContainerRegistry registry)
        {
            if (registry == null)
            {
                throw new ArgumentNullException("registry");
            }

            // Execution
            registry.RegisterType <CakeEngine>().As <ICakeEngine>().Singleton();
            registry.RegisterType <CakeContext>().As <ICakeContext>().Singleton();

            // Environment
            registry.RegisterType <CakeEnvironment>().As <ICakeEnvironment>().Singleton();
            registry.RegisterType <CakeRuntime>().As <ICakeRuntime>().Singleton();
            registry.RegisterType <CakePlatform>().As <ICakePlatform>().Singleton();

            // IO
            registry.RegisterType <FileSystem>().As <IFileSystem>().Singleton();
            registry.RegisterType <Globber>().As <IGlobber>().Singleton();
            registry.RegisterType <ProcessRunner>().As <IProcessRunner>().Singleton();
            registry.RegisterType <NuGetToolResolver>().As <INuGetToolResolver>().Singleton();
            registry.RegisterType <WindowsRegistry>().As <IRegistry>().Singleton();

            // Tooling
            registry.RegisterType <ToolRepository>().As <IToolRepository>().Singleton();
            registry.RegisterType <ToolResolutionStrategy>().As <IToolResolutionStrategy>().Singleton();
            registry.RegisterType <ToolLocator>().As <IToolLocator>().Singleton();

            // Scripting
            registry.RegisterType <ScriptAliasFinder>().As <IScriptAliasFinder>().Singleton();
            registry.RegisterType <ScriptAnalyzer>().As <IScriptAnalyzer>().Singleton();
            registry.RegisterType <ScriptProcessor>().As <IScriptProcessor>().Singleton();
            registry.RegisterType <ScriptConventions>().As <IScriptConventions>().Singleton();
            registry.RegisterType <ScriptRunner>().As <IScriptRunner>().Singleton();
        }