提交 0fe99e29 编写于 作者: A Andy Gocke

Add ChecksumAlgorithm to csc/vbc build task (#11657)

Add ChecksumAlgorithm to csc/vbc build task

Fixes #10451
上级 d53fce55
......@@ -60,6 +60,12 @@ public ITaskItem[] Analyzers
// We do not support BugReport because it always requires user interaction,
// which will cause a hang.
public string ChecksumAlgorithm
{
set { _store[nameof(ChecksumAlgorithm)] = value; }
get { return (string)_store[nameof(ChecksumAlgorithm)]; }
}
public string CodeAnalysisRuleSet
{
set { _store[nameof(CodeAnalysisRuleSet)] = value; }
......@@ -698,6 +704,7 @@ internal void AddResponseFileCommandsForSwitchesSinceInitialReleaseThatAreNeeded
commandLine.AppendPlusOrMinusSwitch("/deterministic", _store, nameof(Deterministic));
commandLine.AppendPlusOrMinusSwitch("/publicsign", _store, nameof(PublicSign));
commandLine.AppendSwitchIfNotNull("/runtimemetadataversion:", RuntimeMetadataVersion);
commandLine.AppendSwitchIfNotNull("/checksumalgorithm:", ChecksumAlgorithm);
AddFeatures(commandLine, Features);
}
......
......@@ -73,6 +73,7 @@
ApplicationConfiguration="$(AppConfigForCompiler)"
BaseAddress="$(BaseAddress)"
CheckForOverflowUnderflow="$(CheckForOverflowUnderflow)"
ChecksumAlgorithm="$(ChecksumAlgorithm)"
CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
CodePage="$(CodePage)"
DebugType="$(DebugType)"
......
......@@ -59,6 +59,7 @@
AdditionalFiles="@(AdditionalFiles)"
Analyzers="@(Analyzer)"
BaseAddress="$(BaseAddress)"
ChecksumAlgorithm="$(ChecksumAlgorithm)"
CodeAnalysisRuleSet="$(ResolvedCodeAnalysisRuleSet)"
CodePage="$(CodePage)"
DebugType="$(DebugType)"
......
......@@ -90,6 +90,25 @@ public void RuntimeMetadataVersionFlag()
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void ChecksumAlgorithmOption()
{
var csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.ChecksumAlgorithm = "sha256";
Assert.Equal("/out:test.exe /checksumalgorithm:sha256 test.cs", csc.GenerateResponseFileContents());
csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.ChecksumAlgorithm = null;
Assert.Equal("/out:test.exe test.cs", csc.GenerateResponseFileContents());
csc = new Csc();
csc.Sources = MSBuildUtil.CreateTaskItems("test.cs");
csc.ChecksumAlgorithm = "";
Assert.Equal("/out:test.exe /checksumalgorithm: test.cs", csc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeDll()
{
......
......@@ -87,6 +87,25 @@ public void RuntimeMetadataVersionFlag()
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void ChecksumAlgorithmOption()
{
var vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.ChecksumAlgorithm = "sha256";
Assert.Equal("/optionstrict:custom /out:test.exe /checksumalgorithm:sha256 test.vb", vbc.GenerateResponseFileContents());
vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.ChecksumAlgorithm = null;
Assert.Equal("/optionstrict:custom /out:test.exe test.vb", vbc.GenerateResponseFileContents());
vbc = new Vbc();
vbc.Sources = MSBuildUtil.CreateTaskItems("test.vb");
vbc.ChecksumAlgorithm = "";
Assert.Equal("/optionstrict:custom /out:test.exe /checksumalgorithm: test.vb", vbc.GenerateResponseFileContents());
}
[Fact]
public void TargetTypeDll()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册