Dynamically create new targets from with a custom task?
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Raymond_Marcil
Posted On:   Tuesday, October 15, 2002 04:29 PM

I was wondering if is possible to dynamically generate targets from within a custom task? I have a master build.xml file that calls a java custom task which generates targets and writes them to a file called modules.xml. The build.xml then calls a sub-build file that includes the modules.xml file, using an XML include. This in effect allows me to dynamically generate targets based upon any desired criteria. Ideally, I'd like the custom task to create new targets directly to the master build.xml without having to write them out to a file and call a separate script. Any ideas/suggustions, appreciated. Thanks! Ray    More>>

I was wondering if is possible to dynamically generate targets from within a custom task?


I have a master build.xml file that calls a java custom task which generates targets and writes them to a file called modules.xml. The build.xml then calls a sub-build file that includes the modules.xml file, using an XML include. This in effect allows me to dynamically generate targets based upon any desired criteria.


Ideally, I'd like the custom task to create new targets directly to the master build.xml without having to write them out to a file and call a separate script.


Any ideas/suggustions, appreciated.


Thanks! Ray

   <<Less

Re: Dynamically create new targets from with a custom task?

Posted By:   Anonymous  
Posted On:   Tuesday, October 15, 2002 11:00 PM

1. Your task instantiate targets and add them to the project (getProject().addTarget(), getProject().addOrReplaceTarget(), see JavaDoc). But you have to configure the new target (with its tasks) for your own. (Maybe you can use the configurator classes of the framework.)


2. With the