public bool TryCreateCompiler(RunRequest request, out CommonCompiler compiler)
        {
            var buildPaths = new BuildPaths(ClientDirectory, request.CurrentDirectory, SdkDirectory, request.TempDirectory);

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

            default:
                compiler = null;
                return(false);
            }
        }
        public BuildResponse RunCompilation(RunRequest request, CancellationToken cancellationToken)
        {
            Log($"CurrentDirectory = '{request.CurrentDirectory}'");
            Log($"LIB = '{request.LibDirectory}'");
            for (int i = 0; i < request.Arguments.Length; ++i)
            {
                Log($"Argument[{i}] = '{request.Arguments[i]}'");
            }

            // Compiler server must be provided with a valid temporary directory in order to correctly
            // isolate signing between compilations.
            if (string.IsNullOrEmpty(request.TempDirectory))
            {
                Log($"Rejecting build due to missing temp directory");
                return(new RejectedBuildResponse());
            }

            CommonCompiler compiler;

            if (!TryCreateCompiler(request, out compiler))
            {
                // We can't do anything with a request we don't know about.
                Log($"Got request with id '{request.Language}'");
                return(new RejectedBuildResponse());
            }

            bool utf8output = compiler.Arguments.Utf8Output;

            if (!CheckAnalyzers(request.CurrentDirectory, compiler.Arguments.AnalyzerReferences))
            {
                return(new AnalyzerInconsistencyBuildResponse());
            }

            Log($"****Running {request.Language} compiler...");
            TextWriter output     = new StringWriter(CultureInfo.InvariantCulture);
            int        returnCode = compiler.Run(output, cancellationToken);

            Log($"****{request.Language} Compilation complete.\r\n****Return code: {returnCode}\r\n****Output:\r\n{output.ToString()}\r\n");
            return(new CompletedBuildResponse(returnCode, utf8output, output.ToString()));
        }