ant support for dynamic target

Posted by Li He on Stack Overflow See other posts from Stack Overflow or by Li He
Published on 2013-11-01T21:50:15Z Indexed on 2013/11/01 21:53 UTC
Read the original article Hit count: 170

Filed under:

I previous saw some similar questions on stackoverflow but didn't see any solution. I guess the answer could be impossible and I am trying to see who can provide me this confirmation.

AFAIK, an ant project contains several targets and each target may have several tasks. There is an task MacroDef that defines a sequential of `things' (tasks I suppose?). I tried to put target inside this block but ant complains the name of the target is missing (I am using the attribute of the macrodef to generate the name of the target). So it could be a dead end.

Then I found that by using a task `script', we have access to the Project and can even call addTarget/AddOrReplaceTarget from there. But it seems that the targets I create there have no impact on the running targets.

Does that mean ant doesn't support manipulating dependencies at target runtime? Is there any way to generate these targets before ant start building the dependency graph?

© Stack Overflow or respective owner

Related posts about ant