From 9fa1f3c1606106b5eb86b678765c2f9c2e65f427 Mon Sep 17 00:00:00 2001 From: Jared Parsons Date: Mon, 9 Nov 2015 13:39:33 -0800 Subject: [PATCH] Move around the SDK directory dependency It's no longer needed on the ICompilerServerHost implementation. It is just threaded through the compiler server creation like the other directory parameters. --- .../PortableServer/CoreClrCompilerServerHost.cs | 5 ----- src/Compilers/Server/PortableServer/Program.cs | 2 +- .../Server/ServerShared/CompilerRequestHandler.cs | 12 +++++++++--- .../Server/ServerShared/ICompilerServerHost.cs | 1 - .../Server/VBCSCompiler/DesktopCompilerServerHost.cs | 5 ----- src/Compilers/Server/VBCSCompiler/VBCSCompiler.cs | 4 +++- .../VBCSCompilerTests/CompilerServerApiTest.cs | 5 +++-- 7 files changed, 16 insertions(+), 18 deletions(-) diff --git a/src/Compilers/Server/PortableServer/CoreClrCompilerServerHost.cs b/src/Compilers/Server/PortableServer/CoreClrCompilerServerHost.cs index 8889f38dbc3..b8fc567d38b 100644 --- a/src/Compilers/Server/PortableServer/CoreClrCompilerServerHost.cs +++ b/src/Compilers/Server/PortableServer/CoreClrCompilerServerHost.cs @@ -41,11 +41,6 @@ public async Task CreateListenTask(CancellationToken cancella return new TcpClientConnection(tcpClient); } - public string GetSdkDirectory() - { - return null; - } - public void Log(string message) { // BTODO: Do we need this anymore? diff --git a/src/Compilers/Server/PortableServer/Program.cs b/src/Compilers/Server/PortableServer/Program.cs index 28cafd5db7a..5695c92fc10 100644 --- a/src/Compilers/Server/PortableServer/Program.cs +++ b/src/Compilers/Server/PortableServer/Program.cs @@ -14,7 +14,7 @@ public static void Main(string[] args) var endPoint = new IPEndPoint(ipAddress, port: 12000); var clientDirectory = AppContext.BaseDirectory; var compilerHost = new CoreClrCompilerServerHost(endPoint); - var compilerRequestHandler = new CompilerRequestHandler(compilerHost, clientDirectory); + var compilerRequestHandler = new CompilerRequestHandler(compilerHost, clientDirectory, sdkDirectory: null); var serverDispatcher = new ServerDispatcher(compilerHost, compilerRequestHandler, new EmptyDiagnosticListener()); serverDispatcher.ListenAndDispatchConnections(keepAlive: null, cancellationToken: CancellationToken.None); } diff --git a/src/Compilers/Server/ServerShared/CompilerRequestHandler.cs b/src/Compilers/Server/ServerShared/CompilerRequestHandler.cs index 7fcec8c5809..4e7948bb505 100644 --- a/src/Compilers/Server/ServerShared/CompilerRequestHandler.cs +++ b/src/Compilers/Server/ServerShared/CompilerRequestHandler.cs @@ -42,10 +42,16 @@ internal sealed class CompilerRequestHandler : IRequestHandler /// private readonly string _clientDirectory; - internal CompilerRequestHandler(ICompilerServerHost compilerServerHost, string clientDirectory) + /// + /// Directory holding mscorlib. It will be null when run under CoreCLR, + /// + private readonly string _sdkDirectory; + + internal CompilerRequestHandler(ICompilerServerHost compilerServerHost, string clientDirectory, string sdkDirectory) { _compilerServerHost = compilerServerHost; _clientDirectory = clientDirectory; + _sdkDirectory = sdkDirectory; } /// @@ -106,7 +112,7 @@ private CommonCompiler CreateCSharpCompiler(RunRequest request) request.Arguments, _clientDirectory, request.CurrentDirectory, - _compilerServerHost.GetSdkDirectory(), + _sdkDirectory, request.LibDirectory, _compilerServerHost.AnalyzerAssemblyLoader); } @@ -118,7 +124,7 @@ private CommonCompiler CreateBasicCompiler(RunRequest request) request.Arguments, _clientDirectory, request.CurrentDirectory, - _compilerServerHost.GetSdkDirectory(), + _sdkDirectory, request.LibDirectory, _compilerServerHost.AnalyzerAssemblyLoader); } diff --git a/src/Compilers/Server/ServerShared/ICompilerServerHost.cs b/src/Compilers/Server/ServerShared/ICompilerServerHost.cs index fdfbdfa2011..73fd0a32e51 100644 --- a/src/Compilers/Server/ServerShared/ICompilerServerHost.cs +++ b/src/Compilers/Server/ServerShared/ICompilerServerHost.cs @@ -16,7 +16,6 @@ internal interface ICompilerServerHost Func AssemblyReferenceProvider { get; } Task CreateListenTask(CancellationToken cancellationToken); - string GetSdkDirectory(); bool CheckAnalyzers(string baseDirectory, ImmutableArray analyzers); void Log(string message); } diff --git a/src/Compilers/Server/VBCSCompiler/DesktopCompilerServerHost.cs b/src/Compilers/Server/VBCSCompiler/DesktopCompilerServerHost.cs index f7663078bdf..3345f0f954d 100644 --- a/src/Compilers/Server/VBCSCompiler/DesktopCompilerServerHost.cs +++ b/src/Compilers/Server/VBCSCompiler/DesktopCompilerServerHost.cs @@ -42,11 +42,6 @@ public bool CheckAnalyzers(string baseDirectory, ImmutableArray