You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ant.apache.org by bo...@apache.org on 2001/07/20 12:07:35 UTC
cvs commit: jakarta-ant/src/main/org/apache/tools/ant/taskdefs CallTarget.java
bodewig 01/07/20 03:07:35
Modified: docs/manual/CoreTasks antcall.html
src/main/org/apache/tools/ant/taskdefs CallTarget.java
Log:
Make inheritall attribute available to <antcall> as well.
Revision Changes Path
1.3 +17 -0 jakarta-ant/docs/manual/CoreTasks/antcall.html
Index: antcall.html
===================================================================
RCS file: /home/cvs/jakarta-ant/docs/manual/CoreTasks/antcall.html,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- antcall.html 2001/02/13 12:31:50 1.2
+++ antcall.html 2001/07/20 10:07:35 1.3
@@ -11,6 +11,16 @@
<h3>Description</h3>
<p>Call another target within the same build-file optionally specifying some
properties (param's in this context)</p>
+<p>By default, all of the properties of the current project will be
+available in the new project. Alternatively, you can
+set the <i>inheritAll</i> attribute to <code>false</code> and only
+"user" properties (i.e., those passed on the command-line)
+will be passed to the new project. In either case, the set of
+properties passed to the new project will override the properties that
+are set in the new project (See also the <a href="property.html">property task</a>).</p>
+<p>You can also set properties in the new project from the old project by
+using nested param tags. These properties are always passed regardless of the
+setting of <i>inheritAll</i>. This allows you to parameterize your subprojects.</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
@@ -22,6 +32,13 @@
<td valign="top">target</td>
<td valign="top">The target to execute.</td>
<td valign="top" align="center">Yes</td>
+ </tr>
+ <tr>
+ <td valign="top">inheritAll</td>
+ <td valign="top">If <code>true</code>, pass all properties to the new Ant
+ project. Defaults to <code>true</code>.
+ </td>
+ <td align="center" valign="top">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
1.8 +11 -0 jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java
Index: CallTarget.java
===================================================================
RCS file: /home/cvs/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/CallTarget.java,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- CallTarget.java 2001/05/23 16:57:32 1.7
+++ CallTarget.java 2001/07/20 10:07:35 1.8
@@ -83,7 +83,17 @@
private Ant callee;
private String subTarget;
private boolean initialized = false;
+ private boolean inheritAll = true;
+ /**
+ * If true, inherit all properties from parent Project
+ * If false, inherit only userProperties and those defined
+ * inside the antcall call itself
+ **/
+ public void setInheritAll(boolean inherit) {
+ inheritAll = inherit;
+ } //-- setInheritAll
+
public void init() {
callee = (Ant) project.createTask("ant");
callee.setOwningTarget(target);
@@ -106,6 +116,7 @@
callee.setDir(project.getBaseDir());
callee.setAntfile(project.getProperty("ant.file"));
callee.setTarget(subTarget);
+ callee.setInheritAll(inheritAll);
callee.execute();
}
Re: cvs commit:
jakarta-ant/src/main/org/apache/tools/ant/taskdefs CallTarget.java
Posted by Jon Stevens <jo...@latchkey.com>.
on 7/20/01 3:07 AM, "bodewig@apache.org" <bo...@apache.org> wrote:
> +<p>By default, all of the properties of the current project will be
> +available in the new project. Alternatively, you can
> +set the <i>inheritAll</i> attribute to <code>false</code> and only
> +"user" properties (i.e., those passed on the command-line)
> +will be passed to the new project. In either case, the set of
> +properties passed to the new project will override the properties that
> +are set in the new project (See also the <a href="property.html">property
> task</a>).</p>
> +<p>You can also set properties in the new project from the old project by
> +using nested param tags. These properties are always passed regardless of the
> +setting of <i>inheritAll</i>. This allows you to parameterize your
> subprojects.</p>
Thank you!
I just got bit by this "lacking" feature in <ant> and ended up having to use
the <exec> task to call ant again. Unfortunately, using the <exec> task in
this fashion doesn't seem to work on Winblows, but does work on *nix.
I look forward to the next release.
-jon