當前位置: 首頁>>代碼示例>>C#>>正文


C# CommandLine.BuildPaths類代碼示例

本文整理匯總了C#中Microsoft.CodeAnalysis.CommandLine.BuildPaths的典型用法代碼示例。如果您正苦於以下問題:C# BuildPaths類的具體用法?C# BuildPaths怎麽用?C# BuildPaths使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


BuildPaths類屬於Microsoft.CodeAnalysis.CommandLine命名空間,在下文中一共展示了BuildPaths類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: RunServerCompilation

 public static Task<BuildResponse> RunServerCompilation(
     RequestLanguage language,
     List<string> arguments,
     BuildPaths buildPaths,
     string keepAlive,
     string libEnvVariable,
     CancellationToken cancellationToken) => Task.FromResult<BuildResponse>(null);
開發者ID:CAPCHIK,項目名稱:roslyn,代碼行數:7,代碼來源:BuildClientShim.cs

示例2: TryCreateCompiler

 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;
     }
 }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:26,代碼來源:CompilerRequestHandler.cs

示例3: Run

        internal static int Run(string[] args, BuildPaths buildPaths, TextWriter textWriter, IAnalyzerAssemblyLoader analyzerLoader)
        {
            FatalError.Handler = FailFast.OnFatalException;

            var responseFile = Path.Combine(buildPaths.ClientDirectory, CSharpCompiler.ResponseFileName);
            var compiler = new Csc(responseFile, buildPaths, args, analyzerLoader);
            return ConsoleUtil.RunWithUtf8Output(compiler.Arguments.Utf8Output, textWriter, tw => compiler.Run(tw));
        }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:8,代碼來源:Csc.cs

示例4: RunServerCompilation

            protected override Task<BuildResponse> RunServerCompilation(List<string> arguments, BuildPaths buildPaths, string sessionKey, string keepAlive, string libDirectory, CancellationToken cancellationToken)
            {
                if (_runServerCompilationFunc != null)
                {
                    return _runServerCompilationFunc();
                }

                return base.RunServerCompilation(arguments, buildPaths, sessionKey, keepAlive, libDirectory, cancellationToken);
            }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:9,代碼來源:DesktopBuildClientTests.cs

示例5: RunServerCompilation

        protected override async Task<BuildResponse> RunServerCompilation(List<string> arguments, BuildPaths buildPaths, string keepAlive, string libDirectory, CancellationToken cancellationToken)
        {
            var client = new TcpClient();
            await client.ConnectAsync("127.0.0.1", port: 12000).ConfigureAwait(true);

            var request = BuildRequest.Create(_language, buildPaths.WorkingDirectory, arguments, keepAlive, libDirectory);
            await request.WriteAsync(client.GetStream(), cancellationToken).ConfigureAwait(true);
            return await BuildResponse.ReadAsync(client.GetStream(), cancellationToken).ConfigureAwait(true);
        }
開發者ID:nicro950,項目名稱:roslyn,代碼行數:9,代碼來源:CoreClrBuildClient.cs

示例6: RunServerCompilation

 protected override Task<BuildResponse> RunServerCompilation(
     List<string> arguments,
     BuildPaths buildPaths,
     string sessionKey,
     string keepAlive,
     string libDirectory,
     CancellationToken cancellationToken)
 {
     return RunServerCompilationCore(_language, arguments, buildPaths, sessionKey, keepAlive, libDirectory, TimeoutOverride, TryCreateServer, cancellationToken);
 }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:10,代碼來源:DesktopBuildClient.cs

示例7: RunServerCompilation

 protected override Task<BuildResponse> RunServerCompilation(
     List<string> arguments, 
     BuildPaths buildPaths, 
     string keepAlive, 
     string libDirectory, 
     CancellationToken cancellationToken)
 {
     var pipeName = GetPipeName(buildPaths.ClientDirectory);
     return RunServerCompilationCore(_language, arguments, buildPaths, pipeName, keepAlive, libDirectory, TryCreateServer, cancellationToken);
 }
開發者ID:nicro950,項目名稱:roslyn,代碼行數:10,代碼來源:DesktopBuildClient.cs

示例8: RunServerCompilation

 public static Task<BuildResponse> RunServerCompilation(
     RequestLanguage language,
     List<string> arguments,
     BuildPaths buildPaths,
     string keepAlive,
     string libEnvVariable,
     CancellationToken cancellationToken)
 {
     throw new NotSupportedException();
 }
開發者ID:AnthonyDGreen,項目名稱:roslyn,代碼行數:10,代碼來源:BuildClientShim.cs

示例9: Run

 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;
 }
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:10,代碼來源:DesktopBuildClient.cs

示例10: Run

 internal static int Run(IEnumerable<string> arguments, RequestLanguage language, CompileFunc compileFunc)
 {
     // BTODO: Should be using BuildClient.GetCommandLineArgs(arguments) here.  But the native invoke 
     // ends up giving us both CoreRun and the exe file.  Need to find a good way to remove the host 
     // as well as the EXE argument. 
     var client = new CoreClrBuildClient(language, compileFunc);
     var clientDir = AppContext.BaseDirectory;
     var workingDir = Directory.GetCurrentDirectory();
     var buildPaths = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: null);
     return client.RunCompilation(arguments, buildPaths);
 }
開發者ID:JackWangCUMT,項目名稱:roslyn,代碼行數:11,代碼來源:CoreClrBuildClient.cs

