Beispiel #1
0
        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);
            }
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
 private void InterpretParameters(ICommandLineParameters parameters, ParsedCommandLineParameters parsedParameters, Bounce bounce)
 {
     LogOptionCommandLineTranslator.ParseCommandLine(parsedParameters, bounce);
     bounce.ParametersGiven = parameters.ParseCommandLineArguments(parsedParameters.Parameters);
 }
Beispiel #4
0
 private void BuildTargets(Bounce bounce, CommandAndTargets commandAndTargets)
 {
     TargetsBuilder.BuildTargets(bounce, commandAndTargets.Targets, commandAndTargets.Command);
     bounce.CleanAfterBuild(commandAndTargets.Command);
 }
Beispiel #5
0
 private void InterpretParameters(ICommandLineParameters parameters, ParsedCommandLineParameters parsedParameters, Bounce bounce)
 {
     LogOptionCommandLineTranslator.ParseCommandLine(parsedParameters, bounce);
     bounce.ParametersGiven = parameters.ParseCommandLineArguments(parsedParameters.Parameters);
 }
Beispiel #6
0
 private void BuildTargets(Bounce bounce, CommandAndTargets commandAndTargets)
 {
     TargetsBuilder.BuildTargets(bounce, commandAndTargets.Targets, commandAndTargets.Command);
     bounce.CleanAfterBuild(commandAndTargets.Command);
 }