提交 bcbc3a0a 编写于 作者: A Andrew Arnott

Allow collection of C#/VB command line without actually invoking the compiler

上级 15c1320f
......@@ -72,6 +72,13 @@ public int CodePage
get { return _store.GetOrDefault(nameof(CodePage), 0); }
}
[Output]
public string CommandLineInvocation
{
set { _store[nameof(CommandLineInvocation)] = value; }
get { return _store.GetOrDefault(nameof(CommandLineInvocation), string.Empty); }
}
public string DebugType
{
set { _store[nameof(DebugType)] = value; }
......@@ -187,6 +194,12 @@ public bool Prefer32Bit
get { return _store.GetOrDefault(nameof(Prefer32Bit), false); }
}
public bool ProvideCommandLineInvocation
{
set { _store[nameof(ProvideCommandLineInvocation)] = value; }
get { return _store.GetOrDefault(nameof(ProvideCommandLineInvocation), false); }
}
public ITaskItem[] References
{
set { _store[nameof(References)] = value; }
......@@ -211,6 +224,12 @@ public ITaskItem[] ResponseFiles
get { return (ITaskItem[])_store[nameof(ResponseFiles)]; }
}
public bool SkipCompilerExecution
{
set { _store[nameof(SkipCompilerExecution)] = value; }
get { return _store.GetOrDefault(nameof(SkipCompilerExecution), false); }
}
public ITaskItem[] Sources
{
set
......@@ -312,6 +331,16 @@ protected override Encoding StandardOutputEncoding
protected override int ExecuteTool(string pathToTool, string responseFileCommands, string commandLineCommands)
{
if (ProvideCommandLineInvocation)
{
CommandLineInvocation = GenerateResponseFileContents();
}
if (SkipCompilerExecution)
{
return 0;
}
if (!UseSharedCompilation || !String.IsNullOrEmpty(this.ToolPath))
{
return base.ExecuteTool(pathToTool, responseFileCommands, commandLineCommands);
......
......@@ -19,7 +19,7 @@
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)"
Returns=""
Returns="$(CscCommandLineInvocation)"
DependsOnTargets="$(CoreCompileDependsOn)"
>
<!-- These two compiler warnings are raised when a reference is bound to a different version
......@@ -105,10 +105,12 @@
Platform="$(PlatformTarget)"
Prefer32Bit="$(Prefer32Bit)"
PreferredUILang="$(PreferredUILang)"
ProvideCommandLineInvocation="$(ProvideCommandLineInvocation)"
References="@(ReferencePath)"
ReportAnalyzer="$(ReportAnalyzer)"
Resources="@(_CoreCompileResourceInputs);@(CompiledLicenseFile)"
ResponseFiles="$(CompilerResponseFile)"
SkipCompilerExecution="$(SkipCompilerExecution)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
TargetType="$(OutputType)"
......@@ -125,7 +127,9 @@
Win32Icon="$(ApplicationIcon)"
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
/>
>
<Output TaskParameter="CommandLineInvocation" PropertyName="CscCommandLineInvocation" />
</Csc>
<ItemGroup>
<_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
......
......@@ -19,7 +19,7 @@
@(_DebugSymbolsIntermediatePath);
$(NonExistentFile);
@(CustomAdditionalCompileOutputs)"
Returns=""
Returns="$(VbcCommandLineInvocation)"
DependsOnTargets="$(CoreCompileDependsOn)"
>
<PropertyGroup>
......@@ -97,6 +97,7 @@
Platform="$(PlatformTarget)"
Prefer32Bit="$(Prefer32Bit)"
PreferredUILang="$(PreferredUILang)"
ProvideCommandLineInvocation="$(ProvideCommandLineInvocation)"
References="@(ReferencePath)"
RemoveIntegerChecks="$(RemoveIntegerChecks)"
ReportAnalyzer="$(ReportAnalyzer)"
......@@ -104,6 +105,7 @@
ResponseFiles="$(CompilerResponseFile)"
RootNamespace="$(RootNamespace)"
SdkPath="$(FrameworkPathOverride)"
SkipCompilerExecution="$(SkipCompilerExecution)"
Sources="@(Compile)"
SubsystemVersion="$(SubsystemVersion)"
TargetCompactFramework="$(TargetCompactFramework)"
......@@ -123,8 +125,9 @@
Win32Manifest="$(Win32Manifest)"
Win32Resource="$(Win32Resource)"
VBRuntime="$(VBRuntime)"
/>
>
<Output TaskParameter="CommandLineInvocation" PropertyName="CscCommandLineInvocation" />
</Vbc>
<ItemGroup>
<_CoreCompileResourceInputs Remove="@(_CoreCompileResourceInputs)" />
</ItemGroup>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册