提交 a109faa9 编写于 作者: J Jared Parsons 提交者: GitHub

Merge pull request #21878 from zahess/users/zahess/SharedCompilationId_Override

Added SharedCompilationId property to ManagedCompiler and inherited tasks
......@@ -288,6 +288,12 @@ public ITaskItem[] ResponseFiles
get { return (ITaskItem[])_store[nameof(ResponseFiles)]; }
}
public string SharedCompilationId
{
set { _store[nameof(SharedCompilationId)] = value; }
get { return (string)_store[nameof(SharedCompilationId)]; }
}
public bool SkipCompilerExecution
{
set { _store[nameof(SkipCompilerExecution)] = value; }
......@@ -511,6 +517,7 @@ protected override int ExecuteTool(string pathToTool, string responseFileCommand
var responseTask = BuildServerConnection.RunServerCompilation(
Language,
string.IsNullOrEmpty(SharedCompilationId) ? null : SharedCompilationId,
GetArguments(commandLineCommands, responseFileCommands).ToList(),
buildPaths,
keepAlive: null,
......
......@@ -134,6 +134,7 @@
Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile)"
ResponseFiles="$(CompilerResponseFile)"
RuntimeMetadataVersion="$(RuntimeMetadataVersion)"
SharedCompilationId="$(SharedCompilationId)"
SkipCompilerExecution="$(SkipCompilerExecution)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
......
......@@ -129,6 +129,7 @@
RootNamespace="$(RootNamespace)"
RuntimeMetadataVersion="$(RuntimeMetadataVersion)"
SdkPath="$(FrameworkPathOverride)"
SharedCompilationId="$(SharedCompilationId)"
SkipCompilerExecution="$(SkipCompilerExecution)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
......
......@@ -313,5 +313,26 @@ public void RefOnly()
csc.RefOnly = true;
Assert.Equal("/out:test.exe /refonly test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void SharedCompilationId()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.UseSharedCompilation = true;
csc.SharedCompilationId = "testPipeName";
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.UseSharedCompilation = false;
csc.SharedCompilationId = "testPipeName";
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.SharedCompilationId = "testPipeName";
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
}
}
}
......@@ -312,6 +312,27 @@ public void RefOnly()
Assert.Equal("/optionstrict:custom /out:test.exe /refonly test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void SharedCompilationId()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.UseSharedCompilation = true;
vbc.SharedCompilationId = "testPipeName";
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.UseSharedCompilation = false;
vbc.SharedCompilationId = "testPipeName";
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.SharedCompilationId = "testPipeName";
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
[WorkItem(21371, "https://github.com/dotnet/roslyn/issues/21371")]
public void GenerateDocumentationFalse()
......
......@@ -91,13 +91,14 @@ internal static string GetRuntimeDirectoryOpt()
public static Task<BuildResponse> RunServerCompilation(
RequestLanguage language,
string sharedCompilationId,
List<string> arguments,
BuildPathsAlt buildPaths,
string keepAlive,
string libEnvVariable,
CancellationToken cancellationToken)
{
var pipeNameOpt = GetPipeNameForPathOpt(buildPaths.ClientDirectory);
var pipeNameOpt = sharedCompilationId ?? GetPipeNameForPathOpt(buildPaths.ClientDirectory);
return RunServerCompilationCore(
language,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册