ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mpfoe...@ThoughtWorks.com
Subject Re: imports
Date Thu, 28 Dec 2000 17:31:32 GMT

An idea I floated earlier is that there would be a "project path" defined
outsided of the build file, which would be searched whenever an import
statement was executed. So when ant found something like this:

     <import name="xerces"/>

It would search the project path for a file named "xerces.ant". That way I
don't have to hard code the location of the xerces project, which might be
different for each developer. The project path would always include the
current directory, however, to handle the simple case automatically. For
cases where we do know the location, we could override the project path in
the import statement. This would import the foo.ant project from the
parsers directory:

     <import name="foo" path="parsers"/>

After a project is imported, you can access its properties as well as its
targets. So to compile something against the xerces jar you could do this:

     <project name="mysystem">
          <import name="xerces"/>
               ...
                    <javac classpath="${xerces:dist.jar}" ... />
               ...

Taken a step further, the same mechanism can be used to load sets of tasks.
Assuming we have some way to specify an "init" target for a project (which
always gets executed), we could define a project that does nothing more
than load tasks:

     <project name="weblogic-tasks" init="load-tasks">
          <target name="load-tasks">
               <taskdef name="ejbc" classname="..."/>
               ...

Then, assuming the developer has this antfile somewhere along their project
path, we can load the tasks by just importing this project:

     <project name="mysystem">
          <import name="weblogic-tasks"/>

          <target name="abc">
               <ejbc .../>
               ...

Thoughts?

Matt Foemmel
ThoughtWorks, Inc.


                                                                                         
                         
                    James Duncan                                                         
                         
                    Davidson             To:     <ant-dev@jakarta.apache.org>      
                               
                    <duncan@x180.        cc:                                          
                            
                    net>                 Subject:     Re: imports (was RE: Did somebody
say Shut up and Write? :)) 
                                                                                         
                         
                    12/28/2000                                                           
                         
                    12:46 AM                                                             
                         
                    Please                                                               
                         
                    respond to                                                           
                         
                    ant-dev                                                              
                         
                                                                                         
                         
                                                                                         
                         




Hmmm. Are your import names abstract names and the import actually looks
something like:

    <import name="drivers" location="src/drivers/drivers.ant"/>
    <import name="parsers" location="src/parsers/parsers.ant"/>





Mime
View raw message