示例#1
0
 private static void InvokeTask(ITargetBuilderBounce bounce, IBounceCommand command, string name, ITask task)
 {
     using (var targetScope = bounce.TaskScope(task, command, name)) {
         bounce.Invoke(command, task);
         targetScope.TaskSucceeded();
     }
 }
示例#2
0
 public void BuildTargets(ITargetBuilderBounce bounce, IEnumerable<Target> targets, IBounceCommand command) {
     foreach (var target in targets) {
         if (target.Task != null) {
             InvokeTask(bounce, command, target.Name, target.Task);
         }
     }
 }
示例#3
0
文件: TaskLog.cs 项目: nbucket/bounce
 public void EndTarget(IObsoleteTask task, string name, IBounceCommand command, TaskResult result) {
     if (logOptions.ReportTargetEnd) {
         if (result == TaskResult.Success) {
             StdOut.WriteLine("{0} target: {1}", command.PastTense, name);
         } else {
             StdErr.WriteLine("failed to {0} target: {1}", command.InfinitiveTense, name);
         }
     }
 }
示例#4
0
 public void CleanAfterBuild(IBounceCommand command)
 {
     IBounceCommand cleanAfterBuildCommand = command.CleanAfterBuildCommand;
     if (cleanAfterBuildCommand != null) {
         foreach (var taskToClean in CleanAfterBuildRegister.TasksToBeCleaned) {
             Clean(taskToClean, cleanAfterBuildCommand);
         }
     }
 }
示例#5
0
文件: TaskLog.cs 项目: nbucket/bounce
 public void EndTask(IObsoleteTask task, IBounceCommand command, TaskResult result) {
     if (logOptions.ReportTaskEnd && task.IsLogged && command.IsLogged) {
         if (result == TaskResult.Success) {
             StdOut.WriteLine("{0} task: {1}", command.PastTense, task);
         } else {
             StdErr.WriteLine("failed to {0} task: {1}", command.InfinitiveTense, task);
         }
     }
 }
示例#6
0
        private void AssertBuildCommandProperties(IBounceCommand command)
        {
            Assert.That(command.PastTense, Is.EqualTo("built"));
            Assert.That(command.PresentTense, Is.EqualTo("building"));
            Assert.That(command.InfinitiveTense, Is.EqualTo("build"));

            bool built = false;
            command.InvokeCommand(() => built = true, () => Assert.Fail("didn't expect this to be invoked"), () => Assert.Fail("didn't expect this to be invoked"));
            Assert.That(built);
        }
示例#7
0
        private void AssertCleanCommandProperties(IBounceCommand command)
        {
            Assert.That(command.CommandLineCommand, Is.EqualTo("clean"));
            Assert.That(command.PastTense, Is.EqualTo("cleaned"));
            Assert.That(command.PresentTense, Is.EqualTo("cleaning"));
            Assert.That(command.InfinitiveTense, Is.EqualTo("clean"));

            bool cleaned = false;
            command.InvokeCommand(() => Assert.Fail("didn't expect this to be invoked"), () => cleaned = true, () => Assert.Fail("didn't expect this to be invoked"));
            Assert.That(cleaned);
        }
示例#8
0
        private void AssertDescribeCommandProperties(IBounceCommand command)
        {
            Assert.That(command.CommandLineCommand, Is.EqualTo("describe"));
            Assert.That(command.PastTense, Is.EqualTo("described"));
            Assert.That(command.PresentTense, Is.EqualTo("describing"));
            Assert.That(command.InfinitiveTense, Is.EqualTo("describe"));

            bool described = false;
            command.InvokeCommand(() => Assert.Fail("didn't expect this to be invoked"), () => Assert.Fail("didn't expect this to be invoked"), () => described = true);
            Assert.That(described);
        }
示例#9
0
        private bool TryParseCommand(string commandString, ref IBounceCommand bounceCommand)
        {
            var command = BounceCommandParser.Parse(commandString);

            if (command != null) {
                bounceCommand = command;
                return true;
            } else {
                return false;
            }
        }
示例#10
0
 private void InvokeAndLog(IObsoleteTask task, IBounceCommand command)
 {
     using (var taskScope = Bounce.TaskScope(task, command, null)) {
         try {
             task.Describe(Bounce.DescriptionOutput);
             task.Invoke(command, Bounce);
             taskScope.TaskSucceeded();
         } catch (BounceException) {
             throw;
         } catch (Exception e) {
             throw new TaskException(task, e);
         }
     }
 }
示例#11
0
 public override void Invoke(IBounceCommand command, IBounce bounce)
 {
     base.Invoke(command, bounce);
     Invoked = true;
 }
示例#12
0
 private void DescribeIfNotDescribed(TaskDependency dep, IBounceCommand command)
 {
     OnceOnlyDescriber.EnsureInvokedAtLeastOnce(dep.Task, command);
 }
示例#13
0
 private void Describe(IObsoleteTask task, IBounceCommand command)
 {
     Walker.Walk(new TaskDependency(task), null, dep => DescribeIfNotDescribed(dep, command));
 }
