2006-09-11 04:19:00 +00:00
|
|
|
<!--
|
|
|
|
Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
contributor license agreements. See the NOTICE file distributed with
|
|
|
|
this work for additional information regarding copyright ownership.
|
|
|
|
The ASF licenses this file to You under the Apache License, Version 2.0
|
|
|
|
(the "License"); you may not use this file except in compliance with
|
|
|
|
the License. You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
-->
|
2000-09-20 15:53:31 +00:00
|
|
|
<html>
|
2018-01-22 23:52:21 +01:00
|
|
|
<head>
|
|
|
|
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
|
|
|
<title>Native2Ascii Task</title>
|
|
|
|
</head>
|
2000-10-25 13:02:56 +00:00
|
|
|
<body>
|
|
|
|
<h2>Native2Ascii</h2>
|
2002-06-22 23:38:38 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<h3>Description</h3>
|
|
|
|
|
|
|
|
<p>Converts files from native encodings to ASCII with escaped Unicode. A common usage is to
|
|
|
|
convert source files maintained in a native operating system encoding, to ASCII prior to
|
|
|
|
compilation.</p>
|
|
|
|
|
|
|
|
<p>Files in the directory <var>src</var> are converted from a native encoding to ASCII. By
|
|
|
|
default, all files in the directory are converted. However, conversion may be limited to
|
|
|
|
selected files using <var>includes</var> and <var>excludes</var> attributes. For more
|
|
|
|
information on file matching patterns, see the section
|
|
|
|
on <a href="../dirtasks.html#directorybasedtasks">directory based tasks</a>. If
|
|
|
|
no <var>encoding</var> is specified, the default encoding for the JVM is used.
|
|
|
|
If <var>ext</var> is specified, then output files are renamed to use it as a new extension.
|
|
|
|
More sophisticated file name translations can be achieved using a
|
|
|
|
nested <code><mapper></code> element. By default
|
|
|
|
an <a href="../Types/mapper.html#identity-mapper">identity mapper</a> will be used.
|
|
|
|
If <var>dest</var> and <var>src</var> point to the same directory, the <var>ext</var>
|
|
|
|
attribute or a nested <code><mapper></code> is required.</p>
|
|
|
|
|
|
|
|
<p>This task forms an implicit <a href="../Types/fileset.html">FileSet</a>, and supports most
|
|
|
|
attributes of <code><fileset></code> (<var>dir</var> becomes <var>src</var>) as well as
|
2000-10-25 13:02:56 +00:00
|
|
|
nested <code><include></code>, <code><exclude></code>,
|
2018-02-28 07:58:59 +01:00
|
|
|
and <code><patternset></code> elements.</p>
|
|
|
|
|
|
|
|
<p id="implementationvalues">It is possible to use different converters. This can be selected
|
|
|
|
with the <var>implementation</var> attribute or a nested element. Here are the choices of the
|
|
|
|
attribute:</p>
|
2005-02-02 13:46:08 +00:00
|
|
|
<ul>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>default</q>—the default converter for the platform: kaffe when run on Kaffe,
|
|
|
|
builtin otherwise.</li>
|
2018-03-10 20:17:33 +01:00
|
|
|
<li><q>sun</q>—used to be the standard converter of the JDK 8 or earlier</li>
|
2018-02-28 07:58:59 +01:00
|
|
|
<li><q>kaffe</q>—the standard converter of <a href="http://www.kaffe.org"
|
|
|
|
target="_top">Kaffe</a></li>
|
|
|
|
<li><q>builtin</q>—Ant's internal implementation. <em>Since Ant 1.9.8</em></li>
|
2005-02-02 13:46:08 +00:00
|
|
|
</ul>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2000-10-25 13:02:56 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>reverse</td>
|
2018-03-10 20:17:33 +01:00
|
|
|
<td>Reverse the sense of the conversion, i.e. convert from ASCII to native<br/><strong>Only
|
2018-02-28 07:58:59 +01:00
|
|
|
supported by the <q>sun</q> and <q>builtin</q> converters</strong></td>
|
|
|
|
<td>No</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>encoding</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>The native encoding the files are in</td>
|
|
|
|
<td>No; defaults to default JVM character encoding</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>src</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>The directory to find files in; default is <var>basedir</var></td>
|
|
|
|
<td>No</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>dest</td>
|
|
|
|
<td>The directory to output file to</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Yes</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>ext</td>
|
|
|
|
<td>File extension to use in renaming output files</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>No</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>includes</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Comma- or space-separated list of patterns of files that must be included.</td>
|
|
|
|
<td>No; defaults to all (<q>**</q>)</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>includesfile</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Name of a file. Each line of this file is taken to be an include pattern</td>
|
|
|
|
<td>No</td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>excludes</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Comma- or space-separated list of patterns of files that must be excluded.</td>
|
|
|
|
<td>No; defaults to default excludes or none if <var>defaultexcludes</var> is <q>no</q></td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>excludesfile</td>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>Name of a file. Each line of this file is taken to be an exclude pattern</td>
|
|
|
|
<td>No</td>
|
|
|
|
</tr>
|
|
|
|
<tr>
|
|
|
|
<td>defaultexcludes</td>
|
|
|
|
<td>Indicates whether default excludes should be used or not (<q>yes|no</q>).</td>
|
|
|
|
<td>No; defaults to <q>yes</q></td>
|
2000-10-25 13:02:56 +00:00
|
|
|
</tr>
|
2005-02-02 13:46:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>implementation</td>
|
|
|
|
<td>The converter implementation to use. (See the
|
|
|
|
above <a href="#implementationvalues">list</a> of valid converters.)</td>
|
|
|
|
<td>No; defaults to default converter for the current JVM</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
2000-10-25 13:02:56 +00:00
|
|
|
</table>
|
2002-06-22 23:38:38 +00:00
|
|
|
|
2005-02-02 13:46:08 +00:00
|
|
|
<h3>Parameters specified as nested elements</h3>
|
|
|
|
|
|
|
|
<h4>arg</h4>
|
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>You can specify additional command line arguments for the converter with
|
|
|
|
nested <code><arg></code> elements. These elements are specified
|
|
|
|
like <a href="../using.html#arg">Command-line Arguments</a> but have an additional attribute that
|
|
|
|
can be used to enable arguments only if a given converter implementation will be used.</p>
|
2005-02-02 13:46:08 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<table class="attr">
|
2005-02-02 13:46:08 +00:00
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<th>Attribute</th>
|
|
|
|
<th>Description</th>
|
|
|
|
<th>Required</th>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>value</td>
|
|
|
|
<td rowspan="4">See <a href="../using.html#arg">Command-line Arguments</a>.</td>
|
|
|
|
<td rowspan="4">Exactly one of these</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td class="var">line</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td class="var">file</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td class="var">path</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
<tr>
|
2018-02-28 07:58:59 +01:00
|
|
|
<td>implementation</td>
|
|
|
|
<td>Only pass the specified argument if the chosen converter implementation matches the value of
|
|
|
|
this attribute. Legal values are the same as those in the
|
|
|
|
above <a href="#implementationvalues">list</a> of valid compilers.)</td>
|
|
|
|
<td>No</td>
|
2005-02-02 13:46:08 +00:00
|
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
|
2018-03-04 15:17:41 +01:00
|
|
|
<h4>implementationclasspath</h4>
|
|
|
|
<p><em>Since Apache Ant 1.8.0</em></p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<p>A <a href="../using.html#path">path-like structure</a> holding the classpath to use when loading
|
|
|
|
the converter implementation if a custom class has been specified. Doesn't have any effect when
|
|
|
|
using one of the built-in converters.</p>
|
2009-07-21 08:52:12 +00:00
|
|
|
|
2018-03-04 15:17:41 +01:00
|
|
|
<h4>Any nested element of a type that implements Native2AsciiAdapter</h4>
|
|
|
|
<p><em>Since Ant 1.8.0</em></p>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p>If a defined type implements the <code class="code">Native2AsciiAdapter</code> interface a nested
|
|
|
|
element of that type can be used as an alternative to the <var>implementation</var> attribute.</p>
|
2009-09-04 13:02:02 +00:00
|
|
|
|
2018-02-28 07:58:59 +01:00
|
|
|
<h3>Examples</h3>
|
2000-09-20 15:53:31 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Convert all files in the directory <samp>srcdir</samp> ending in <samp>.eucjis</samp> from the
|
|
|
|
EUCJIS encoding to ASCII and rename them to end in <samp>.java</samp>.</p>
|
2018-02-28 07:58:59 +01:00
|
|
|
<pre>
|
2000-09-20 15:53:31 +00:00
|
|
|
<native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
|
2018-02-28 07:58:59 +01:00
|
|
|
includes="**/*.eucjis" ext=".java"/></pre>
|
2000-09-20 15:53:31 +00:00
|
|
|
|
2018-05-15 09:51:58 +02:00
|
|
|
<p>Convert all the files ending in <samp>.java</samp> in the directory <samp>native/japanese</samp>
|
|
|
|
to ASCII, placing the results in the directory <samp>src</samp>. The names of the files remain the
|
|
|
|
same.</p>
|
2000-09-20 15:53:31 +00:00
|
|
|
<pre>
|
2002-09-04 11:05:19 +00:00
|
|
|
<native2ascii encoding="EUCJIS" src="native/japanese" dest="src"
|
2018-02-28 07:58:59 +01:00
|
|
|
includes="**/*.java"/></pre>
|
|
|
|
|
2018-03-10 20:17:33 +01:00
|
|
|
<p>If you want to use a
|
|
|
|
custom <code class="code">Native2AsciiAdapter</code> <code>org.example.MyAdapter</code> you can
|
|
|
|
either use the implementation attribute:</p>
|
2009-09-04 13:02:02 +00:00
|
|
|
<pre>
|
|
|
|
<native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
|
2018-02-28 07:58:59 +01:00
|
|
|
includes="**/*.eucjis" ext=".java"
|
|
|
|
implementation="org.example.MyAdapter"/></pre>
|
2009-09-04 13:02:02 +00:00
|
|
|
<p>or a define a type and nest this into the task like in:</p>
|
|
|
|
<pre>
|
|
|
|
<componentdef classname="org.example.MyAdapter"
|
|
|
|
name="myadapter"/>
|
|
|
|
<native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
|
2018-02-28 07:58:59 +01:00
|
|
|
includes="**/*.eucjis" ext=".java">
|
|
|
|
<myadapter/>
|
|
|
|
</native2ascii></pre>
|
2018-03-10 20:17:33 +01:00
|
|
|
<p>in which case your <code>native2ascii</code> adapter can support attributes and nested elements
|
|
|
|
of its own.</p>
|
2006-09-11 04:33:25 +00:00
|
|
|
|
2018-01-22 23:52:21 +01:00
|
|
|
</body>
|
2000-10-25 13:02:56 +00:00
|
|
|
</html>
|