You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by Raja Nagendra Kumar <Na...@tejasoft.com> on 2009/04/01 15:56:00 UTC

Ant arguments handling

Hi,

I have a build xml with target say 'compile'

However if the user says 'ant comp' or any other target which does not
exists, I want to handle them using a my custom code either a macro or a ant
custom task or groovy. 

Is this possible, if yes, could you pl. let me know the right place to get
more info on this.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
-- 
View this message in context: http://www.nabble.com/Ant-arguments-handling-tp22827023p22827023.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: AW: Ant arguments handling

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Thank You Jan, This details of yours and Ant support to meet such needs is
simple and helps us to designg a powerver target handling system for our
Mobile Development/Porting Product Development Platform.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com
-- 
View this message in context: http://www.nabble.com/Ant-arguments-handling-tp22827023p22841535.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


AW: Ant arguments handling

Posted by Ja...@rzf.fin-nrw.de.
> I have a build xml with target say 'compile'
> 
> However if the user says 'ant comp' or any other target which does not
> exists, I want to handle them using a my custom code either a 
> macro or a ant
> custom task or groovy. 
> 
> Is this possible, if yes, could you pl. let me know the right 
> place to get
> more info on this.


While this scenario is directly supported it could be achieved using
some hooks:
- the execution of targets is delegated by the org.apache.tools.ant.Main
class
  to an Executor 
 
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools
/ant/Main.java
  line 775: project.executeTargets(targets);

 
http://svn.apache.org/repos/asf/ant/core/trunk/src/main/org/apache/tools
/ant/Project.java
    public void executeTargets(Vector names) throws BuildException {
        ...
        getExecutor().executeTargets( ... );
    }

   getExecutor() returns an implementation of
org.apache.tools.ant.Executor. The 
   class to return is defined by the property "ant.executor.class".

- you could implement your own executor which works like
    executeTargets(Vector names) {
        List missingTargets = checkTargetExistence(names);
        if (missingTargets.isEmpty()) {
            getExecutorDelegate().executeTargets(names);
        } else {
            handleTargetMissingError(missingTargets);
        }


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


AW: Ant arguments handling (Virtual Ant Targets handling using custom code)

Posted by Ja...@rzf.fin-nrw.de.
> * it looks like we need to place the custom executor calss in 
> ant lib folder
>    - Is there a way to tell the ant to look for my project 
> libraries to find this custom executor

Use the -lib option of Ant to include your jar.


> * What is the default Executor the ant uses, so that for 
> certain tasks we wish to deligate to the default executor - is this
reference 
> avaiable some where so that I could use that reference to deligate

Not sure.
Should be org.apache.tools.ant.helper.DefaultExecutor.
BTW in that package are more executors ...


> * for IDE integration by giving the build.xml to the ide, how 
> do we tell the IDE that vitural targets exists so that it could
display as 
> one of the valid target with in the listed targests supported by the
ant xml file.

Not sure, that is IDE specific.


>   - Is there any interface which we need to impl. which gives 
> the list of valid targets. Executor should have had this method.. but
it 
> does not seem to have one.

The project instance holds the list. 
Youll get the reference as first parameter.


> * Could you pl. give more details on what the significance of
> getSubProjectExecutor()

No idea.


Jan

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Re: Ant arguments handling (Virtual Ant Targets handling using custom code)

Posted by Raja Nagendra Kumar <Na...@tejasoft.com>.
Hi,

Jan, we are trying to set our own executor, however we are phasing the
following issues 

* it looks like we need to place the custom executor calss in ant lib folder
   - Is there a way to tell the ant to look for my project libraries to find
this custom executor
* What is the default Executor the ant uses, so that for certain tasks we
wish to deligate to the default executor - is this reference avaiable some
where so that I could use that reference to deligate
* for IDE integration by giving the build.xml to the ide, how do we tell the
IDE that vitural targets exists so that it could display as one of the valid
target with in the listed targests supported by the ant xml file.
  - Is there any interface which we need to impl. which gives the list of
valid targets. Executor should have had this method.. but it does not seem
to have one.

* Could you pl. give more details on what the significance of
getSubProjectExecutor()

Regards,
Nagendra


-- 
View this message in context: http://www.nabble.com/Ant-arguments-handling-tp22827023p22846177.html
Sent from the Ant - Dev mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org