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)
2988
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)
323
out
CommandLineSwitches
switchesFromAutoResponseFile,
324
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
385
/// returned so the in-proc build path (<see cref="Execute(string[],
CommandLineSwitches
,
CommandLineSwitches
)"/>)
405
out
CommandLineSwitches
switchesFromAutoResponseFile,
406
out
CommandLineSwitches
switchesNotFromAutoResponseFile,
426
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, fullCommandLine);
439
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
441
string projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
447
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help] ||
448
commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode) ||
449
commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version] ||
834
CommandLineSwitches
preGatheredSwitchesFromAutoResponseFile,
835
CommandLineSwitches
preGatheredSwitchesNotFromAutoResponseFile)
929
CommandLineSwitches
switchesFromAutoResponseFile;
930
CommandLineSwitches
switchesNotFromAutoResponseFile;
994
CommandLineSwitches
.SwitchesFromResponseFiles = null;
1003
&& switchesNotFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1004
&& switchesFromAutoResponseFile[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount].Length == 0
1718
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Preprocess);
1739
Console.WriteLine(ResourceUtilities.GetResourceString("UnsupportedSwitchForSolutionFiles"),
CommandLineSwitches
.ParameterizedSwitch.Targets);
2380
CommandLineSwitches
switchesFromAutoResponseFile,
2381
CommandLineSwitches
switchesNotFromAutoResponseFile,
2429
CommandLineSwitches
commandLineSwitches = CombineSwitchesRespectingPriority(switchesFromAutoResponseFile, switchesNotFromAutoResponseFile, commandLine);
2432
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.WaitForDebugger])
2451
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NoLogo))
2453
noLogo = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NoLogo], defaultValue: true, resourceName: "InvalidNoLogoValue");
2466
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.LowPriority))
2468
lowPriority = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.LowPriority], defaultValue: true, resourceName: "InvalidLowPriorityValue");
2494
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Help])
2498
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.NodeMode))
2515
if (commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.Version])
2520
else if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability))
2522
ShowFeatureAvailability(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability]);
2585
projectFile = ProcessProjectSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Project], commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IgnoreProjectExtensions], Directory.GetFiles);
2588
targets = ProcessTargetSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Target]);
2591
getProperty = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetProperty] ?? [];
2592
getItem = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetItem] ?? [];
2593
getTargetResult = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult] ?? [];
2594
getResultOutputFile = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GetResultOutputFile].FirstOrDefault() ?? string.Empty;
2599
commandLineSwitches.SetParameterizedSwitch(
CommandLineSwitches
.ParameterizedSwitch.Verbosity, "q", "q", true, true, true);
2605
toolsVersion = ProcessToolsVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ToolsVersion]);
2608
globalProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Property]);
2611
restoreProperties = ProcessPropertySwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.RestoreProperty]);
2614
cpuCount = ProcessMaxCPUCountSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.MaxCPUCount]);
2620
enableNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
2624
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess))
2626
preprocessWriter = ProcessPreprocessSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Preprocess]);
2631
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Targets))
2633
targetsWriter = ProcessTargetsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Targets]);
2642
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Restore))
2644
enableRestore = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Restore], defaultValue: true, resourceName: "InvalidRestoreValue");
2647
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Interactive))
2649
interactive = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Interactive], defaultValue: true, resourceName: "InvalidInteractiveValue");
2652
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects))
2654
isolateProjects = ProcessIsolateProjectsSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.IsolateProjects]);
2657
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GraphBuild))
2659
graphBuild = ProcessGraphBuildSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.GraphBuild]);
2662
question = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Question);
2708
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors) &&
2712
commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors),
2724
private static bool IsBuildCheckEnabled(
CommandLineSwitches
commandLineSwitches)
2727
bool isBuildCheckEnabled = commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Check);
2731
internal static bool IsMultiThreadedEnabled(
CommandLineSwitches
commandLineSwitches)
2740
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.MultiThreaded);
2743
private static bool ProcessTerminalLoggerConfiguration(
CommandLineSwitches
commandLineSwitches, out string aggregatedParameters)
2837
bool TryFromCommandLine(
CommandLineSwitches
commandLineSwitches1)
2839
if (!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger))
2845
string[] switches = commandLineSwitches1[
CommandLineSwitches
.ParameterizedSwitch.TerminalLogger];
2911
string AggregateParameters(
CommandLineSwitches
switches)
2913
string[] terminalLoggerParameters = switches[
CommandLineSwitches
.ParameterizedSwitch.TerminalLoggerParameters];
2981
private static
CommandLineSwitches
CombineSwitchesRespectingPriority(
CommandLineSwitches
switchesFromAutoResponseFile,
CommandLineSwitches
switchesNotFromAutoResponseFile, string commandLine)
2988
CommandLineSwitches
commandLineSwitches = new CommandLineSwitches();
2994
private static bool WarningsAsErrorsSwitchIsEmpty(
CommandLineSwitches
commandLineSwitches)
2996
string val = commandLineSwitches.GetParameterizedSwitchCommandLineArg(
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3070
private static string ProcessOutputResultsCache(
CommandLineSwitches
commandLineSwitches)
3072
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache)
3073
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.OutputResultsCache].FirstOrDefault(p => p != null) ?? string.Empty
3077
private static string[] ProcessInputResultsCaches(
CommandLineSwitches
commandLineSwitches)
3079
return commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches)
3080
? commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.InputResultsCaches].Where(p => p != null).ToArray()
3191
private static ISet<string> ProcessWarningRelatedSwitch(
CommandLineSwitches
commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch warningSwitch)
3220
internal static ISet<string> ProcessWarnAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3222
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsErrors);
3225
internal static ISet<string> ProcessWarnAsMessageSwitch(
CommandLineSwitches
commandLineSwitches)
3227
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsAsMessages);
3230
internal static ISet<string> ProcessWarnNotAsErrorSwitch(
CommandLineSwitches
commandLineSwitches)
3232
return ProcessWarningRelatedSwitch(commandLineSwitches,
CommandLineSwitches
.ParameterizedSwitch.WarningsNotAsErrors);
3329
private static void StartLocalNode(
CommandLineSwitches
commandLineSwitches, bool lowpriority)
3331
string[] input = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeMode];
3348
bool nodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3357
bool taskHostNodeReuse = ProcessNodeReuseSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.NodeReuse]);
3358
byte parentPacketVersion = ProcessParentPacketVersionSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ParentPacketVersion]);
3701
CommandLineSwitches
commandLineSwitches,
3713
string[] loggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Logger];
3714
string[] distributedLoggerSwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DistributedLogger];
3715
string[] verbositySwitchParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.Verbosity];
3716
bool noConsoleLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.NoConsoleLogger];
3717
bool distributedFileLogger = commandLineSwitches[
CommandLineSwitches
.ParameterlessSwitch.DistributedFileLogger];
3718
string[] fileLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.FileLoggerParameters]; // used by DistributedFileLogger
3719
string[] consoleLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ConsoleLoggerParameters];
3720
string[] binaryLoggerParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.BinaryLogger];
3721
string[] profileEvaluationParameters = commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.ProfileEvaluation];
3730
if (commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary))
3732
detailedSummary = ProcessBooleanSwitch(commandLineSwitches[
CommandLineSwitches
.ParameterizedSwitch.DetailedSummary], defaultValue: true, resourceName: "InvalidDetailedSummaryValue");
4537
private static void DisplayVersionMessageIfNeeded(bool recursing, bool useTerminalLogger, bool noLogo,
CommandLineSwitches
commandLineSwitches)
4549
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.Preprocess) &&
4550
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetProperty) &&
4551
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetItem) &&
4552
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.GetTargetResult) &&
4553
!commandLineSwitches.IsParameterizedSwitchSet(
CommandLineSwitches
.ParameterizedSwitch.FeatureAvailability) &&
4573
foreach (string parameterizedSwitchRsouceId in
CommandLineSwitches
.GetParameterizedSwitchResourceIds())
4577
foreach (string parameterlessSwitchRsouceId in
CommandLineSwitches
.GetParameterlessSwitchResourceIds())