示例#14
0
 private void CleanIfNotAlreadyCleaned(TaskDependency dep, IBounceCommand command)
 {
     OnceOnlyCleaner.EnsureInvokedAtLeastOnce(dep.Task, command);
 }
示例#15
0
 private void Clean(IObsoleteTask task, IBounceCommand command)
 {
     Walker.Walk(new TaskDependency(task), dep => CleanIfNotAlreadyCleaned(dep, command), null);
 }
示例#16
0
文件: FakeLog.cs 项目: nbucket/bounce
 public void EndTarget(IObsoleteTask task, string name, IBounceCommand command, TaskResult result)
 {
 }
示例#17
0
 public void BeginTask(IObsoleteTask task, IBounceCommand command) {
     output.WriteLine(TeamCityFormatter.FormatTeamCityMessage("progressStart", task.SmallDescription));
 }
示例#18
0
 public void EnsureInvokedAtLeastOnce(IObsoleteTask task, IBounceCommand command)
 {
     if (!InvokedTasks.Contains(task)) {
         Invoke(task, command);
         InvokedTasks.Add(task);
     }
 }
示例#19
0
 public void BeginTarget(IObsoleteTask task, string name, IBounceCommand command) {
     output.WriteLine(TeamCityFormatter.FormatTeamCityMessage("progressStart", name));
 }
示例#20
0
文件: TaskLog.cs 项目: haos11/bounce
 public void BeginTask(ITask task, IBounceCommand command)
 {
     if (logOptions.ReportTaskStart && task.IsLogged && command.IsLogged) {
         StdOut.WriteLine("{0} task: {1}", command.PresentTense, task);
     }
 }
示例#21
0
文件: TaskLog.cs 项目: haos11/bounce
 public void BeginTarget(ITask task, string name, IBounceCommand command)
 {
     if (logOptions.ReportTargetStart) {
         StdOut.WriteLine("{0} target: {1}", command.PresentTense, name);
     }
 }
示例#22
0
文件: FakeLog.cs 项目: nbucket/bounce
 public void EndTask(IObsoleteTask task, IBounceCommand command, TaskResult result)
 {
 }
        private void AssertCommandAndTargetsParsed(IBounceCommand bounceCommand, string[] buildArguments)
        {
            var parser = new CommandAndTargetParser(BounceCommandParser);
            var targets = new Dictionary<string, IObsoleteTask>();
            var target1 = new Mock<IObsoleteTask>().Object;
            targets.Add("Target1", target1);
            var target2 = new Mock<IObsoleteTask>().Object;
            targets.Add("Target2", target2);

            var commandAndTargetNames = parser.ParseCommandAndTargetNames(buildArguments, targets);

            Assert.That(commandAndTargetNames.Command, Is.EqualTo(bounceCommand));
            Assert.That(commandAndTargetNames.Targets.ElementAt(0).Name, Is.EqualTo("Target1"));
            Assert.That(commandAndTargetNames.Targets.ElementAt(0).Task, Is.SameAs(target1));
            Assert.That(commandAndTargetNames.Targets.ElementAt(1).Name, Is.EqualTo("Target2"));
            Assert.That(commandAndTargetNames.Targets.ElementAt(1).Task, Is.SameAs(target2));
        }
示例#24
0
 private void BuildIfNotAlreadyBuilt(TaskDependency dep, IBounceCommand command)
 {
     OnceOnlyBuilder.EnsureInvokedAtLeastOnce(dep.Task, command);
 }
示例#25
0
 public virtual void Invoke(IBounceCommand command, IObsoleteTask task)
 {
     task.Invoke(command, this);
 }
示例#26
0
文件: FakeLog.cs 项目: nbucket/bounce
 public void BeginTask(IObsoleteTask task, IBounceCommand command)
 {
 }
示例#27
0
 public void EndTask(IObsoleteTask task, IBounceCommand command, TaskResult result) {
     output.WriteLine(TeamCityFormatter.FormatTeamCityMessage("progressFinish", task.SmallDescription));
 }
示例#28
0
 private void Build(IObsoleteTask task, IBounceCommand command)
 {
     Walker.Walk(new TaskDependency(task), null, dep => BuildIfNotAlreadyBuilt(dep, command));
     RegisterCleanupAfterBuild(task);
 }
示例#29
0
 public void EndTarget(IObsoleteTask task, string name, IBounceCommand command, TaskResult result) {
     output.WriteLine(TeamCityFormatter.FormatTeamCityMessageWithFields("buildStatus", "status", result == TaskResult.Success? "SUCCESS": "FAILURE"));
     output.WriteLine(TeamCityFormatter.FormatTeamCityMessage("progressFinish", name));
 }
示例#30
0
 public void Invoke(IBounceCommand command, IObsoleteTask task)
 {
     command.InvokeCommand(() => Build(task, command), () => Clean(task, command), () => Describe(task, command));
 }