Search code examples
antconcurrencysemaphorewaitflexunit

Wait for another ANT build/task to finish


I would like to make ANT process wait for another build or task to finish.

The situation is: I execute a few ANT builds simultaneously. In these builds there are tasks to test the apps. Unfortunately, only one flexunit task can be run at the same time, because it uses net socket to communicate with the AIR app.

The build process should wait for the end of the tasks from other build processes before starting its task.

How to achieve that?

Thank you for any hints,

Rafal


Solution

  • Use the <waitfor> task with your choice of synchronization. I always use an "IGotTheResourceSoYouCantHaveIt" file that gets created after <waitfor> and deleted when I'm done with it.

    Details:

    • delete the file in some higher-level "clean" so that if a build aborts it gets deleted eventually.
    • there's a small race condition between the <waitfor> and creating the file. In my use, it's not worth worrying about.