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)
2631
CommandLineSwitches commandLineSwitches = new
CommandLineSwitches
();
143 references to CommandLineSwitches
MSBuild (143)
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 (112)
354
out
CommandLineSwitches
switchesFromAutoResponseFile,
355
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
359
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
364
string projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
365
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help] ||
366
commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode) ||
367
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version] ||
369
!ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]))
729
commandLineParser.GatherAllSwitches(commandLine, s_globalMessagesToLogInBuildLoggers, out
var
switchesFromAutoResponseFile, out
var
switchesNotFromAutoResponseFile, out _, out s_exeName);
778
CommandLineSwitches
.SwitchesFromResponseFiles = null;
787
&& switchesNotFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
788
&& switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1471
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Preprocess);
1492
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Targets);
2026
CommandLineSwitches
switchesFromAutoResponseFile,
2027
CommandLineSwitches
switchesNotFromAutoResponseFile,
2074
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, commandLine);
2077
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.WaitForDebugger])
2096
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NoLogo))
2098
noLogo = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NoLogo], defaultValue: true, resourceName: "InvalidNoLogoValue");
2111
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.LowPriority))
2113
lowPriority = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.LowPriority], defaultValue: true, resourceName: "InvalidLowPriorityValue");
2139
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help])
2143
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode))
2160
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version])
2165
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability))
2167
ShowFeatureAvailability(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability]);
2228
projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
2231
targets = ProcessTargetSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Target]);
2234
getProperty = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetProperty] ?? [];
2235
getItem = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetItem] ?? [];
2236
getTargetResult = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult] ?? [];
2237
getResultOutputFile = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
2242
commandLineSwitches.SetParameterizedSwitch(
CommandLineSwitches
.ParameterizedSwitch.Verbosity, "q", "q", true, true, true);
2248
toolsVersion = ProcessToolsVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ToolsVersion]);
2251
globalProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Property]);
2254
restoreProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.RestoreProperty]);
2257
cpuCount = ProcessMaxCPUCountSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount]);
2263
enableNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
2267
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess))
2269
preprocessWriter = ProcessPreprocessSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Preprocess]);
2274
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Targets))
2276
targetsWriter = ProcessTargetsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Targets]);
2285
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Restore))
2287
enableRestore = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Restore], defaultValue: true, resourceName: "InvalidRestoreValue");
2290
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Interactive))
2292
interactive = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Interactive], defaultValue: true, resourceName: "InvalidInteractiveValue");
2295
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects))
2297
isolateProjects = ProcessIsolateProjectsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects]);
2300
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GraphBuild))
2302
graphBuild = ProcessGraphBuildSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GraphBuild]);
2305
question = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Question);
2351
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors) &&
2355
commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors),
2367
private static bool IsBuildCheckEnabled(
CommandLineSwitches
commandLineSwitches)
2370
bool isBuildCheckEnabled = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Check);
2374
internal static bool IsMultiThreadedEnabled(
CommandLineSwitches
commandLineSwitches)
2383
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded);
2386
private static bool ProcessTerminalLoggerConfiguration(
CommandLineSwitches
commandLineSwitches, out string aggregatedParameters)
2480
bool TryFromCommandLine(
CommandLineSwitches
commandLineSwitches1)
2482
if (!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger))
2488
string[] switches = commandLineSwitches1[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger];
2554
string AggregateParameters(
CommandLineSwitches
switches)
2556
string[] terminalLoggerParameters = switches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters];
2624
private static
CommandLineSwitches
CombineSwitchesRespectingPriority(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
switchesNotFromAutoResponseFile, string commandLine)
2631
CommandLineSwitches
commandLineSwitches = new CommandLineSwitches();
2637
private static bool WarningsAsErrorsSwitchIsEmpty(
CommandLineSwitches
commandLineSwitches)
2639
string val = commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
2713
private static string ProcessOutputResultsCache(
CommandLineSwitches
commandLineSwitches)
2715
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache)
2716
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
2720
private static string[] ProcessInputResultsCaches(
CommandLineSwitches
commandLineSwitches)
2722
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches)
2723
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches].Where(p => p != null).ToArray()
2834
private static ISet<string> ProcessWarningRelatedSwitch(
CommandLineSwitches
commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch warningSwitch)
2863
internal static ISet<string> ProcessWarnAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
2865
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
2868
internal static ISet<string> ProcessWarnAsMessageSwitch(
CommandLineSwitches
commandLineSwitches)
2870
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsMessages);
2873
internal static ISet<string> ProcessWarnNotAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
2875
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors);
2972
private static void StartLocalNode(
CommandLineSwitches
commandLineSwitches, bool lowpriority)
2974
string[] input = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeMode];
2991
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3000
bool taskHostNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3001
byte parentPacketVersion = ProcessParentPacketVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ParentPacketVersion]);
3339
CommandLineSwitches
commandLineSwitches,
3351
string[] loggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Logger];
3352
string[] distributedLoggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger];
3353
string[] verbositySwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Verbosity];
3354
bool noConsoleLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger];
3355
bool distributedFileLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger];
3356
string[] fileLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters]; // used by DistributedFileLogger
3357
string[] consoleLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters];
3358
string[] binaryLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger];
3359
string[] profileEvaluationParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ProfileEvaluation];
3368
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary))
3370
detailedSummary = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary], defaultValue: true, resourceName: "InvalidDetailedSummaryValue");
4175
private static void DisplayVersionMessageIfNeeded(bool recursing, bool useTerminalLogger, bool noLogo,
CommandLineSwitches
commandLineSwitches)
4187
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess) &&
4188
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetProperty) &&
4189
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetItem) &&
4190
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult) &&
4191
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability) &&
4211
foreach (string parameterizedSwitchRsouceId in
CommandLineSwitches
.GetParameterizedSwitchResourceIds())
4215
foreach (string parameterlessSwitchRsouceId in
CommandLineSwitches
.GetParameterlessSwitchResourceIds())