Пример #1
0
        public bool TryCreateCompiler(RunRequest request, out CommonCompiler compiler)
        {
            switch (request.Language)
            {
            case LanguageNames.CSharp:
                compiler = new CSharpCompilerServer(
                    this,
                    args: request.Arguments,
                    clientDirectory: ClientDirectory,
                    baseDirectory: request.CurrentDirectory,
                    sdkDirectory: SdkDirectory,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            case LanguageNames.VisualBasic:
                compiler = new VisualBasicCompilerServer(
                    this,
                    args: request.Arguments,
                    clientDirectory: ClientDirectory,
                    baseDirectory: request.CurrentDirectory,
                    sdkDirectory: SdkDirectory,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            default:
                compiler = null;
                return(false);
            }
        }
Пример #2
0
 public bool TryCreateCompiler(RunRequest request, out CommonCompiler compiler)
 {
     var buildPaths = new BuildPaths(ClientDirectory, request.CurrentDirectory, SdkDirectory, request.TempDirectory);
     switch (request.Language)
     {
         case LanguageNames.CSharp:
             compiler = new CSharpCompilerServer(
                 AssemblyReferenceProvider,
                 args: request.Arguments,
                 buildPaths: buildPaths,
                 libDirectory: request.LibDirectory,
                 analyzerLoader: AnalyzerAssemblyLoader);
             return true;
         case LanguageNames.VisualBasic:
             compiler = new VisualBasicCompilerServer(
                 AssemblyReferenceProvider,
                 args: request.Arguments,
                 buildPaths: buildPaths,
                 libDirectory: request.LibDirectory,
                 analyzerLoader: AnalyzerAssemblyLoader);
             return true;
         default:
             compiler = null;
             return false;
     }
 }
Пример #3
0
        public bool TryCreateCompiler(RunRequest request, BuildPaths buildPaths, [NotNullWhen(true)] out CommonCompiler?compiler)
        {
            switch (request.Language)
            {
            case LanguageNames.CSharp:
                compiler = new CSharpCompilerServer(
                    AssemblyReferenceProvider,
                    args: request.Arguments,
                    buildPaths: buildPaths,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            case LanguageNames.VisualBasic:
                compiler = new VisualBasicCompilerServer(
                    AssemblyReferenceProvider,
                    args: request.Arguments,
                    buildPaths: buildPaths,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            default:
                compiler = null;
                return(false);
            }
        }
Пример #4
0
        /// <summary>
        /// Invoke the VB compiler with the given arguments and current directory, and send output and error
        /// to the given TextWriters.
        /// </summary>
        private int BasicCompile(
            string responseFileDirectory,
            string currentDirectory,
            string libDirectory,
            string tempPath,
            string[] commandLineArguments,
            TextWriter output,
            CancellationToken cancellationToken,
            out bool utf8output)
        {
            CompilerServerLogger.Log("CurrentDirectory = '{0}'", currentDirectory);
            CompilerServerLogger.Log("LIB = '{0}'", libDirectory);
            for (int i = 0; i < commandLineArguments.Length; ++i)
            {
                CompilerServerLogger.Log("Argument[{0}] = '{1}'", i, commandLineArguments[i]);
            }

            return(VisualBasicCompilerServer.RunCompiler(
                       responseFileDirectory,
                       commandLineArguments,
                       currentDirectory,
                       libDirectory,
                       tempPath,
                       output,
                       cancellationToken,
                       out utf8output));
        }
Пример #5
0
        public bool TryCreateCompiler(RunRequest request, out CommonCompiler compiler)
        {
            var buildPaths = new BuildPaths(ClientDirectory, request.CurrentDirectory, SdkDirectory, request.TempDirectory);

            switch (request.Language)
            {
            case LanguageNames.CSharp:
                compiler = new CSharpCompilerServer(
                    AssemblyReferenceProvider,
                    args: request.Arguments,
                    buildPaths: buildPaths,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            case LanguageNames.VisualBasic:
                compiler = new VisualBasicCompilerServer(
                    AssemblyReferenceProvider,
                    args: request.Arguments,
                    buildPaths: buildPaths,
                    libDirectory: request.LibDirectory,
                    analyzerLoader: AnalyzerAssemblyLoader);
                return(true);

            default:
                compiler = null;
                return(false);
            }
        }
 public bool TryCreateCompiler(RunRequest request, out CommonCompiler compiler)
 {
     switch (request.Language)
     {
         case LanguageNames.CSharp:
             compiler = new CSharpCompilerServer(
                 this,
                 args: request.Arguments,
                 clientDirectory: ClientDirectory,
                 baseDirectory: request.CurrentDirectory,
                 sdkDirectory: SdkDirectory,
                 libDirectory: request.LibDirectory,
                 analyzerLoader: AnalyzerAssemblyLoader);
             return true;
         case LanguageNames.VisualBasic:
             compiler = new VisualBasicCompilerServer(
                 this,
                 args: request.Arguments,
                 clientDirectory: ClientDirectory,
                 baseDirectory: request.CurrentDirectory,
                 sdkDirectory: SdkDirectory,
                 libDirectory: request.LibDirectory,
                 analyzerLoader: AnalyzerAssemblyLoader);
             return true;
         default:
             compiler = null;
             return false;
     }
 }
Пример #7
0
        public static int RunCompiler(
            string[] args,
            string baseDirectory,
            string libDirectory,
            TextWriter output,
            CancellationToken cancellationToken,
            out bool utf8output)
        {
            VisualBasicCompilerServer compiler = new VisualBasicCompilerServer(BasicResponseFileName, args, baseDirectory, libDirectory);

            utf8output = compiler.Arguments.Utf8Output;
            return(compiler.Run(output, cancellationToken));
        }
 public static int RunCompiler(
     string clientDirectory,
     string[] args,
     string baseDirectory,
     string sdkDirectory,
     string libDirectory,
     TextWriter output,
     CancellationToken cancellationToken,
     out bool utf8output)
 {
     var compiler = new VisualBasicCompilerServer(args, clientDirectory, baseDirectory, sdkDirectory, libDirectory);
     utf8output = compiler.Arguments.Utf8Output;
     return compiler.Run(output, cancellationToken);
 }
 public static int RunCompiler(
     string responseFileDirectory,
     string[] args,
     string baseDirectory,
     string libDirectory,
     string tempPath,
     TextWriter output,
     CancellationToken cancellationToken,
     out bool utf8output)
 {
     var responseFile = Path.Combine(responseFileDirectory, VisualBasicCompiler.ResponseFileName);
     var compiler = new VisualBasicCompilerServer(responseFile, args, baseDirectory, libDirectory, tempPath);
     utf8output = compiler.Arguments.Utf8Output;
     return compiler.Run(output, cancellationToken);
 }
Пример #10
0
        public static int RunCompiler(
            string responseFileDirectory,
            string[] args,
            string baseDirectory,
            string libDirectory,
            string tempPath,
            TextWriter output,
            CancellationToken cancellationToken,
            out bool utf8output)
        {
            var responseFile = Path.Combine(responseFileDirectory, VisualBasicCompiler.ResponseFileName);
            var compiler     = new VisualBasicCompilerServer(responseFile, args, baseDirectory, libDirectory, tempPath);

            utf8output = compiler.Arguments.Utf8Output;
            return(compiler.Run(output, cancellationToken));
        }
Пример #11
0
        public static BuildResponse RunCompiler(
            string clientDirectory,
            string[] args,
            string baseDirectory,
            string sdkDirectory,
            string libDirectory,
            IAnalyzerAssemblyLoader analyzerLoader,
            CancellationToken cancellationToken)
        {
            var  compiler   = new VisualBasicCompilerServer(args, clientDirectory, baseDirectory, sdkDirectory, libDirectory, analyzerLoader);
            bool utf8output = compiler.Arguments.Utf8Output;

            if (!AnalyzerConsistencyChecker.Check(baseDirectory, compiler.Arguments.AnalyzerReferences, analyzerLoader))
            {
                return(new AnalyzerInconsistencyBuildResponse());
            }

            TextWriter output     = new StringWriter(CultureInfo.InvariantCulture);
            int        returnCode = compiler.Run(output, cancellationToken);

            return(new CompletedBuildResponse(returnCode, utf8output, output.ToString(), string.Empty));
        }
Пример #12
0
        public static int RunCompiler(
            string clientDirectory,
            string[] args,
            string baseDirectory,
            string sdkDirectory,
            string libDirectory,
            IAnalyzerAssemblyLoader analyzerLoader,
            TextWriter output,
            CancellationToken cancellationToken,
            out bool utf8output)
        {
            var compiler = new VisualBasicCompilerServer(args, clientDirectory, baseDirectory, sdkDirectory, libDirectory, analyzerLoader);

            utf8output = compiler.Arguments.Utf8Output;

            foreach (var analyzer in compiler.Arguments.AnalyzerReferences)
            {
                CompilerServerFileWatcher.AddPath(analyzer.FilePath);
            }

            return(compiler.Run(output, cancellationToken));
        }
Пример #13
0
        public static BuildResponse RunCompiler(
            string clientDirectory,
            string[] args,
            string baseDirectory,
            string sdkDirectory,
            string libDirectory,
            IAnalyzerAssemblyLoader analyzerLoader,
            CancellationToken cancellationToken)
        {
            var compiler = new VisualBasicCompilerServer(args, clientDirectory, baseDirectory, sdkDirectory, libDirectory, analyzerLoader);
            bool utf8output = compiler.Arguments.Utf8Output;

            if (!AnalyzerConsistencyChecker.Check(baseDirectory, compiler.Arguments.AnalyzerReferences, analyzerLoader))
            {
                return new AnalyzerInconsistencyBuildResponse();
            }

            TextWriter output = new StringWriter(CultureInfo.InvariantCulture);
            int returnCode = compiler.Run(output, cancellationToken);

            return new CompletedBuildResponse(returnCode, utf8output, output.ToString(), string.Empty);
        }
        /// <summary>
        /// Invoke the VB compiler with the given arguments and current directory, and send output and error
        /// to the given TextWriters.
        /// </summary>
        private BuildResponse BasicCompile(
            string responseFileDirectory,
            string currentDirectory,
            string libDirectory,
            string[] commandLineArguments,
            CancellationToken cancellationToken)
        {
            CompilerServerLogger.Log("CurrentDirectory = '{0}'", currentDirectory);
            CompilerServerLogger.Log("LIB = '{0}'", libDirectory);
            for (int i = 0; i < commandLineArguments.Length; ++i)
            {
                CompilerServerLogger.Log("Argument[{0}] = '{1}'", i, commandLineArguments[i]);
            }

            return(VisualBasicCompilerServer.RunCompiler(
                       responseFileDirectory,
                       commandLineArguments,
                       currentDirectory,
                       RuntimeEnvironment.GetRuntimeDirectory(),
                       libDirectory,
                       AnalyzerLoader,
                       cancellationToken));
        }
 public static int RunCompiler(string[] args, string baseDirectory, string libDirectory, TextWriter output, CancellationToken cancellationToken)
 {
     VisualBasicCompilerServer compiler = new VisualBasicCompilerServer(BasicResponseFileName, args, baseDirectory, libDirectory);
     return compiler.Run(output, cancellationToken);
 }