当前位置: 首页>>代码示例>>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;未经允许,请勿转载。