本文整理汇总了C#中IAnalyzerAssemblyLoader类的典型用法代码示例。如果您正苦于以下问题:C# IAnalyzerAssemblyLoader类的具体用法?C# IAnalyzerAssemblyLoader怎么用?C# IAnalyzerAssemblyLoader使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IAnalyzerAssemblyLoader类属于命名空间,在下文中一共展示了IAnalyzerAssemblyLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestableCompilerServerHost
public TestableCompilerServerHost(
IAnalyzerAssemblyLoader loader = null,
Func<string, MetadataReferenceProperties, PortableExecutableReference> assemblyReferenceProvider = null) :
base(ServerUtil.DefaultClientDirectory, ServerUtil.DefaultSdkDirectory)
{
AnalyzerAssemblyLoader = loader;
AssemblyReferenceProvider = assemblyReferenceProvider;
}
示例2: 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));
}
示例3: Run
internal static int Run(string clientDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
{
FatalError.Handler = FailFast.OnFatalException;
var responseFile = Path.Combine(clientDirectory, VisualBasicCompiler.ResponseFileName);
Vbc compiler = new Vbc(responseFile, clientDirectory, Directory.GetCurrentDirectory(), sdkDirectory, args, analyzerLoader);
return ConsoleUtil.RunWithOutput(compiler.Arguments.Utf8Output, (textWriterOut, _) => compiler.Run(textWriterOut));
}
示例4: Run
public static int Run(CommandLineParser parser, string responseFile, string[] args,
string clientDirectory, string baseDirectory, string sdkDirectory,
string additionalReferenceDirectories,
IAnalyzerAssemblyLoader analyzerLoader,
TextWriter output)
{
return
new PhpCompiler(parser, responseFile, args, clientDirectory, baseDirectory, sdkDirectory, additionalReferenceDirectories, analyzerLoader)
.Run(output);
}
示例5: 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;
}
示例6: VisualStudioAnalyzer
public VisualStudioAnalyzer(string fullPath, IVsFileChangeEx fileChangeService, HostDiagnosticUpdateSource hostDiagnosticUpdateSource, ProjectId projectId, Workspace workspace, IAnalyzerAssemblyLoader loader, string language)
{
_fullPath = fullPath;
_tracker = new FileChangeTracker(fileChangeService, fullPath);
_tracker.UpdatedOnDisk += OnUpdatedOnDisk;
_tracker.StartFileChangeListeningAsync();
_tracker.EnsureSubscription();
_hostDiagnosticUpdateSource = hostDiagnosticUpdateSource;
_projectId = projectId;
_workspace = workspace;
_loader = loader;
_language = language;
}
示例7: Pchp
public Pchp(string[] args, IAnalyzerAssemblyLoader analyzerLoader)
:base(
PhpCommandLineParser.Default,
Path.Combine(AppDomain.CurrentDomain.BaseDirectory, ResponseFileName),
CreateArgs(args),
AppDomain.CurrentDomain.BaseDirectory,
Directory.GetCurrentDirectory(),
System.Runtime.InteropServices.RuntimeEnvironment.GetRuntimeDirectory(),
Environment.GetEnvironmentVariable("LIB") + @";C:\Windows\Microsoft.NET\assembly\GAC_MSIL",
analyzerLoader)
{
}
示例8: CommonCompiler
public CommonCompiler(CommandLineParser parser, string responseFile, string[] args, string clientDirectory, string baseDirectory, string sdkDirectoryOpt, string additionalReferenceDirectories, IAnalyzerAssemblyLoader analyzerLoader)
{
IEnumerable<string> allArgs = args;
_clientDirectory = clientDirectory;
Debug.Assert(null == responseFile || PathUtilities.IsAbsolute(responseFile));
if (!SuppressDefaultResponseFile(args) && PortableShim.File.Exists(responseFile))
{
allArgs = new[] { "@" + responseFile }.Concat(allArgs);
}
this.Arguments = parser.Parse(allArgs, baseDirectory, sdkDirectoryOpt, additionalReferenceDirectories);
this.MessageProvider = parser.MessageProvider;
this.AnalyzerLoader = analyzerLoader;
}
示例9: RunWithConsoleOutput
/// <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>
public static int RunWithConsoleOutput(
string[] args,
string clientDir,
string workingDir,
string sdkDir,
IAnalyzerAssemblyLoader analyzerLoader,
RequestLanguage language,
Func<string, string, string[], IAnalyzerAssemblyLoader, int> fallbackCompiler)
{
args = args.Select(arg => arg.Trim()).ToArray();
bool hasShared;
string keepAlive;
string errorMessage;
List<string> parsedArgs;
if (!CommandLineParser.TryParseClientArgs(
args,
out parsedArgs,
out hasShared,
out keepAlive,
out errorMessage))
{
Console.Out.WriteLine(errorMessage);
return CommonCompiler.Failed;
}
if (hasShared)
{
var responseTask = TryRunServerCompilation(
language,
clientDir,
workingDir,
parsedArgs,
default(CancellationToken),
keepAlive: keepAlive,
libEnvVariable: Environment.GetEnvironmentVariable("LIB"));
var response = responseTask.Result;
if (response != null)
{
return HandleResponse(response, clientDir, sdkDir, analyzerLoader, fallbackCompiler, parsedArgs);
}
}
return fallbackCompiler(clientDir, sdkDir, parsedArgs.ToArray(), analyzerLoader);
}
示例10: CommonCompiler
public CommonCompiler(CommandLineParser parser, string responseFile, string[] args, string clientDirectory, string baseDirectory, string sdkDirectoryOpt, string additionalReferenceDirectories, IAnalyzerAssemblyLoader assemblyLoader)
{
IEnumerable<string> allArgs = args;
_clientDirectory = clientDirectory;
Debug.Assert(null == responseFile || PathUtilities.IsAbsolute(responseFile));
if (!SuppressDefaultResponseFile(args) && File.Exists(responseFile))
{
allArgs = new[] { "@" + responseFile }.Concat(allArgs);
}
this.Arguments = parser.Parse(allArgs, baseDirectory, sdkDirectoryOpt, additionalReferenceDirectories);
this.MessageProvider = parser.MessageProvider;
this.AssemblyLoader = assemblyLoader;
this.EmbeddedSourcePaths = GetEmbedddedSourcePaths(Arguments);
if (Arguments.ParseOptions.Features.ContainsKey("debug-determinism"))
{
EmitDeterminismKey(Arguments, args, baseDirectory, parser);
}
}
示例11: Check
public static bool Check(string baseDirectory, IEnumerable<CommandLineAnalyzerReference> analyzerReferences, IAnalyzerAssemblyLoader loader, IEnumerable<string> ignorableReferenceNames = null)
{
if (ignorableReferenceNames == null)
{
ignorableReferenceNames = s_defaultIgnorableReferenceNames;
}
try
{
CompilerServerLogger.Log("Begin Analyzer Consistency Check");
return CheckCore(baseDirectory, analyzerReferences, loader, ignorableReferenceNames);
}
catch (Exception e)
{
CompilerServerLogger.LogException(e, "Analyzer Consistency Check");
return false;
}
finally
{
CompilerServerLogger.Log("End Analyzer Consistency Check");
}
}
示例12: RunCompiler
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);
}
示例13: CSharpCompiler
protected CSharpCompiler(CSharpCommandLineParser parser, string responseFile, string[] args, string clientDirectory, string baseDirectory, string sdkDirectoryOpt, string additionalReferenceDirectories, IAnalyzerAssemblyLoader analyzerLoader)
: base(parser, responseFile, args, clientDirectory, baseDirectory, sdkDirectoryOpt, additionalReferenceDirectories, analyzerLoader)
{
_diagnosticFormatter = new CommandLineDiagnosticFormatter(baseDirectory, Arguments.PrintFullPaths, Arguments.ShouldIncludeErrorEndLocation);
}
示例14: HandleResponse
private static int HandleResponse(BuildResponse response, string clientDir, string sdkDir, IAnalyzerAssemblyLoader analyzerLoader, Func<string, string, string[], IAnalyzerAssemblyLoader, int> fallbackCompiler, List<string> parsedArgs)
{
switch (response.Type)
{
case BuildResponse.ResponseType.MismatchedVersion:
Console.Error.WriteLine(CommandLineParser.MismatchedVersionErrorText);
return CommonCompiler.Failed;
case BuildResponse.ResponseType.Completed:
var completedResponse = (CompletedBuildResponse)response;
return ConsoleUtil.RunWithOutput(
completedResponse.Utf8Output,
(outWriter, errorWriter) =>
{
outWriter.Write(completedResponse.Output);
errorWriter.Write(completedResponse.ErrorOutput);
return completedResponse.ReturnCode;
});
case BuildResponse.ResponseType.AnalyzerInconsistency:
return fallbackCompiler(clientDir, sdkDir, parsedArgs.ToArray(), analyzerLoader);
default:
throw new InvalidOperationException("Encountered unknown response type");
}
}
示例15: Vbc
internal Vbc(string responseFile, string clientDirectory, string baseDirectory, string sdkDirectory, string[] args, IAnalyzerAssemblyLoader analyzerLoader)
: base(VisualBasicCommandLineParser.Default, responseFile, args, clientDirectory, baseDirectory, sdkDirectory, Environment.GetEnvironmentVariable("LIB"), analyzerLoader)
{
}