コード例 #1
0
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            try
            {
                var commandFactory    = new DotNetCommandFactory();
                var scriptRunner      = new ScriptRunner();
                var managedCompiler   = new ManagedCompiler(scriptRunner, commandFactory);
                var nativeCompiler    = new NativeCompiler();
                var compilationDriver = new CompilationDriver(managedCompiler, nativeCompiler);

                var compilerCommandArgs = new CompilerCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform");

                return(compilerCommandArgs.Execute(compilationDriver.Compile, args));
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.Error.WriteLine(ex);
#else
                Console.Error.WriteLine(ex.Message);
#endif
                return(1);
            }
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: krytarowski/cli
        public static int Run(string[] args)
        {
            DebugHelper.HandleDebugSwitch(ref args);

            try
            {
                var commandFactory = new DotNetCommandFactory();
                var scriptRunner = new ScriptRunner();
                var managedCompiler = new ManagedCompiler(scriptRunner, commandFactory);
                var nativeCompiler = new NativeCompiler();
                var compilationDriver = new CompilationDriver(managedCompiler, nativeCompiler);

                var compilerCommandArgs = new CompilerCommandApp("dotnet compile", ".NET Compiler", "Compiler for the .NET Platform");

                return compilerCommandArgs.Execute(compilationDriver.Compile, args);
            }
            catch (Exception ex)
            {
#if DEBUG
                Console.Error.WriteLine(ex);
#else
                Console.Error.WriteLine(ex.Message);
#endif
                return 1;
            }
        }
コード例 #3
0
        public void It_does_not_compile_native_when_the_native_parameter_is_not_passed()
        {
            var compilerController = new CompilationDriver(_managedCompilerMock.Object, _nativeCompilerMock.Object);

            compilerController.Compile(_contexts, _args);

            _nativeCompilerMock.Verify(c => c.Compile(It.IsAny<ProjectContext>(), It.IsAny<CompilerCommandApp>()), Times.Never);
        }
コード例 #4
0
        public void It_compiles_all_project_contexts()
        {
            var compiledProjectContexts = new List<ProjectContext>();
            _managedCompilerMock.Setup(c => c
                .Compile(It.IsAny<ProjectContext>(), It.IsAny<CompilerCommandApp>()))
                .Callback<ProjectContext, CompilerCommandApp>((p, c) => compiledProjectContexts.Add(p))
                .Returns(true);

            var compilerController = new CompilationDriver(_managedCompilerMock.Object, _nativeCompilerMock.Object);

            compilerController.Compile(_contexts, _args);

            compiledProjectContexts.Should().BeEquivalentTo(_contexts);
        }