Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change [exec] label in output for Ant <exec> task

I am using Ant's <parallel> task to perform multiple simultaneous targets that use <exec> tasks, but it's difficult to read the output because it is interleaved. Is there any way to change the [exec] label that appears before each line of output to use the command or target name?

For example, while running pdepend and phpcpd I would like to change [exec] to [pdepend] and [phpcpd]:

pdepend:
    [exec] PHP_Depend 0.10.5 by Manuel Pichler
    [exec] 

phpcpd:
    [exec] Parsing source files:
    [exec] phpcpd 1.3.2 by Sebastian Bergmann.
    [exec] 
    [exec] ............................................................    60
    [exec] Found 26 exact clones with 640 duplicated lines in 28 files:
    [exec] 
    [exec]   - application/modules/controllers/IndexController.php:16-31
    [exec] ............................................................   120
    [exec]     application/modules/controllers/ErrorController.php:15-30
    [exec] 
    [exec]   - application/modules/controllers/PhotosController.php:24-33
    [exec] ............................................................   180
    [exec] ............................................................   240

becomes

pdepend:
 [pdepend] PHP_Depend 0.10.5 by Manuel Pichler
 [pdepend] 

phpcpd:
  [phpcpd] Parsing source files:
  [phpcpd] phpcpd 1.3.2 by Sebastian Bergmann.
  [phpcpd] 
 [pdepend] ............................................................    60
  [phpcpd] Found 26 exact clones with 640 duplicated lines in 28 files:
  [phpcpd] 
  [phpcpd]   - application/modules/controllers/IndexController.php:16-31
 [pdepend] ............................................................   120
  [phpcpd]     application/modules/controllers/ErrorController.php:15-30
  [phpcpd] 
  [phpcpd]   - application/modules/controllers/PhotosController.php:24-33
 [pdepend] ............................................................   180
 [pdepend] ............................................................   240
like image 568
David Harkness Avatar asked May 25 '11 18:05

David Harkness


1 Answers

Have you tried setting the taskname attribute on the exec task? I'll double check in a couple of hours and confirm.

Update: Yep, taskname does the trick. e.g.,

<exec executable="phpcpd" taskname="phpcpd">
    ...
</exec>

From Common Attributes of all Tasks:

taskname: A different name for this task instance - will show up in the logging output.

like image 128
Tom Howard Avatar answered Oct 11 '22 04:10

Tom Howard