コード例 #1
0
        internal static int Run(IEnumerable <string> arguments, IEnumerable <string> extraArguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader)
        {
            var client            = new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader);
            var clientDir         = AppDomain.CurrentDomain.BaseDirectory;
            var sdkDir            = RuntimeEnvironment.GetRuntimeDirectory();
            var workingDir        = Directory.GetCurrentDirectory();
            var buildPaths        = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: sdkDir);
            var originalArguments = BuildClient.GetCommandLineArgs(arguments).Concat(extraArguments).ToArray();

            return(client.RunCompilation(originalArguments, buildPaths).ExitCode);
        }
コード例 #2
0
ファイル: BuildClient.cs プロジェクト: sinclair83/roslyn
        internal static int Run(IEnumerable <string> arguments, RequestLanguage language, CompileFunc compileFunc, ICompilerServerLogger logger, Guid?requestId = null)
        {
            var sdkDir = GetSystemSdkDirectory();

            if (RuntimeHostInfo.IsCoreClrRuntime)
            {
                // Register encodings for console
                // https://github.com/dotnet/roslyn/issues/10785
                System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);
            }

            var client            = new BuildClient(language, compileFunc, logger);
            var clientDir         = AppContext.BaseDirectory;
            var workingDir        = Directory.GetCurrentDirectory();
            var tempDir           = BuildServerConnection.GetTempPath(workingDir);
            var buildPaths        = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: sdkDir, tempDir: tempDir);
            var originalArguments = GetCommandLineArgs(arguments);

            return(client.RunCompilation(originalArguments, buildPaths, requestId: requestId).ExitCode);
        }