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 |
|
---|
9 | http://www.apache.org/licenses/LICENSE-2.0
|
---|
10 |
|
---|
11 | Unless required by applicable law or agreed to in writing, software
|
---|
12 | distributed under the License is distributed on an "AS IS" BASIS,
|
---|
13 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
---|
14 | See the License for the specific language governing permissions and
|
---|
15 | limitations under the License.
|
---|
16 | -->
|
---|
17 | <html>
|
---|
18 | <head><link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
|
---|
19 | <title>Native2Ascii Task</title></head>
|
---|
20 | <body>
|
---|
21 | <h2>Native2Ascii</h2>
|
---|
22 |
|
---|
23 | <h3>Description:</h3>
|
---|
24 |
|
---|
25 | <p>
|
---|
26 | Converts files from native encodings to ASCII with escaped Unicode.
|
---|
27 | A common usage is to convert source files maintained in a native
|
---|
28 | operating system encoding, to ASCII prior to compilation.
|
---|
29 | </p>
|
---|
30 |
|
---|
31 | <p>
|
---|
32 | Files in the directory <em>src</em>
|
---|
33 | are converted from a native encoding to ASCII.
|
---|
34 | By default, all files in the directory are converted.
|
---|
35 | However, conversion may be limited to selected files using
|
---|
36 | <em>includes</em> and <em>excludes</em> attributes.
|
---|
37 | For more information on file matching patterns,
|
---|
38 | see the section on
|
---|
39 | <a href="../dirtasks.html#directorybasedtasks">directory based tasks</a>.
|
---|
40 | If no <em>encoding</em> is specified,
|
---|
41 | the default encoding for the JVM is used.
|
---|
42 | If <em>ext</em> is specified, then output files are renamed
|
---|
43 | to use it as a new extension.
|
---|
44 | More sophisticated file name translations can be achieved using a nested
|
---|
45 | <em><code><mapper></code></em> element. By default an
|
---|
46 | <a href="../CoreTypes/mapper.html#identity-mapper">identity mapper</a> will be used.
|
---|
47 | If <em>dest</em> and <em>src</em> point to the same directory,
|
---|
48 | the <em>ext</em> attribute or a nested <em><code><mapper></code></em>
|
---|
49 | is required.
|
---|
50 | </p>
|
---|
51 |
|
---|
52 | <p>
|
---|
53 | This task forms an implicit <a href="../CoreTypes/fileset.html">File Set</a>,
|
---|
54 | and supports all attributes of <code><fileset></code>
|
---|
55 | (<code>dir</code> becomes <code>src</code>) as well as
|
---|
56 | nested <code><include></code>, <code><exclude></code>,
|
---|
57 | and <code><patternset></code> elements.
|
---|
58 | </p>
|
---|
59 |
|
---|
60 | <p>It is possible to use different converters. This can be selected
|
---|
61 | with the <code>implementation</code> attribute.
|
---|
62 | <a name="implementationvalues">Here are the choices</a>:</p>
|
---|
63 | <ul>
|
---|
64 | <li>default - the default converter (kaffe or sun) for the platform.</li>
|
---|
65 | <li>sun (the standard converter of the JDK)</li>
|
---|
66 | <li>kaffe (the standard converter of <a href="http://www.kaffe.org" target="_top">Kaffe</a>)</li>
|
---|
67 | </ul>
|
---|
68 |
|
---|
69 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
70 | <tr>
|
---|
71 | <td><b>Attribute</b></td>
|
---|
72 | <td><b>Description</b></td>
|
---|
73 | <td><b>Required</b></td>
|
---|
74 | </tr>
|
---|
75 | <tr>
|
---|
76 | <td>reverse</td>
|
---|
77 | <td>Reverse the sense of the conversion,
|
---|
78 | i.e. convert from ASCII to native <b>only supported by the
|
---|
79 | sun converter</b></td>
|
---|
80 | <td align="center">No</td>
|
---|
81 | </tr>
|
---|
82 | <tr>
|
---|
83 | <td>encoding</td>
|
---|
84 | <td>The native encoding the files are in
|
---|
85 | (default is the default encoding for the JVM)</td>
|
---|
86 | <td align="center">No</td>
|
---|
87 | </tr>
|
---|
88 | <tr>
|
---|
89 | <td>src</td>
|
---|
90 | <td>The directory to find files in (default is <em>basedir</em>)</td>
|
---|
91 | <td align="center">No</td>
|
---|
92 | </tr>
|
---|
93 | <tr>
|
---|
94 | <td>dest</td>
|
---|
95 | <td>The directory to output file to</td>
|
---|
96 | <td align="center">Yes</td>
|
---|
97 | </tr>
|
---|
98 | <tr>
|
---|
99 | <td>ext</td>
|
---|
100 | <td>File extension to use in renaming output files</td>
|
---|
101 | <td align="center">No</td>
|
---|
102 | </tr>
|
---|
103 | <tr>
|
---|
104 | <td>defaultexcludes</td>
|
---|
105 | <td>indicates whether default excludes should be used or not
|
---|
106 | ("yes"/"no").
|
---|
107 | Default excludes are used when omitted.
|
---|
108 | </td>
|
---|
109 | <td align="center">No</td>
|
---|
110 | </tr>
|
---|
111 | <tr>
|
---|
112 | <td>includes</td>
|
---|
113 | <td>comma- or space-separated list of patterns of files that must be
|
---|
114 | included. All files are included when omitted.</td>
|
---|
115 | <td align="center">No</td>
|
---|
116 | </tr>
|
---|
117 | <tr>
|
---|
118 | <td>includesfile</td>
|
---|
119 | <td>the name of a file. Each line of this file is
|
---|
120 | taken to be an include pattern</td>
|
---|
121 | <td align="center">No</td>
|
---|
122 | </tr>
|
---|
123 | <tr>
|
---|
124 | <td>excludes</td>
|
---|
125 | <td>comma- or space-separated list of patterns of files that must be excluded.
|
---|
126 | No files (except default excludes) are excluded when omitted.</td>
|
---|
127 | <td align="center">No</td>
|
---|
128 | </tr>
|
---|
129 | <tr>
|
---|
130 | <td>excludesfile</td>
|
---|
131 | <td>the name of a file. Each line of this file is
|
---|
132 | taken to be an exclude pattern</td>
|
---|
133 | <td align="center">No</td>
|
---|
134 | </tr>
|
---|
135 | <tr>
|
---|
136 | <td valign="top">implementation</td>
|
---|
137 | <td valign="top">The converter implementation to use.
|
---|
138 | If this attribute is not set, the default converter for the
|
---|
139 | current VM will be used. (See the above <a
|
---|
140 | href="#implementationvalues">list</a> of valid converters.)</td>
|
---|
141 | <td align="center" valign="top">No</td>
|
---|
142 | </tr>
|
---|
143 | </table>
|
---|
144 |
|
---|
145 | <h3>Parameters specified as nested elements</h3>
|
---|
146 |
|
---|
147 | <h4>arg</h4>
|
---|
148 |
|
---|
149 | <p>You can specify additional command line arguments for the converter
|
---|
150 | with nested <code><arg></code> elements. These elements are
|
---|
151 | specified like <a href="../using.html#arg">Command-line Arguments</a>
|
---|
152 | but have an additional attribute that can be used to enable arguments
|
---|
153 | only if a given converter implementation will be used.</p>
|
---|
154 |
|
---|
155 | <table border="1" cellpadding="2" cellspacing="0">
|
---|
156 | <tr>
|
---|
157 | <td width="12%" valign="top"><b>Attribute</b></td>
|
---|
158 | <td width="78%" valign="top"><b>Description</b></td>
|
---|
159 | <td width="10%" valign="top"><b>Required</b></td>
|
---|
160 | </tr>
|
---|
161 | <tr>
|
---|
162 | <td valign="top">value</td>
|
---|
163 | <td align="center" rowspan="4">See
|
---|
164 | <a href="../using.html#arg">Command-line Arguments</a>.</td>
|
---|
165 | <td align="center" rowspan="4">Exactly one of these.</td>
|
---|
166 | </tr>
|
---|
167 | <tr>
|
---|
168 | <td valign="top">line</td>
|
---|
169 | </tr>
|
---|
170 | <tr>
|
---|
171 | <td valign="top">file</td>
|
---|
172 | </tr>
|
---|
173 | <tr>
|
---|
174 | <td valign="top">path</td>
|
---|
175 | </tr>
|
---|
176 | <tr>
|
---|
177 | <td valign="top">implementation</td>
|
---|
178 | <td>Only pass the specified argument if the chosen converter
|
---|
179 | implementation matches the value of this attribute. Legal values
|
---|
180 | are the same as those in the above <a
|
---|
181 | href="#implementationvalues">list</a> of valid compilers.)</td>
|
---|
182 | <td align="center">No</td>
|
---|
183 | </tr>
|
---|
184 | </table>
|
---|
185 |
|
---|
186 | <h3>Examples</h3>
|
---|
187 |
|
---|
188 | <pre>
|
---|
189 | <native2ascii encoding="EUCJIS" src="srcdir" dest="srcdir"
|
---|
190 | includes="**/*.eucjis" ext=".java"/>
|
---|
191 | </pre>
|
---|
192 |
|
---|
193 | <p>
|
---|
194 | Converts all files in the directory <em>srcdir</em>
|
---|
195 | ending in <code>.eucjis</code> from the EUCJIS encoding to ASCII
|
---|
196 | and renames them to end in <code>.java</code>.
|
---|
197 | </p>
|
---|
198 |
|
---|
199 | <pre>
|
---|
200 | <native2ascii encoding="EUCJIS" src="native/japanese" dest="src"
|
---|
201 | includes="**/*.java"/>
|
---|
202 | </pre>
|
---|
203 |
|
---|
204 | <p>
|
---|
205 | Converts all the files ending in <code>.java</code>
|
---|
206 | in the directory <em>native/japanese</em> to ASCII,
|
---|
207 | placing the results in the directory <em>src</em>.
|
---|
208 | The names of the files remain the same.
|
---|
209 | </p>
|
---|
210 | </body>
|
---|
211 |
|
---|
212 | </html>
|
---|