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.

rmic.html 14 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353
  1. <!--
  2. Licensed to the Apache Software Foundation (ASF) under one or more
  3. contributor license agreements. See the NOTICE file distributed with
  4. this work for additional information regarding copyright ownership.
  5. The ASF licenses this file to You under the Apache License, Version 2.0
  6. (the "License"); you may not use this file except in compliance with
  7. the License. You may obtain a copy of the License at
  8. http://www.apache.org/licenses/LICENSE-2.0
  9. Unless required by applicable law or agreed to in writing, software
  10. distributed under the License is distributed on an "AS IS" BASIS,
  11. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. See the License for the specific language governing permissions and
  13. limitations under the License.
  14. -->
  15. <html>
  16. <head>
  17. <meta http-equiv="Content-Language" content="en-us">
  18. <link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
  19. <title>Rmic Task</title>
  20. </head>
  21. <body>
  22. <h2><a name="rmic">Rmic</a></h2>
  23. <h3>Description</h3>
  24. <p>Runs the rmic compiler for a certain class.</p>
  25. <p>Rmic can be run on a single class (as specified with the classname
  26. attribute) or a number of classes at once (all classes below base that
  27. are neither _Stub nor _Skel classes). If you want to rmic a single
  28. class and this class is a class nested into another class, you have to
  29. specify the classname in the form <code>Outer$$Inner</code> instead of
  30. <code>Outer.Inner</code>.</p>
  31. <p>It is possible to refine the set of files that are being rmiced. This can be
  32. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  33. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  34. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  35. the files you want to have excluded. This is also done with patterns. And
  36. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  37. want to use default exclusions or not. See the section on <a
  38. href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
  39. inclusion/exclusion of files works, and how to write patterns.</p>
  40. <p>This task forms an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and
  41. supports most attributes of <code>&lt;fileset&gt;</code>
  42. (<code>dir</code> becomes <code>base</code>) as well as the nested
  43. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  44. <code>&lt;patternset&gt;</code> elements.</p>
  45. <p>It is possible to use different compilers. This can be selected
  46. with the &quot;build.rmic&quot; property, the <code>compiler</code>
  47. attribute. or a nested element.
  48. <a name="compilervalues">Here are the choices</a>:</p>
  49. <ul>
  50. <li>default -the default compiler (kaffe or sun) for the platform.
  51. <li>sun (the standard compiler of the JDK)</li>
  52. <li>kaffe (the standard compiler of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
  53. <li>weblogic</li>
  54. <li>forking - the sun compiler forked into a separate process (since Ant 1.7)</li>
  55. <li>xnew - the sun compiler forked into a separate process,
  56. with the -Xnew option (since Ant 1.7).
  57. This is the most reliable way to use -Xnew</li>
  58. <li> "" (empty string). This has the same behaviour as not setting the compiler attribute.
  59. First the value of <tt>build.rmic</tt> is used if defined, and if not, the default
  60. for the platform is chosen. If build.rmic is set to this, you get the default.
  61. </ul>
  62. <p>The <a href="http://dione.zcu.cz/~toman40/miniRMI/">miniRMI</a>
  63. project contains a compiler implementation for this task as well,
  64. please consult miniRMI's documentation to learn how to use it.</p>
  65. <h3>Parameters</h3>
  66. <table border="1" cellpadding="2" cellspacing="0">
  67. <tr>
  68. <td valign="top"><b>Attribute</b></td>
  69. <td valign="top"><b>Description</b></td>
  70. <td align="center" valign="top"><b>Required</b></td>
  71. </tr>
  72. <tr>
  73. <td valign="top">base</td>
  74. <td valign="top">the location to store the compiled files.
  75. Also serves as the parent directory for any non-Fileset includes, etc.
  76. (This functionality has remained unchanged.)</td>
  77. <td valign="top" align="center" rowspan="2"><a href="#footnote-1">*1</a></td>
  78. </tr>
  79. <tr>
  80. <td valign="top">destdir</td>
  81. <td valign="top">the location to store the compiled files.</td>
  82. </tr>
  83. <tr>
  84. <td valign="top">classname</td>
  85. <td valign="top">the class for which to run <code>rmic</code>.</td>
  86. <td valign="top" align="center">No</td>
  87. </tr>
  88. <tr>
  89. <td valign="top">filtering</td>
  90. <td valign="top">indicates whether token filtering should take place</td>
  91. <td valign="top" align="center">No</td>
  92. </tr>
  93. <tr>
  94. <td valign="top">sourcebase</td>
  95. <td valign="top">Pass the &quot;-keepgenerated&quot; flag to rmic and
  96. move the generated source file to the given sourcebase directory.</td>
  97. <td align="center" valign="top">No</td>
  98. </tr>
  99. <tr>
  100. <td valign="top">stubversion</td>
  101. <td valign="top">Specify the JDK version for the generated stub code.
  102. Specify &quot;1.1&quot; to pass the &quot;-v1.1&quot; option to rmic,
  103. "1.2" for -v12, compat for -vcompat. <br>
  104. Since Ant1.7, if you do not specify a version, and do not ask
  105. for iiop or idl files, "compat" is selected.
  106. </td>
  107. <td align="center" valign="top">No, default="compat"</td>
  108. </tr>
  109. <tr>
  110. <td valign="top">classpath</td>
  111. <td valign="top">The classpath to use during compilation</td>
  112. <td align="center" valign="top">No</td>
  113. </tr>
  114. <tr>
  115. <td valign="top">classpathref</td>
  116. <td valign="top">The classpath to use during compilation, given as <a
  117. href="../using.html#references">reference</a> to a PATH defined elsewhere</td>
  118. <td align="center" valign="top">No</td>
  119. </tr>
  120. <tr>
  121. <td valign="top">includes</td>
  122. <td valign="top">comma- or space-separated list of patterns of files that must be
  123. included. All files are included when omitted.</td>
  124. <td valign="top" align="center">No</td>
  125. </tr>
  126. <tr>
  127. <td valign="top">includesfile</td>
  128. <td valign="top">the name of a file. Each line of this file is
  129. taken to be an include pattern</td>
  130. <td valign="top" align="center">No</td>
  131. </tr>
  132. <tr>
  133. <td valign="top">excludes</td>
  134. <td valign="top">comma- or space-separated list of patterns of files that must be
  135. excluded. No files (except default excludes) are excluded when omitted.</td>
  136. <td valign="top" align="center">No</td>
  137. </tr>
  138. <tr>
  139. <td valign="top">excludesfile</td>
  140. <td valign="top">the name of a file. Each line of this file is
  141. taken to be an exclude pattern</td>
  142. <td valign="top" align="center">No</td>
  143. </tr>
  144. <tr>
  145. <td valign="top">defaultexcludes</td>
  146. <td valign="top">indicates whether default excludes should be used or not
  147. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  148. <td valign="top" align="center">No</td>
  149. </tr>
  150. <tr>
  151. <td valign="top">verify</td>
  152. <td valign="top">check that classes implement Remote before handing them
  153. to rmic (default is false)</td>
  154. <td align="center" valign="top">No</td>
  155. </tr>
  156. <tr>
  157. <td valign="top">iiop</td>
  158. <td valign="top">indicates that portable (RMI/IIOP) stubs should be generated</td>
  159. <td align="center" valign="top">No</td>
  160. </tr>
  161. <tr>
  162. <td valign="top">iiopopts</td>
  163. <td valign="top">additional arguments for IIOP class generation</td>
  164. <td align="center" valign="top">No</td>
  165. </tr>
  166. <tr>
  167. <td valign="top">idl</td>
  168. <td valign="top">indicates that IDL output files should be generated</td>
  169. <td align="center" valign="top">No</td>
  170. </tr>
  171. <tr>
  172. <td valign="top">idlopts</td>
  173. <td valign="top">additional arguments for IDL file generation</td>
  174. <td align="center" valign="top">No</td>
  175. </tr>
  176. <tr>
  177. <td valign="top">debug</td>
  178. <td valign="top">generate debug info (passes -g to rmic). Defaults to false.</td>
  179. <td align="center" valign="top">No</td>
  180. </tr>
  181. <tr>
  182. <td valign="top">includeAntRuntime</td>
  183. <td valign="top">whether to include the Ant run-time libraries;
  184. defaults to <code>yes</code>.</td>
  185. <td align="center" valign="top">No</td>
  186. </tr>
  187. <tr>
  188. <td valign="top">includeJavaRuntime</td>
  189. <td valign="top">whether to include the default run-time
  190. libraries from the executing VM; defaults to <code>no</code>.</td>
  191. <td align="center" valign="top">No</td>
  192. </tr>
  193. <tr>
  194. <td valign="top">extdirs</td>
  195. <td valign="top">location of installed extensions.</td>
  196. <td align="center" valign="top">No</td>
  197. </tr>
  198. <tr>
  199. <td valign="top">compiler</td>
  200. <td valign="top">The compiler implementation to use.
  201. If this attribute is not set, the value of the
  202. <code>build.rmic</code> property, if set, will be used.
  203. Otherwise, the default compiler for the current VM will be used.
  204. (See the above <a href="#compilervalues">list</a> of valid
  205. compilers.)</td>
  206. <td align="center" valign="top">No</td>
  207. </tr>
  208. <tr>
  209. <td valign="top">executable</td>
  210. <td valign="top">Complete path to the <code>rmic</code>
  211. executable to use in case of the <code>forking</code>
  212. or <code>xnew</code> compiler.
  213. Defaults to the rmic compiler of the Java version that is currently
  214. running Ant.<br/>
  215. <em>Since Ant 1.8.0</em>.</td>
  216. <td align="center" valign="top">No</td>
  217. </tr>
  218. <tr>
  219. <td valign="top">listfiles</td>
  220. <td valign="top">Indicates whether the source files to be compiled will
  221. be listed; defaults to <code>no</code>.<br/>
  222. <em>Since Ant 1.8.0</em>.</td>
  223. <td align="center" valign="top">No</td>
  224. </tr>
  225. </table>
  226. <p><a name="footnote-1">*1</a>:
  227. <ul>
  228. <li>Maintaining compatibility, <code>base</code>, when specified by
  229. itself, serves as both the parent directory for any source files
  230. AND the output directory.</li>
  231. <li><code>destdir</code> can be used to specify the output
  232. directory, allowing for <code>base</code> to be used as the parent
  233. directory for any source files.</li>
  234. <li>At least one of either <code>base</code> or <code>destdir</code>
  235. must be specified and exist, or a runtime error will
  236. occur.</li>
  237. </ul>
  238. </p>
  239. <h3>Parameters specified as nested elements</h3>
  240. <h4>classpath and extdirs</h4>
  241. <p><code>Rmic</code>'s <i>classpath</i> and <i>extdirs</i> attributes are <a
  242. href="../using.html#path">PATH like structure</a> and can also be set via a nested
  243. <i>classpath</i> and <i>extdirs</i> elements.</p>
  244. <h4>compilerarg</h4>
  245. <p>You can specify additional command line arguments for the compiler
  246. with nested <code>&lt;compilerarg&gt;</code> elements. These elements
  247. are specified like <a href="../using.html#arg">Command-line
  248. Arguments</a> but have an additional attribute that can be used to
  249. enable arguments only if a given compiler implementation will be
  250. used.</p>
  251. <table border="1" cellpadding="2" cellspacing="0">
  252. <tr>
  253. <td width="12%" valign="top"><b>Attribute</b></td>
  254. <td width="78%" valign="top"><b>Description</b></td>
  255. <td width="10%" valign="top"><b>Required</b></td>
  256. </tr>
  257. <tr>
  258. <td valign="top">value</td>
  259. <td align="center" rowspan="4">See
  260. <a href="../using.html#arg">Command-line Arguments</a>.</td>
  261. <td align="center" rowspan="4">Exactly one of these.</td>
  262. </tr>
  263. <tr>
  264. <td valign="top">line</td>
  265. </tr>
  266. <tr>
  267. <td valign="top">file</td>
  268. </tr>
  269. <tr>
  270. <td valign="top">path</td>
  271. </tr>
  272. <tr>
  273. <td valign="top">prefix</td>
  274. <td align="center" rowspan="2">See
  275. <a href="../using.html#arg">Command-line Arguments</a>.
  276. <em>Since Ant 1.8.</em></td>
  277. <td valign="top" align="center">No</td>
  278. </tr>
  279. <tr>
  280. <td valign="top">suffix</td>
  281. <td valign="top" align="center">No</td>
  282. </tr>
  283. <tr>
  284. <td valign="top">compiler</td>
  285. <td>Only pass the specified argument if the chosen
  286. compiler implementation matches the value of this attribute.
  287. Legal values are the
  288. same as those in the above <a href="#compilervalues">list</a> of valid
  289. compilers.)</td>
  290. <td align="center">No</td>
  291. </tr>
  292. </table>
  293. <h4>compilerclasspath <em>since Ant 1.8.0</em></h4>
  294. <p>A <a href="../using.html#path">PATH like structure</a> holding the
  295. classpath to use when loading the compiler implementation if a
  296. custom class has been specified. Doesn't have any effect when
  297. using one of the built-in compilers.</p>
  298. <h4>Any nested element of a type that implements RmicAdapter
  299. <em>since Ant 1.8.0</em></h4>
  300. <p>If a defined type implements the <code>RmicAdapter</code>
  301. interface a nested element of that type can be used as an
  302. alternative to the <code>compiler</code> attribute.</p>
  303. <h3>Examples</h3>
  304. <pre> &lt;rmic classname=&quot;com.xyz.FooBar&quot; base=&quot;${build}/classes&quot;/&gt;</pre>
  305. <p>runs the rmic compiler for the class <code>com.xyz.FooBar</code>. The
  306. compiled files will be stored in the directory <code>${build}/classes</code>.</p>
  307. <pre> &lt;rmic base=&quot;${build}/classes&quot; includes=&quot;**/Remote*.class&quot;/&gt;</pre>
  308. <p>runs the rmic compiler for all classes with <code>.class</code>
  309. files below <code>${build}/classes</code> whose classname starts with
  310. <i>Remote</i>. The compiled files will be stored in the directory
  311. <code>${build}/classes</code>.</p>
  312. <p>If you want to use a custom
  313. RmicAdapter <code>org.example.MyAdapter</code> you can either
  314. use the compiler attribute:</p>
  315. <pre>
  316. &lt;rmic classname=&quot;com.xyz.FooBar&quot;
  317. base=&quot;${build}/classes&quot;
  318. compiler="org.example.MyAdapter"/&gt;
  319. </pre>
  320. <p>or a define a type and nest this into the task like in:</p>
  321. <pre>
  322. &lt;componentdef classname="org.example.MyAdapter"
  323. name="myadapter"/&gt;
  324. &lt;rmic classname=&quot;com.xyz.FooBar&quot;
  325. base=&quot;${build}/classes&quot;&gt;
  326. &lt;myadapter/&gt;
  327. &lt;/rmic&gt;
  328. </pre>
  329. <p>in which case your compiler adapter can support attributes and
  330. nested elements of its own.</p>
  331. </body>
  332. </html>