private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Constants.TASK_CATEGORY); string rootDir = Path.GetDirectoryName(configPath); var commands = TaskParser.LoadTasks(configPath); if (commands == null) { return(root); } TaskRunnerNode tasks = new TaskRunnerNode("Commands"); tasks.Description = "A list of command to execute"; root.Children.Add(tasks); foreach (CommandTask command in commands.OrderBy(k => k.Name)) { string cwd = command.WorkingDirectory ?? rootDir; // Add zero width space string commandName = command.Name += "\u200B"; SetDynamicTaskName(commandName); TaskRunnerNode task = new TaskRunnerNode(commandName, true) { Command = new TaskRunnerCommand(cwd, command.FileName, command.Arguments), Description = $"Filename:\t {command.FileName}\r\nArguments:\t {command.Arguments}" }; tasks.Children.Add(task); } return(root); }
private void AppendCommands(ref ITaskRunnerNode root, string configPath, string name, string description) { string rootDir = Path.GetDirectoryName(configPath); IEnumerable <CommandTask> commands = TaskParser.LoadTasks(configPath); if (commands == null) { return; } var tasks = new TaskRunnerNode(name); tasks.Description = description; root.Children.Add(tasks); foreach (CommandTask command in commands.OrderBy(k => k.Name)) { command.Name = SetVariables(command.Name, rootDir); command.WorkingDirectory = SetVariables(command.WorkingDirectory, rootDir); string cwd = command.WorkingDirectory ?? rootDir; // Add zero width space string commandName = command.Name; var task = new TaskRunnerNode(commandName, true) { Command = new DynamicTaskRunnerCommand(this, rootDir, cwd, command.FileName, command.Arguments), Description = $"Filename:\t {command.FileName}\r\nArguments:\t {command.Arguments}" }; tasks.Children.Add(task); } }
private ITaskRunnerNode LoadHierarchy(string configPath) { ITaskRunnerNode root = new TaskRunnerNode(Constants.TASK_CATEGORY); string rootDir = Path.GetDirectoryName(configPath); IEnumerable <CommandTask> commands = TaskParser.LoadTasks(configPath); if (commands == null) { return(root); } var tasks = new TaskRunnerNode("Commands"); tasks.Description = "A list of command to execute"; root.Children.Add(tasks); Project proj = GetProject(rootDir); foreach (CommandTask command in commands.OrderBy(k => k.Name)) { command.Name = SetVariables(command.Name, rootDir); command.WorkingDirectory = SetVariables(command.WorkingDirectory, rootDir); string cwd = command.WorkingDirectory ?? rootDir; // Add zero width space string commandName = command.Name; TaskRunnerNode task = proj != null && command.ReloadProject ? new TaskRunnerNodeContinuation(commandName, (result) => ProjectReload.InfoBar.ShowAsync(_serviceProvider, proj)) : new TaskRunnerNode(commandName, true); task.Command = new DynamicTaskRunnerCommand(this, rootDir, cwd, command.FileName, command.Arguments); task.Description = $"Filename:\t {command.FileName}\r\nArguments:\t {command.Arguments}"; tasks.Children.Add(task); } return(root); }