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