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)
3136
CommandLineSwitches commandLineSwitches = new
CommandLineSwitches
();
183 references to CommandLineSwitches
MSBuild (183)
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 = "")
310
if (
CommandLineSwitches
.IsParameterlessSwitch(switchName, out var parameterlessSwitch, out var duplicateSwitchErrorMessage))
314
else if (
CommandLineSwitches
.IsParameterizedSwitch(switchName, out var parameterizedSwitch, out duplicateSwitchErrorMessage, out var multipleParametersAllowed, out var missingParametersErrorMessage, out var unquoteParameters, out var allowEmptyParameters))
333
private void GatherResponseFileSwitch(string unquotedCommandLineArg,
CommandLineSwitches
commandLineSwitches, string commandLine)
398
CommandLineSwitches
.SwitchesFromResponseFiles.Add((responseFile, string.Join(" ", argsFromResponseFile)));
431
CommandLineSwitches
commandLineSwitches,
432
CommandLineSwitches
.ParameterlessSwitch parameterlessSwitch,
471
CommandLineSwitches
commandLineSwitches,
472
CommandLineSwitches
.ParameterizedSwitch parameterizedSwitch,
493
if (parameterizedSwitch ==
CommandLineSwitches
.ParameterizedSwitch.Project && IsEnvironmentVariable(switchParameters))
527
internal bool CheckAndGatherProjectAutoResponseFile(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
commandLineSwitches, bool recursing, string commandLine)
531
var projectDirectory = GetProjectDirectory(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project]);
533
if (!recursing && !commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
661
private bool GatherAutoResponseFileSwitches(string path,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
667
private bool GatherAutoResponseFileSwitchesFromFullPath(string autoResponseFile,
CommandLineSwitches
switchesFromAutoResponseFile, string commandLine)
678
if (switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse])
681
switchesFromAutoResponseFile.GetParameterlessSwitchCommandLineArg(
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse), commandLine);
734
CommandLineSwitches
.SwitchesFromResponseFiles = new();
CommandLine\CommandLineSwitches.cs (1)
916
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)
FilteredBinlogReplay.cs (31)
48
internal static bool IsRequested(string inputPath,
CommandLineSwitches
switches)
52
var processed = BinaryLogger.ProcessParameters(switches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger]);
65
internal static FilteredBinlogReplay Create(string inputPath,
CommandLineSwitches
switches)
68
var processed = BinaryLogger.ProcessParameters(switches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger]);
100
private static void ValidateSwitches(
CommandLineSwitches
switches)
102
foreach (
CommandLineSwitches
.ParameterizedSwitch kind in Enum.GetValues(typeof(
CommandLineSwitches
.ParameterizedSwitch)))
104
if (kind is
CommandLineSwitches
.ParameterizedSwitch.Invalid or
CommandLineSwitches
.ParameterizedSwitch.NumberOfParameterizedSwitches
111
kind is
CommandLineSwitches
.ParameterizedSwitch.Project
112
or
CommandLineSwitches
.ParameterizedSwitch.Logger
113
or
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger
114
or >=
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters and <=
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters9
115
or
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger
116
or
CommandLineSwitches
.ParameterizedSwitch.Verbosity
117
or
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters
118
or
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger
119
or
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters
120
or
CommandLineSwitches
.ParameterizedSwitch.NoLogo
121
or
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount
122
or
CommandLineSwitches
.ParameterizedSwitch.NodeReuse
123
or
CommandLineSwitches
.ParameterizedSwitch.LowPriority,
128
foreach (
CommandLineSwitches
.ParameterlessSwitch kind in Enum.GetValues(typeof(
CommandLineSwitches
.ParameterlessSwitch)))
130
if (kind is
CommandLineSwitches
.ParameterlessSwitch.Invalid or
CommandLineSwitches
.ParameterlessSwitch.NumberOfParameterlessSwitches
137
kind is
CommandLineSwitches
.ParameterlessSwitch.NoAutoResponse
138
or
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger
139
or >=
CommandLineSwitches
.ParameterlessSwitch.FileLogger and <=
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger,
XMake.cs (121)
365
out
CommandLineSwitches
switchesFromAutoResponseFile,
366
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
448
out
CommandLineSwitches
switchesFromAutoResponseFile,
449
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
469
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
487
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project],
488
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions],
495
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
501
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help] ||
502
commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode) ||
503
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version] ||
899
CommandLineSwitches
preGatheredSwitchesFromAutoResponseFile,
900
CommandLineSwitches
preGatheredSwitchesNotFromAutoResponseFile)
996
CommandLineSwitches
switchesFromAutoResponseFile;
997
CommandLineSwitches
switchesNotFromAutoResponseFile;
1064
CommandLineSwitches
.SwitchesFromResponseFiles = null;
1073
&& switchesNotFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1074
&& switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1838
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Preprocess);
1859
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Targets);
2501
CommandLineSwitches
switchesFromAutoResponseFile,
2502
CommandLineSwitches
switchesNotFromAutoResponseFile,
2552
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, commandLine);
2574
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NoLogo))
2576
noLogo = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NoLogo], defaultValue: true, resourceName: "InvalidNoLogoValue");
2589
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.LowPriority))
2591
lowPriority = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.LowPriority], defaultValue: true, resourceName: "InvalidLowPriorityValue");
2618
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help])
2622
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode))
2639
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version])
2644
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability))
2646
ShowFeatureAvailability(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability]);
2713
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project],
2714
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions],
2720
string terminalLoggerArgument = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger].LastOrDefault();
2730
targets = ProcessTargetSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Target]);
2733
getProperty = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetProperty] ?? [];
2734
getItem = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetItem] ?? [];
2735
getTargetResult = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult] ?? [];
2736
getResultOutputFile = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
2741
commandLineSwitches.SetParameterizedSwitch(
CommandLineSwitches
.ParameterizedSwitch.Verbosity, "q", "q", true, true, true);
2747
toolsVersion = ProcessToolsVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ToolsVersion]);
2750
globalProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Property]);
2753
restoreProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.RestoreProperty]);
2756
cpuCount = ProcessMaxCPUCountSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount]);
2764
enableNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
2768
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess))
2770
preprocessWriter = ProcessPreprocessSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Preprocess]);
2775
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Targets))
2777
targetsWriter = ProcessTargetsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Targets]);
2786
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Restore))
2788
enableRestore = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Restore], defaultValue: true, resourceName: "InvalidRestoreValue");
2791
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Interactive))
2793
interactive = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Interactive], defaultValue: true, resourceName: "InvalidInteractiveValue");
2796
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects))
2798
isolateProjects = ProcessIsolateProjectsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects]);
2801
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GraphBuild))
2803
graphBuild = ProcessGraphBuildSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GraphBuild]);
2810
question = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Question);
2857
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors) &&
2861
commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors),
2873
private static bool IsBuildCheckEnabled(
CommandLineSwitches
commandLineSwitches)
2876
bool isBuildCheckEnabled = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Check);
2880
internal static bool IsMultiThreadedEnabled(
CommandLineSwitches
commandLineSwitches)
2888
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded))
2891
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded],
2899
internal static bool IsPrecomputeEnabled(
CommandLineSwitches
commandLineSwitches)
2901
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Precompute))
2904
commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Precompute],
2924
private static bool ProcessTerminalLoggerConfiguration(
CommandLineSwitches
commandLineSwitches, out string aggregatedParameters)
3018
bool TryFromCommandLine(
CommandLineSwitches
commandLineSwitches1)
3020
if (!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger))
3026
string[] switches = commandLineSwitches1[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger];
3092
string AggregateParameters(
CommandLineSwitches
switches)
3094
string[] terminalLoggerParameters = switches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters];
3129
internal static
CommandLineSwitches
CombineSwitchesRespectingPriority(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
switchesNotFromAutoResponseFile, string commandLine)
3136
CommandLineSwitches
commandLineSwitches = new CommandLineSwitches();
3142
private static bool WarningsAsErrorsSwitchIsEmpty(
CommandLineSwitches
commandLineSwitches)
3144
string val = commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3218
private static string ProcessOutputResultsCache(
CommandLineSwitches
commandLineSwitches)
3220
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache)
3221
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
3225
private static string[] ProcessInputResultsCaches(
CommandLineSwitches
commandLineSwitches)
3227
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches)
3228
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches].Where(p => p != null).ToArray()
3351
private static ISet<string> ProcessWarningRelatedSwitch(
CommandLineSwitches
commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch warningSwitch)
3380
internal static ISet<string> ProcessWarnAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3382
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3385
internal static ISet<string> ProcessWarnAsMessageSwitch(
CommandLineSwitches
commandLineSwitches)
3387
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsMessages);
3390
internal static ISet<string> ProcessWarnNotAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3392
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors);
3489
private static void StartLocalNode(
CommandLineSwitches
commandLineSwitches, bool lowpriority)
3491
string[] input = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeMode];
3508
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3517
bool taskHostNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3518
byte parentPacketVersion = ProcessParentPacketVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ParentPacketVersion]);
3565
OutOfProcServerNode serverNode = new(buildFunction, ProcessServerInstanceIdSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ServerInstanceId]));
3907
CommandLineSwitches
commandLineSwitches,
3920
string[] loggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Logger];
3921
string[] distributedLoggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger];
3922
string[] verbositySwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Verbosity];
3923
bool noConsoleLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger];
3924
bool distributedFileLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger];
3925
string[] fileLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters]; // used by DistributedFileLogger
3926
string[] consoleLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters];
3927
string[] binaryLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger];
3928
string[] profileEvaluationParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ProfileEvaluation];
3937
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary))
3939
detailedSummary = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary], defaultValue: true, resourceName: "InvalidDetailedSummaryValue");
4749
private static void DisplayVersionMessageIfNeeded(bool recursing, bool useTerminalLogger, bool noLogo,
CommandLineSwitches
commandLineSwitches)
4761
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess) &&
4762
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetProperty) &&
4763
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetItem) &&
4764
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult) &&
4765
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability) &&
4785
foreach (string parameterizedSwitchRsouceId in
CommandLineSwitches
.GetParameterizedSwitchResourceIds())
4789
foreach (string parameterlessSwitchRsouceId in
CommandLineSwitches
.GetParameterlessSwitchResourceIds())