示例11: RunCompilation

        /// <summary>
        /// Run a compilation through the compiler server and print the output
        /// to the console. If the compiler server fails, run the fallback
        /// compiler.
        /// </summary>
        internal RunCompilationResult RunCompilation(IEnumerable<string> originalArguments, BuildPaths buildPaths, TextWriter textWriter = null)
        {
            textWriter = textWriter ?? Console.Out;

            var args = originalArguments.Select(arg => arg.Trim()).ToArray();

            bool hasShared;
            string keepAlive;
            string errorMessage;
            string sessionKey;
            List<string> parsedArgs;
            if (!CommandLineParser.TryParseClientArgs(
                    args,
                    out parsedArgs,
                    out hasShared,
                    out keepAlive,
                    out sessionKey,
                    out errorMessage))
            {
                Console.Out.WriteLine(errorMessage);
                return RunCompilationResult.Failed;
            }

            if (hasShared)
            {
                var libDirectory = Environment.GetEnvironmentVariable("LIB");
                try
                {
                    sessionKey = sessionKey ?? GetSessionKey(buildPaths);
                    var buildResponseTask = RunServerCompilation(
                        parsedArgs,
                        buildPaths,
                        sessionKey,
                        keepAlive,
                        libDirectory,
                        CancellationToken.None);
                    var buildResponse = buildResponseTask.Result;
                    if (buildResponse != null)
                    {
                        return HandleResponse(buildResponse, parsedArgs.ToArray(), buildPaths, textWriter);
                    }
                }
                catch (OperationCanceledException)
                {
                    // #7866 tracks cleaning up this code. 
                    return RunCompilationResult.Succeeded;
                }
            }

            // It's okay, and expected, for the server compilation to fail.  In that case just fall 
            // back to normal compilation. 
            var exitCode = RunLocalCompilation(parsedArgs.ToArray(), buildPaths, textWriter);
            return new RunCompilationResult(exitCode);
        }
開發者ID:hughgao,項目名稱:roslyn,代碼行數:59,代碼來源:BuildClient.cs

示例12: Run

 internal static int Run(IEnumerable<string> arguments, RequestLanguage language, CompileFunc compileFunc)
 {
     // Should be using BuildClient.GetCommandLineArgs(arguments) here.  But the native invoke
     // ends up giving us both CoreRun and the exe file.  Need to find a good way to remove the host
     // as well as the EXE argument.
     // https://github.com/dotnet/roslyn/issues/6677
     var client = new CoreClrBuildClient(language, compileFunc);
     var clientDir = AppContext.BaseDirectory;
     var workingDir = Directory.GetCurrentDirectory();
     var tempDir = Path.GetTempPath();
     var buildPaths = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: null, tempDir: tempDir);
     return client.RunCompilation(arguments, buildPaths).ExitCode;
 }
開發者ID:XieShuquan,項目名稱:roslyn,代碼行數:13,代碼來源:CoreClrBuildClient.cs

示例13: RunServerCompilation

 public static Task<BuildResponse> RunServerCompilation(
     RequestLanguage language,
     List<string> arguments,
     BuildPaths buildPaths,
     string keepAlive,
     string libEnvVariable,
     CancellationToken cancellationToken)
     => DesktopBuildClient.RunServerCompilation(
         language,
         arguments,
         buildPaths,
         keepAlive,
         libEnvVariable,
         cancellationToken);
開發者ID:Rickinio,項目名稱:roslyn,代碼行數:14,代碼來源:BuildClientShim.cs

示例14: RunCompilation

        /// <summary>
        /// Run a compilation through the compiler server and print the output
        /// to the console. If the compiler server fails, run the fallback
        /// compiler.
        /// </summary>
        internal int RunCompilation(IEnumerable<string> originalArguments, BuildPaths buildPaths)
        {
            var args = originalArguments.Select(arg => arg.Trim()).ToArray();

            bool hasShared;
            string keepAlive;
            string errorMessage;
            string sessionKey;
            List<string> parsedArgs;
            if (!CommandLineParser.TryParseClientArgs(
                    args,
                    out parsedArgs,
                    out hasShared,
                    out keepAlive,
                    out sessionKey,
                    out errorMessage))
            {
                Console.Out.WriteLine(errorMessage);
                return CommonCompiler.Failed;
            }

            if (hasShared)
            {
                var libDirectory = Environment.GetEnvironmentVariable("LIB");
                try
                {
                    sessionKey = sessionKey ?? GetSessionKey(buildPaths);
                    var buildResponseTask = RunServerCompilation(
                        parsedArgs,
                        buildPaths,
                        sessionKey,
                        keepAlive,
                        libDirectory,
                        CancellationToken.None);
                    var buildResponse = buildResponseTask.Result;
                    if (buildResponse != null)
                    {
                        return HandleResponse(buildResponse, parsedArgs, buildPaths);
                    }
                }
                catch
                {
                    // It's okay, and expected, for the server compilation to fail.  In that case just fall 
                    // back to normal compilation. 
                }
            }

            return RunLocalCompilation(parsedArgs, buildPaths.ClientDirectory, buildPaths.SdkDirectory);
        }
開發者ID:SoumikMukherjeeDOTNET,項目名稱:roslyn,代碼行數:54,代碼來源:BuildClient.cs

示例15: RunServerCompilation

 public static Task<BuildResponse> RunServerCompilation(
     RequestLanguage language,
     List<string> arguments,
     BuildPaths buildPaths,
     string keepAlive,
     string libEnvVariable,
     CancellationToken cancellationToken)
 {
     return RunServerCompilationCore(
         language,
         arguments,
         buildPaths,
         GetPipeNameFromFileInfo(buildPaths.ClientDirectory),
         keepAlive,
         libEnvVariable,
         TryCreateServerCore,
         cancellationToken);
 }
開發者ID:dhanilan,項目名稱:roslyn,代碼行數:18,代碼來源:DesktopBuildClient.cs


注:本文中的Microsoft.CodeAnalysis.CommandLine.BuildPaths類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。