5 instantiations of CommandLineSwitches
MSBuild (5)
CommandLine\CommandLineParser.cs (4)
76
CommandLineSwitches result =
new
();
112
switchesNotFromAutoResponseFile = new
CommandLineSwitches
();
117
switchesFromAutoResponseFile = new
CommandLineSwitches
();
124
CommandLineSwitches switchesFromEnvironmentVariable =
new
();
XMake.cs (1)
2781
CommandLineSwitches commandLineSwitches = new
CommandLineSwitches
();
149 references to CommandLineSwitches
MSBuild (149)
CommandLine\CommandLineParser.cs (27)
17
using static Microsoft.Build.CommandLine.Experimental.
CommandLineSwitches
;
71
out
CommandLineSwitches
responseFileSwitches,
72
out
CommandLineSwitches
commandLineSwitches,
76
CommandLineSwitches
result = new();
98
out
CommandLineSwitches
switchesFromAutoResponseFile,
99
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
124
CommandLineSwitches
switchesFromEnvironmentVariable = new();
134
ref
CommandLineSwitches
switches,
229
internal void GatherCommandLineSwitches(IEnumerable<string> commandLineArgs,
CommandLineSwitches
commandLineSwitches, string commandLine = "")
304
if (
CommandLineSwitches
.IsParameterlessSwitch(switchName, out var parameterlessSwitch, out var duplicateSwitchErrorMessage))
308
else if (
CommandLineSwitches
.IsParameterizedSwitch(switchName, out var parameterizedSwitch, out duplicateSwitchErrorMessage, out var multipleParametersAllowed, out var missingParametersErrorMessage, out var unquoteParameters, out var allowEmptyParameters))
327
private void GatherResponseFileSwitch(string unquotedCommandLineArg,
CommandLineSwitches
commandLineSwitches, string commandLine)
392
CommandLineSwitches
.SwitchesFromResponseFiles.Add((responseFile, string.Join(" ", argsFromResponseFile)));
425
CommandLineSwitches
commandLineSwitches,
426
CommandLineSwitches
.ParameterlessSwitch parameterlessSwitch,
465
CommandLineSwitches
commandLineSwitches,
466
CommandLineSwitches
.ParameterizedSwitch parameterizedSwitch,
487
if (parameterizedSwitch ==
CommandLineSwitches
.ParameterizedSwitch.Project && IsEnvironmentVariable(switchParameters))
521
internal bool CheckAndGatherProjectAutoResponseFile(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
commandLineSwitches, bool recursing, string commandLine)
525
var projectDirectory = GetProjectDirectory(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project]);
527
if (!recursing && !commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
652
private bool GatherAutoResponseFileSwitches(string path,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
658
private bool GatherAutoResponseFileSwitchesFromFullPath(string autoResponseFile,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
669
if (switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
672
switchesFromAutoResponseFile.GetParameterlessSwitchCommandLineArg(
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse), commandLine);
725
CommandLineSwitches
.SwitchesFromResponseFiles = new();
CommandLine\CommandLineSwitches.cs (1)
913
internal void Append(
CommandLineSwitches
switchesToAppend, string commandLine = "")
CommandLine\CommandLineSwitchesAccessor.cs (3)
4
using static Microsoft.Build.CommandLine.Experimental.
CommandLineSwitches
;
10
private readonly
CommandLineSwitches
switches;
12
internal CommandLineSwitchesAccessor(
CommandLineSwitches
switches)
XMake.cs (118)
320
out
CommandLineSwitches
switchesFromAutoResponseFile,
321
out
CommandLineSwitches
switchesNotFromAutoResponseFile);
364
/// returned so the in-proc build path (<see cref="Execute(string[],
CommandLineSwitches
,
CommandLineSwitches
)"/>)
378
out
CommandLineSwitches
switchesFromAutoResponseFile,
379
out
CommandLineSwitches
switchesNotFromAutoResponseFile)
396
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
409
string projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
410
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help] ||
411
commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode) ||
412
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version] ||
414
!ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]))
770
CommandLineSwitches
preGatheredSwitchesFromAutoResponseFile,
771
CommandLineSwitches
preGatheredSwitchesNotFromAutoResponseFile)
864
CommandLineSwitches
switchesFromAutoResponseFile;
865
CommandLineSwitches
switchesNotFromAutoResponseFile;
929
CommandLineSwitches
.SwitchesFromResponseFiles = null;
938
&& switchesNotFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
939
&& switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1622
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Preprocess);
1643
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Targets);
2173
CommandLineSwitches
switchesFromAutoResponseFile,
2174
CommandLineSwitches
switchesNotFromAutoResponseFile,
2222
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, commandLine);
2225
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.WaitForDebugger])
2244
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NoLogo))
2246
noLogo = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NoLogo], defaultValue: true, resourceName: "InvalidNoLogoValue");
2259
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.LowPriority))
2261
lowPriority = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.LowPriority], defaultValue: true, resourceName: "InvalidLowPriorityValue");
2287
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help])
2291
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode))
2308
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version])
2313
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability))
2315
ShowFeatureAvailability(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability]);
2378
projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
2381
targets = ProcessTargetSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Target]);
2384
getProperty = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetProperty] ?? [];
2385
getItem = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetItem] ?? [];
2386
getTargetResult = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult] ?? [];
2387
getResultOutputFile = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
2392
commandLineSwitches.SetParameterizedSwitch(
CommandLineSwitches
.ParameterizedSwitch.Verbosity, "q", "q", true, true, true);
2398
toolsVersion = ProcessToolsVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ToolsVersion]);
2401
globalProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Property]);
2404
restoreProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.RestoreProperty]);
2407
cpuCount = ProcessMaxCPUCountSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount]);
2413
enableNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
2417
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess))
2419
preprocessWriter = ProcessPreprocessSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Preprocess]);
2424
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Targets))
2426
targetsWriter = ProcessTargetsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Targets]);
2435
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Restore))
2437
enableRestore = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Restore], defaultValue: true, resourceName: "InvalidRestoreValue");
2440
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Interactive))
2442
interactive = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Interactive], defaultValue: true, resourceName: "InvalidInteractiveValue");
2445
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects))
2447
isolateProjects = ProcessIsolateProjectsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects]);
2450
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GraphBuild))
2452
graphBuild = ProcessGraphBuildSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GraphBuild]);
2455
question = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Question);
2501
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors) &&
2505
commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors),
2517
private static bool IsBuildCheckEnabled(
CommandLineSwitches
commandLineSwitches)
2520
bool isBuildCheckEnabled = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Check);
2524
internal static bool IsMultiThreadedEnabled(
CommandLineSwitches
commandLineSwitches)
2533
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded);
2536
private static bool ProcessTerminalLoggerConfiguration(
CommandLineSwitches
commandLineSwitches, out string aggregatedParameters)
2630
bool TryFromCommandLine(
CommandLineSwitches
commandLineSwitches1)
2632
if (!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger))
2638
string[] switches = commandLineSwitches1[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger];
2704
string AggregateParameters(
CommandLineSwitches
switches)
2706
string[] terminalLoggerParameters = switches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters];
2774
private static
CommandLineSwitches
CombineSwitchesRespectingPriority(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
switchesNotFromAutoResponseFile, string commandLine)
2781
CommandLineSwitches
commandLineSwitches = new CommandLineSwitches();
2787
private static bool WarningsAsErrorsSwitchIsEmpty(
CommandLineSwitches
commandLineSwitches)
2789
string val = commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
2863
private static string ProcessOutputResultsCache(
CommandLineSwitches
commandLineSwitches)
2865
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache)
2866
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
2870
private static string[] ProcessInputResultsCaches(
CommandLineSwitches
commandLineSwitches)
2872
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches)
2873
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches].Where(p => p != null).ToArray()
2984
private static ISet<string> ProcessWarningRelatedSwitch(
CommandLineSwitches
commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch warningSwitch)
3013
internal static ISet<string> ProcessWarnAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3015
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3018
internal static ISet<string> ProcessWarnAsMessageSwitch(
CommandLineSwitches
commandLineSwitches)
3020
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsMessages);
3023
internal static ISet<string> ProcessWarnNotAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3025
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors);
3122
private static void StartLocalNode(
CommandLineSwitches
commandLineSwitches, bool lowpriority)
3124
string[] input = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeMode];
3141
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3150
bool taskHostNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3151
byte parentPacketVersion = ProcessParentPacketVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ParentPacketVersion]);
3489
CommandLineSwitches
commandLineSwitches,
3501
string[] loggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Logger];
3502
string[] distributedLoggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger];
3503
string[] verbositySwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Verbosity];
3504
bool noConsoleLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger];
3505
bool distributedFileLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger];
3506
string[] fileLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters]; // used by DistributedFileLogger
3507
string[] consoleLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters];
3508
string[] binaryLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger];
3509
string[] profileEvaluationParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ProfileEvaluation];
3518
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary))
3520
detailedSummary = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary], defaultValue: true, resourceName: "InvalidDetailedSummaryValue");
4325
private static void DisplayVersionMessageIfNeeded(bool recursing, bool useTerminalLogger, bool noLogo,
CommandLineSwitches
commandLineSwitches)
4337
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess) &&
4338
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetProperty) &&
4339
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetItem) &&
4340
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult) &&
4341
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability) &&
4361
foreach (string parameterizedSwitchRsouceId in
CommandLineSwitches
.GetParameterizedSwitchResourceIds())
4365
foreach (string parameterlessSwitchRsouceId in
CommandLineSwitches
.GetParameterlessSwitchResourceIds())