Browse Source

Make inheritall attribute available to <antcall> as well.

git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@269367 13f79535-47bb-0310-9956-ffa450edef68
master
Stefan Bodewig 24 years ago
parent
commit
d471a816cb
2 changed files with 28 additions and 0 deletions
  1. +17
    -0
      docs/manual/CoreTasks/antcall.html
  2. +11
    -0
      src/main/org/apache/tools/ant/taskdefs/CallTarget.java

+ 17
- 0
docs/manual/CoreTasks/antcall.html View File

@@ -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
&quot;user&quot; 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>
@@ -23,6 +33,13 @@ properties (param's in this context)</p>
<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>
<h4>param</h4>


+ 11
- 0
src/main/org/apache/tools/ant/taskdefs/CallTarget.java View File

@@ -83,6 +83,16 @@ public class CallTarget extends Task {
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");
@@ -106,6 +116,7 @@ public class CallTarget extends Task {
callee.setDir(project.getBaseDir());
callee.setAntfile(project.getProperty("ant.file"));
callee.setTarget(subTarget);
callee.setInheritAll(inheritAll);
callee.execute();
}



Loading…
Cancel
Save