public void Run(string[] args, MethodInfo getTargetsMethod) { TargetsPath = new Uri(getTargetsMethod.Module.Assembly.CodeBase).LocalPath; var parameters = new CommandLineParameters(); try { IDictionary <string, IObsoleteTask> targets = GetTargetsFromAssembly(getTargetsMethod, parameters); ParsedCommandLineParameters parsedParameters = ParseCommandLineArguments(args); string[] buildArguments = parsedParameters.RemainingArguments; CommandAndTargets commandAndTargets = CommandAndTargetParser.ParseCommandAndTargetNames(buildArguments, targets); if (commandAndTargets.Targets.Count() >= 1) { var bounce = new Bounce(); InterpretParameters(parameters, parsedParameters, bounce); try { EnsureAllRequiredParametersAreSet(parameters, commandAndTargets.Targets); BuildTargets(bounce, commandAndTargets); } catch (BounceException ce) { ce.Explain(bounce.LogOptions.StdErr); Environment.Exit(1); } } else { System.Console.WriteLine("usage: bounce build|clean target-name"); PrintAvailableTargets(targets); Environment.Exit(1); } } catch (BounceException ce) { ce.Explain(System.Console.Error); Environment.Exit(1); } }
public void Run(string[] args, MethodInfo getTargetsMethod) { TargetsPath = new Uri(getTargetsMethod.Module.Assembly.CodeBase).LocalPath; var parameters = new CommandLineParameters(); try { IDictionary<string, IObsoleteTask> targets = GetTargetsFromAssembly(getTargetsMethod, parameters); ParsedCommandLineParameters parsedParameters = ParseCommandLineArguments(args); string[] buildArguments = parsedParameters.RemainingArguments; CommandAndTargets commandAndTargets = CommandAndTargetParser.ParseCommandAndTargetNames(buildArguments, targets); if (commandAndTargets.Targets.Count() >= 1) { var bounce = new Bounce(); InterpretParameters(parameters, parsedParameters, bounce); try { EnsureAllRequiredParametersAreSet(parameters, commandAndTargets.Targets); BuildTargets(bounce, commandAndTargets); } catch (BounceException ce) { ce.Explain(bounce.LogOptions.StdErr); Environment.Exit(1); } } else { System.Console.WriteLine("usage: bounce build|clean target-name"); PrintAvailableTargets(targets); Environment.Exit(1); } } catch (BounceException ce) { ce.Explain(System.Console.Error); Environment.Exit(1); } }
private void InterpretParameters(ICommandLineParameters parameters, ParsedCommandLineParameters parsedParameters, Bounce bounce) { LogOptionCommandLineTranslator.ParseCommandLine(parsedParameters, bounce); bounce.ParametersGiven = parameters.ParseCommandLineArguments(parsedParameters.Parameters); }
private void BuildTargets(Bounce bounce, CommandAndTargets commandAndTargets) { TargetsBuilder.BuildTargets(bounce, commandAndTargets.Targets, commandAndTargets.Command); bounce.CleanAfterBuild(commandAndTargets.Command); }