Exemple #1
0
        internal static int Run(string[] args)
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = CommonCompiler.GetResponseFileFullPath(VisualBasicCompiler.ResponseFileName);
            Vbc compiler     = new Vbc(responseFile, Directory.GetCurrentDirectory(), args);

            // We store original encoding and restore it later to revert
            // the changes that might be done by /utf8output options
            // NOTE: original encoding may not be restored if process terminated
            Encoding origEncoding = Console.OutputEncoding;

            try
            {
                if (compiler.Arguments.Utf8Output && Console.IsOutputRedirected)
                {
                    Console.OutputEncoding = Encoding.UTF8;
                }
                return(compiler.Run(Console.Out, default(CancellationToken)));
            }
            finally
            {
                try
                {
                    Console.OutputEncoding = origEncoding;
                }
                catch
                { // Try to reset the output encoding, ignore if we can't
                }
            }
        }
Exemple #2
0
        internal static int Run(string[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = Path.Combine(buildPaths.ClientDirectory, VisualBasicCompiler.ResponseFileName);
            var compiler = new Vbc(responseFile, buildPaths, args, analyzerLoader);
            return ConsoleUtil.RunWithUtf8Output(compiler.Arguments.Utf8Output, textWriter, tw => compiler.Run(tw));
        }
Exemple #3
0
        internal static int Run(string clientDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = Path.Combine(clientDirectory, VisualBasicCompiler.ResponseFileName);
            Vbc compiler = new Vbc(responseFile, clientDirectory, Directory.GetCurrentDirectory(), sdkDirectory, args, analyzerLoader);

            return ConsoleUtil.RunWithOutput(compiler.Arguments.Utf8Output, (textWriterOut, _) => compiler.Run(textWriterOut));
        }
Exemple #4
0
 public static int Run(
     string[] args,
     string clientDir,
     string workingDir,
     string sdkDir,
     string tempDir,
     TextWriter textWriter,
     IAnalyzerAssemblyLoader analyzerLoader
     ) =>
 Vbc.Run(
     args,
     new BuildPaths(
         clientDir: clientDir,
         workingDir: workingDir,
         sdkDir: sdkDir,
         tempDir: tempDir
         ),
     textWriter,
     analyzerLoader
     );
Exemple #5
0
        internal static int Run(
            string[] args,
            BuildPaths buildPaths,
            TextWriter textWriter,
            IAnalyzerAssemblyLoader analyzerLoader
            )
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = Path.Combine(
                buildPaths.ClientDirectory,
                VisualBasicCompiler.ResponseFileName
                );
            var compiler = new Vbc(responseFile, buildPaths, args, analyzerLoader);

            return(ConsoleUtil.RunWithUtf8Output(
                       compiler.Arguments.Utf8Output,
                       textWriter,
                       tw => compiler.Run(tw)
                       ));
        }
Exemple #6
0
        internal static int Run(string clientDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = Path.Combine(clientDirectory, VisualBasicCompiler.ResponseFileName);
            Vbc compiler     = new Vbc(responseFile, clientDirectory, Directory.GetCurrentDirectory(), sdkDirectory, args, analyzerLoader);

            return(ConsoleUtil.RunWithOutput(compiler.Arguments.Utf8Output, (textWriterOut, _) => compiler.Run(textWriterOut)));
        }
Exemple #7
0
 public static int Main(string[] args)
 => Vbc.Run(args: args,
            clientDirectory: AppContext.BaseDirectory,
            sdkDirectory: @"C:\Windows\Microsoft.NET\Framework\v4.0.30319",
            analyzerLoader: CoreClrAnalyzerAssemblyLoader.CreateAndSetDefault());
Exemple #8
0
 public static int Main(string[] args)
 => Vbc.Run(args: args,
            clientDirectory: AppContext.BaseDirectory,
            sdkDirectory: @"C:\Windows\Microsoft.NET\Framework\v4.0.30319",
            analyzerLoader: new NoOpAnalyzerAssemblyLoader());