You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

antcall.html 5.3 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>AntCall Task</title>
  5. </head>
  6. <body>
  7. <h2><a name="antcall">AntCall</a></h2>
  8. <h3>Description</h3>
  9. <p>Call another target within the same build-file optionally
  10. specifying some properties (param's in this context). <strong>This
  11. task must no be used outside of a <code>target</code>.</strong></p>
  12. <p>By default, all of the properties of the current project will be
  13. available in the new project. Alternatively, you can
  14. set the <i>inheritAll</i> attribute to <code>false</code> and only
  15. &quot;user&quot; properties (i.e., those passed on the command-line)
  16. will be passed to the new project. In either case, the set of
  17. properties passed to the new project will override the properties that
  18. are set in the new project (See also the <a href="property.html">property task</a>).</p>
  19. <p>You can also set properties in the new project from the old project
  20. by using nested param tags. These properties are always passed
  21. regardless of the setting of <i>inheritAll</i>. This allows you to
  22. parameterize your subprojects. Properties defined on the command line
  23. can not be overridden by nested &lt;param&gt; elements.</p>
  24. <p>Nested <a href="#reference"><i>&lt;reference&gt;</i></a> elements can
  25. be used to copy references from the calling project to the new
  26. project, optionally under a different id. References taken from
  27. nested elements will override existing references in the new
  28. project.</p>
  29. <p>
  30. When a target is invoked by antcall, all of its dependent targets will
  31. also be called within the context of any new parameters. For example. if
  32. the target &quot;doSomethingElse&quot; depended on the target &quot;init&quot;, then the
  33. <i>antcall</i> of &quot;doSomethingElse&quot; will call &quot;init&quot; during the call.
  34. Of course, any properties defined in the antcall task or inherited from the calling target
  35. will be fixed and not overridable in the init task -or indeed in the &quot;doSomethingElse&quot; task.
  36. </p>
  37. <p>If the build file changes after you've started the build, the
  38. behavior of this task is undefined.</p>
  39. <h3>Parameters</h3>
  40. <table border="1" cellpadding="2" cellspacing="0">
  41. <tr>
  42. <td valign="top"><b>Attribute</b></td>
  43. <td valign="top"><b>Description</b></td>
  44. <td align="center" valign="top"><b>Required</b></td>
  45. </tr>
  46. <tr>
  47. <td valign="top">target</td>
  48. <td valign="top">The target to execute.</td>
  49. <td valign="top" align="center">Yes</td>
  50. </tr>
  51. <tr>
  52. <td valign="top">inheritAll</td>
  53. <td valign="top">If <code>true</code>, pass all properties to the new Ant
  54. project. Defaults to <code>true</code>.
  55. </td>
  56. <td align="center" valign="top">No</td>
  57. </tr>
  58. <tr>
  59. <td valign="top">inheritRefs</td>
  60. <td valign="top">If <code>true</code>, pass all references to the
  61. new Ant project. Defaults to <code>false</code>.</td>
  62. <td align="center" valign="top">No</td>
  63. </tr>
  64. </table>
  65. <h3>Note on <code>inheritRefs</code></h3>
  66. <p><code>&lt;antcall&gt;</code> will not override existing references,
  67. even if you set <code>inheritRefs</code> to true. As the called build
  68. files is the same build file as the calling one, this means it will
  69. not override any reference set via an <code>id</code> attribute at
  70. all. The only references that can be inherited by the child project
  71. are those defined by nested <code>&lt;reference&gt;</code> elements or
  72. references defined by tasks directly (not using the <code>id</code>
  73. attribute).</p>
  74. <h3>Parameters specified as nested elements</h3>
  75. <h4>param</h4>
  76. <p>Specifies the properties to set before running the specified target. See <a
  77. href="property.html">property</a> for usage guidelines.</p>
  78. <h4><a name="reference">reference</a></h4>
  79. <p>Used to chose references that shall be copied into the new project,
  80. optionally changing their id.</p>
  81. <table border="1" cellpadding="2" cellspacing="0">
  82. <tr>
  83. <td valign="top"><b>Attribute</b></td>
  84. <td valign="top"><b>Description</b></td>
  85. <td align="center" valign="top"><b>Required</b></td>
  86. </tr>
  87. <tr>
  88. <td valign="top">refid</td>
  89. <td valign="top">The id of the reference in the calling project.</td>
  90. <td valign="top" align="center">Yes</td>
  91. </tr>
  92. <tr>
  93. <td valign="top">torefid</td>
  94. <td valign="top">The id of the reference in the new project.</td>
  95. <td valign="top" align="center">No, defaults to the value of refid.</td>
  96. </tr>
  97. </table>
  98. <h4>propertyset</h4>
  99. <p>You can specify a set of properties to be copied into the new
  100. project with <a
  101. href="../CoreTypes/propertyset.html">propertyset</a>s.</p>
  102. <p><em>since Ant 1.6</em>.</p>
  103. <h3>Examples</h3>
  104. <pre>
  105. &lt;target name=&quot;default&quot;&gt;
  106. &lt;antcall target=&quot;doSomethingElse&quot;&gt;
  107. &lt;param name=&quot;param1&quot; value=&quot;value&quot;/&gt;
  108. &lt;/antcall&gt;
  109. &lt;/target&gt;
  110. &lt;target name=&quot;doSomethingElse&quot;&gt;
  111. &lt;echo message=&quot;param1=${param1}&quot;/&gt;
  112. &lt;/target&gt;
  113. </pre>
  114. <p>Will run the target 'doSomethingElse' and echo 'param1=value'.</p>
  115. <pre>
  116. &lt;antcall ... &gt;
  117. &lt;reference refid=&quot;path1&quot; torefid=&quot;path2&quot;/&gt;
  118. &lt;/antcall&gt;
  119. </pre>
  120. <p>will copy the parent's definition of <code>path1</code> into the
  121. new project using the id <code>path2</code>.</p>
  122. <hr><p align="center">Copyright &copy; 2000-2003 Apache Software Foundation. All rights
  123. Reserved.</p>
  124. </body>
  125. </html>