ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stefan Bodewig <bode...@apache.org>
Subject Names of import/include
Date Tue, 11 Nov 2008 11:21:06 GMT
Hi all,

after I've added include I'm not too sure about its name.  What we
call "import" is called "extends" by EasyAnt and our "include" is
EasyAnt's "use".

I will reproduce the "how is import different from include" section I
added to both manual pages to give you the full background.  What
names should we use for the final releaseable version?

Stefan

,----
| When using import the imported targets are available by up to two
| names. Their "normal" name without any prefix and potentially with a
| prefixed name (the value of the as attribute or the imported project's
| name attribute, if any).
| 
| When using include the included targets are only available in the
| prefixed form.
| 
| When using import, the imported target's depends attribute remains
| unchanged, i.e. it uses "normal" names and allows you to override
| targets in the dependency list.
| 
| When using include, the included target's depends attribute is
| rewritten so that prefixed names are used. This allows writers of the
| included file to control which target is invoked as part of the
| dependencies.
| 
| It is possible to include the same file more than once by using
| different prefixes, it is not possible to import the same file more
| than once.
| 
| Use import if you intend to override a target, otherwise use include.
| 
| nested.xml shall be:
| 
| <project>
|   <target name="setUp">
|     <property name="prop" value="in nested"/>
|   </target>
| 
|   <target name="echo" depends="setUp">
|     <echo>prop has the value ${prop}</echo>
|   </target>
| </project>
| 
| When using import like in
| 
| <project>
|   <target name="setUp">
|     <property name="prop" value="in importing"/>
|   </target>
| 
|   <import file="nested.xml" as="nested"/>
| </project>
| 
| Running the target nested.echo will emit:
| 
| setUp:
| 
| nested.echo:
|      [echo] prop has the value in importing
| 
| When using include like in
| 
| <project>
|   <target name="setUp">
|     <property name="prop" value="in importing"/>
|   </target>
| 
|   <include file="nested.xml" as="nested"/>
| </project>
| 
| Running the target nested.echo will emit:
| 
| nested.setUp:
| 
| nested.echo:
|      [echo] prop has the value in nested
| 
| and there won't be any target named "echo" on the including build
| file.
`----

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


Mime
View raw message