internal BuildClient(RequestLanguage language, CompileFunc compileFunc, CreateServerFunc createServerFunc = null, int?timeoutOverride = null) { _language = language; _compileFunc = compileFunc; _createServerFunc = createServerFunc ?? BuildServerConnection.TryCreateServerCore; _timeoutOverride = timeoutOverride; }
/// <summary> /// Compile the shader file using the given compilation function /// </summary> public void CompileShaders(List <ShaderFile> shaderFiles, CompileFunc compileFunc) { string title = name; string msg; if (ReferenceCompiler.Locate() == null) { msg = "Could not locate the glslang reference compiler (glslangvalidator.exe) in system path!"; VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); OutputWindow.Add(msg); return; } ErrorList.Clear(); bool success = true; msg = ""; foreach (var shaderFile in shaderFiles) { List <string> validatorOutput; bool compiled = compileFunc(shaderFile.fileName, out validatorOutput); if (compiled) { OutputWindow.Add(string.Join("\n", validatorOutput)); } else { msg += string.Format(CultureInfo.CurrentCulture, "Shader \"{0}\" could not be compiled to SPIR-V!", shaderFile.fileName) + "\n"; Debug.Write(msg); ParseErrors(validatorOutput, shaderFile); OutputWindow.Add(shaderFile.fileName + "\n" + string.Join("\n", validatorOutput)); success = false; } } if (success) { if (shaderFiles.Count == 1) { msg = string.Format(CultureInfo.CurrentCulture, "Shader successfully compiled to \"{0}\"", shaderFiles[0].fileName + ".spv"); } else { msg = "All shaders successfully compiled to SPIR-V"; } VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } else { VsShellUtilities.ShowMessageBox(ServiceProvider, msg, title, OLEMSGICON.OLEMSGICON_CRITICAL, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); } if (ErrorList.ErrorCount() > 0) { ErrorList.Show(); } }
public TestableDesktopBuildClient( RequestLanguage langauge, CompileFunc compileFunc, string pipeName, Func <string, bool> createServerFunc) : base(langauge, compileFunc, new Mock <IAnalyzerAssemblyLoader>().Object) { _pipeName = pipeName; _createServerFunc = createServerFunc; }
public TestableDesktopBuildClient( RequestLanguage langauge, CompileFunc compileFunc, string pipeName, Func<string, bool> createServerFunc) : base(langauge, compileFunc, new Mock<IAnalyzerAssemblyLoader>().Object) { _pipeName = pipeName; _createServerFunc = createServerFunc; }
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; }
private TestableDesktopBuildClient CreateClient( RequestLanguage? language = null, CompileFunc compileFunc = null, Func<string, bool> createServerFunc = null) { language = language ?? RequestLanguage.CSharpCompile; compileFunc = compileFunc ?? delegate { return 0; }; createServerFunc = createServerFunc ?? TryCreateServer; return new TestableDesktopBuildClient(language.Value, compileFunc, _pipeName, createServerFunc); }
private BuildClient CreateClient( RequestLanguage?language = null, CompileFunc compileFunc = null, CreateServerFunc createServerFunc = null) { language ??= RequestLanguage.CSharpCompile; compileFunc ??= delegate { return(0); }; createServerFunc ??= ((_, pipeName) => TryCreateServer(pipeName)); return(new BuildClient(language.Value, compileFunc, createServerFunc)); }
private TestableDesktopBuildClient CreateClient( RequestLanguage?language = null, CompileFunc compileFunc = null, Func <string, bool> createServerFunc = null) { language = language ?? RequestLanguage.CSharpCompile; compileFunc = compileFunc ?? delegate { return(0); }; createServerFunc = createServerFunc ?? TryCreateServer; return(new TestableDesktopBuildClient(language.Value, compileFunc, _pipeName, createServerFunc)); }
internal static BuildClient CreateBuildClient( RequestLanguage language, CompileFunc compileFunc = null, TextWriter textWriter = null, int?timeoutOverride = null) { compileFunc = compileFunc ?? GetCompileFunc(language); textWriter = textWriter ?? new StringWriter(); return(new BuildClient(language, compileFunc, timeoutOverride: timeoutOverride)); }
private BuildClient CreateClient( RequestLanguage?language = null, CompileFunc compileFunc = null, CompileOnServerFunc compileOnServerFunc = null) { language ??= RequestLanguage.CSharpCompile; compileFunc ??= delegate { return(0); }; compileOnServerFunc ??= delegate { throw new InvalidOperationException(); }; return(new BuildClient(language.Value, compileFunc, compileOnServerFunc)); }
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); }
internal static DesktopBuildClient CreateBuildClient( RequestLanguage language, CompileFunc compileFunc = null, TextWriter textWriter = null, IAnalyzerAssemblyLoader analyzerAssemblyLoader = null) { compileFunc = compileFunc ?? GetCompileFunc(language); textWriter = textWriter ?? new StringWriter(); analyzerAssemblyLoader = analyzerAssemblyLoader ?? new Mock <IAnalyzerAssemblyLoader>(MockBehavior.Strict).Object; return(new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader)); }
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; }
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); }
private CoreClrBuildClient(RequestLanguage language, CompileFunc compileFunc) { _language = language; _compileFunc = compileFunc; }
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 buildPaths = new BuildPaths(clientDir: clientDir, workingDir: workingDir, sdkDir: null); return(client.RunCompilation(arguments, buildPaths).ExitCode); }
private CoreClrBuildClient(RequestLanguage language, CompileFunc compileFunc) { _language = language; _compileFunc = compileFunc; }
internal static DesktopBuildClient CreateBuildClient( RequestLanguage language, CompileFunc compileFunc = null, TextWriter textWriter = null, IAnalyzerAssemblyLoader analyzerAssemblyLoader = null) { compileFunc = compileFunc ?? GetCompileFunc(language); textWriter = textWriter ?? new StringWriter(); analyzerAssemblyLoader = analyzerAssemblyLoader ?? new Mock<IAnalyzerAssemblyLoader>(MockBehavior.Strict).Object; return new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader); }
internal static int Run(IEnumerable <string> arguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { // Register encodings for console // https://github.com/dotnet/roslyn/issues/10785 Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); // 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, analyzerAssemblyLoader); 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); }
private CoreClrBuildClient(RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { _language = language; _compileFunc = compileFunc; _analyzerAssemblyLoader = analyzerAssemblyLoader; }
internal BuildClient(RequestLanguage language, CompileFunc compileFunc, CompileOnServerFunc compileOnServerFunc) { _language = language; _compileFunc = compileFunc; _compileOnServerFunc = compileOnServerFunc; }
private TestableDesktopBuildClient CreateClient(RequestLanguage? language = null, CompileFunc compileFunc = null) { language = language ?? RequestLanguage.CSharpCompile; compileFunc = compileFunc ?? delegate { return 0; }; return new TestableDesktopBuildClient(language.Value, compileFunc, _pipeName, _serverInfo.TryCreateServer); }
internal DesktopBuildClient(RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { _language = language; _compileFunc = compileFunc; _analyzerAssemblyLoader = analyzerAssemblyLoader; }
internal static int Run(IEnumerable <string> arguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { var client = new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader); var clientDir = AppContext.BaseDirectory; var sdkDir = GetRuntimeDirectoryOpt(); 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).ToArray(); return(client.RunCompilation(originalArguments, buildPaths).ExitCode); }
internal DesktopBuildClient(RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { _language = language; _compileFunc = compileFunc; _analyzerAssemblyLoader = analyzerAssemblyLoader; }
internal static int Run(IEnumerable <string> arguments, RequestLanguage language, CompileFunc compileFunc, IAnalyzerAssemblyLoader analyzerAssemblyLoader) { var sdkDir = GetSystemSdkDirectory(); if (CoreClrShim.IsRunningOnCoreClr) { // Register encodings for console // https://github.com/dotnet/roslyn/issues/10785 System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); } var client = new DesktopBuildClient(language, compileFunc, analyzerAssemblyLoader); 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).ExitCode); }
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); }
private TestableDesktopBuildClient CreateClient(RequestLanguage?language = null, CompileFunc compileFunc = null) { language = language ?? RequestLanguage.CSharpCompile; compileFunc = compileFunc ?? delegate { return(0); }; return(new TestableDesktopBuildClient(language.Value, compileFunc, _pipeName, _serverInfo.TryCreateServer)); }