forked from Uriziel47/ant
-
Notifications
You must be signed in to change notification settings - Fork 0
/
concat.html
337 lines (300 loc) · 11.7 KB
/
concat.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
<!--
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.
-->
<html>
<head>
<meta http-equiv="Content-Language" content="en-us">
<link rel="stylesheet" type="text/css" href="../stylesheets/style.css">
<title>Concat</title>
</head>
<body>
<h2><a name="Concat">Concat</a></h2>
<h3>Description</h3>
<p>
Concatenates one or more
<a href="../Types/resources.html">resource</a>s
to a single file or to the console. The destination
file will be created if it does not exist unless the resource
list is empty and ignoreempty is true.
</p>
<p><strong>Since Apache Ant 1.7.1</strong>, this task can be used as a
<a href="../Types/resources.html#collection">Resource Collection</a>
that will return exactly one
<a href="../Types/resources.html">resource</a>.
</p>
<p>
<a href="../Types/resources.html#collection">
Resource Collection</a>s are used to
select which resources are to be concatenated. There is no
singular attribute to specify a single resource to cat.
</p>
<h3>Parameters</h3>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">destfile</td>
<td valign="top">
The destination file for the concatenated stream.
If not specified the console will be used instead.
</td>
<td valign="top" align="center">
No
</td>
</tr>
<tr>
<td valign="top">append</td>
<td valign="top">
Specifies whether or not the file specified by 'destfile'
should be appended. Defaults to "no".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">force</td>
<td valign="top">
Specifies whether or not the file specified by 'destfile'
should be written to even if it is newer than all source files.
<strong>deprecated, use the overwrite attribute instead</strong>
Defaults to "yes".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">overwrite</td>
<td valign="top">
Specifies whether or not the file specified by 'destfile'
should be written to even if it is newer than all source files.
<em>since Ant 1.8.2</em>.
Defaults to "yes".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">forceReadOnly</td>
<td valign="top">Overwrite read-only destination
files. <em>since Ant 1.8.2</em></td>
<td valign="top" align="center">No; defaults to false.</td>
</tr>
<tr>
<td valign="top">encoding</td>
<td valign="top">
Specifies the encoding for the input files. Please see <a
href="http://download.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html">
http://download.oracle.com/javase/1.5.0/docs/guide/intl/encoding.doc.html</a>
for a list of possible values. Defaults to the platform's
default character encoding.
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">outputencoding</td>
<td valign="top">
The encoding to use when writing the output file
<em>since Ant 1.6</em>.
Defaults to the value of the encoding attribute
if given or the default JVM encoding otherwise.
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">fixlastline</td>
<td valign="top">
Specifies whether or not to check if
each file concatenated is terminated by
a new line. If this attribute is "yes"
a new line will be appended to the stream if
the file did not end in a new line.
<em>since Ant 1.6</em>.
Defaults to "no".
This attribute does not apply to embedded text.
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">eol</td>
<td valign="top">
Specifies what the end of line character are
for use by the fixlastline attribute.
<em>since Ant 1.6</em>
Valid values for this property are:
<ul>
<li>cr: a single CR</li>
<li>lf: a single LF</li>
<li>crlf: the pair CRLF</li>
<li>mac: a single CR</li>
<li>unix: a single LF</li>
<li>dos: the pair CRLF</li>
</ul>
The default is platform dependent.
For Unix platforms, the default is "lf".
For DOS based systems (including Windows),
the default is "crlf".
For Mac OS, the default is "cr".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">binary</td>
<td valign="top">
<em>since Ant 1.6.2</em>
If this attribute is set to true, the task concatenates the files
in a byte by byte fashion. If this attribute is false, concat will
not normally work for binary files due to character encoding
issues.
If this option is set to true, the destfile attribute must be
set, and the task cannot used nested text.
Also the attributes encoding, outputencoding, filelastline
cannot be used.
The default is "false".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">ignoreempty</td>
<td valign="top">
<em>Since Ant 1.8.0</em>
Specifies whether or not the file specified by 'destfile'
should be created if the source resource list is
empty. Defaults to "true".
</td>
<td valign="top" align="center">No</td>
</tr>
<tr>
<td valign="top">resourcename</td>
<td valign="top">
<em>Since Ant 1.8.3</em>
Specifies the name reported if this task is exposed
as a <a href="../Types/resources.html">resource</a>.
</td>
<td valign="top" align="center">No</td>
</tr>
</table>
<h3>Parameters specified as nested elements</h3>
<h4>Resource Collection</h4>
<p><em>since Ant 1.7</em>.</p>
<p>
Any of the various <a href="../Types/resources.html#collection">
Resource Collection</a> types can specify the resources to be
concatenated.
</p>
<h4>filterchain</h4>
<p><em>since Ant 1.6</em>.</p>
<p>The concat task supports nested
<a href="../Types/filterchain.html"> FilterChain</a>s.</p>
<h4>header, footer</h4>
<p><em>since Ant 1.6</em>.</p>
<p>Used to prepend or postpend text into the concatenated stream.</p>
<p>The text may be in-line or be in a file.</p>
<table border="1" cellpadding="2" cellspacing="0">
<tr>
<td valign="top"><b>Attribute</b></td>
<td valign="top"><b>Description</b></td>
<td align="center" valign="top"><b>Required</b></td>
</tr>
<tr>
<td valign="top">filtering</td>
<td valign="top">
Whether to filter the text provided by this sub element,
default is "yes".
<td valign="top" align = "center">No</td>
</tr>
<tr>
<td valign="top">file</td>
<td valign="top">A file to place at the head or tail of the
concatenated text.
<td valign="top" align = "center">No</td>
</tr>
<tr>
<td valign="top">trim</td>
<td valign="top">Whether to trim the value, default is "no"</td>
<td valign="top" align = "center">No</td>
</tr>
<tr>
<td valign="top">trimleading</td>
<td valign="top">
Whether to trim leading white space on each line, default is "no"
</td>
<td valign="top" align = "center">No</td>
</tr>
</table>
<h3>Examples</h3>
<p><b>Concatenate a string to a file:</b></p>
<pre>
<concat destfile="README">Hello, World!</concat>
</pre>
<p><b>Concatenate a series of files to the console:</b></p>
<pre>
<concat>
<fileset dir="messages" includes="*important*"/>
</concat>
</pre>
<p><b>Concatenate a single file, appending if the destination file exists:</b></p>
<pre>
<concat destfile="NOTES" append="true">
<filelist dir="notes" files="note.txt"/>
</concat>
</pre>
<p><b>Concatenate a series of files, update the destination
file only if is older that all the source files:</b></p>
<pre>
<concat destfile="${docbook.dir}/all-sections.xml"
force="no">
<filelist dir="${docbook.dir}/sections"
files="introduction.xml,overview.xml"/>
<fileset dir="${docbook.dir}"
includes="sections/*.xml"
excludes="introduction.xml,overview.xml"/>
</concat>
</pre>
<p><b>Concatenate a series of files, expanding ant properties</b></p>
<pre>
<concat destfile="${build.dir}/subs">
<path>
<fileset dir="${src.dir}" includes="*.xml"/>
<pathelement location="build.xml"/>
</path>
<filterchain>
<expandproperties/>
</filterchain>
</concat>
</pre>
<p><b>Filter the lines containing project from build.xml and output
them to report.output, prepending with a header</b></p>
<pre>
<concat destfile="${build.dir}/report.output">
<header filtering="no" trimleading="yes">
Lines that contain project
==========================
</header>
<path path="build.xml"/>
<filterchain>
<linecontains>
<contains value="project"/>
</linecontains>
</filterchain>
</concat>
</pre>
<p><b>Concatenate a number of binary files.</b></p>
<pre>
<concat destfile="${build.dir}/dist.bin" binary="yes">
<fileset file="${src.dir}/scripts/dist.sh" />
<fileset file="${build.dir}/dist.tar.bz2" />
</concat>
</pre>
</body>
</html>