Add support for 'additionalArguments' in compilationOptions

Rather than keep a map that will have to be constantly updated every time
a new argument gets added to a compiler, the 'additionalArguments' option
will allow users to directly add arguments to the underlying compiler.
This commit is contained in:
Andy Gocke 2016-01-31 01:25:01 -08:00
parent 44ac20a4ce
commit 6ba581fc17
8 changed files with 125 additions and 18 deletions

View file

@ -51,7 +51,7 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
syntax.DefineOption("out", ref outputName, "Name of the output assembly");
syntax.DefineOptionList("reference", ref references, "Path to a compiler metadata reference");
syntax.DefineOptionList("analyzer", ref analyzers, "Path to an analyzer assembly");
syntax.DefineOptionList("resource", ref resources, "Resources to embed");
@ -147,6 +147,12 @@ namespace Microsoft.DotNet.Tools.Compiler.Csc
commonArgs.AddRange(options.SuppressWarnings.Select(w => $"-nowarn:{w}"));
}
// Additional arguments are added verbatim
if (options.AdditionalArguments != null)
{
commonArgs.AddRange(options.AdditionalArguments);
}
if (options.LanguageVersion != null)
{
commonArgs.Add($"-langversion:{GetLanguageVersion(options.LanguageVersion)}");