mirror of
https://github.com/apache/ant.git
synced 2025-05-16 21:15:12 +00:00
git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@268652 13f79535-47bb-0310-9956-ffa450edef68
139 lines
5.0 KiB
HTML
139 lines
5.0 KiB
HTML
<html>
|
|
|
|
<head>
|
|
<meta http-equiv="Content-Language" content="en-us">
|
|
<title>Ant User Manual</title>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<h2><a name="execon">ExecOn</a></h2>
|
|
<h3>Description</h3>
|
|
<p>Executes a system command. When the <i>os</i> attribute is specified, then
|
|
the command is only executed when Ant is run on one of the specified operating
|
|
systems.</p>
|
|
<p>The files and/or directories of a number of <a
|
|
href="../CoreTypes/fileset.html">FileSet</a>s are passed as arguments to the system
|
|
command. At least one nested <code><fileset></code> is required.</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">executable</td>
|
|
<td valign="top">the command to execute without any command line
|
|
arguments.</td>
|
|
<td align="center" valign="top">Yes</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">dir</td>
|
|
<td valign="top">the directory in which the command should be executed.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">os</td>
|
|
<td valign="top">list of Operating Systems on which the command may be
|
|
executed.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">output</td>
|
|
<td valign="top">the file to which the output of the command should be
|
|
redirected.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">timeout</td>
|
|
<td valign="top">Stop the command if it doesn't finish within the
|
|
specified time (given in milliseconds).</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">failonerror</td>
|
|
<td valign="top">Stop the buildprocess if the command exits with a
|
|
returncode other than 0.</td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">newenvironment</td>
|
|
<td valign="top">Do not propagate old environment when new environment
|
|
variables are specified.</td>
|
|
<td align="center" valign="top">No, default is <i>false</i></td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">parallel</td>
|
|
<td valign="top">Run the command only once, appending all files as
|
|
arguments. If false, command will be executed once for every file.
|
|
Defaults to false. </td>
|
|
<td align="center" valign="top">No</td>
|
|
</tr>
|
|
<tr>
|
|
<td valign="top">type</td>
|
|
<td valign="top">One of <i>file</i>, <i>dir</i> or
|
|
<i>both</i>. If set to <i>file</i>, only the names of plain
|
|
files will be sent to the command. If set to <i>dir</i>, only
|
|
the names of directories are considered.</td>
|
|
<td align="center" valign="top">No, default is <i>file</i></td>
|
|
</tr>
|
|
</table>
|
|
<h3>Parameters specified as nested elements</h3>
|
|
<h4>fileset</h4>
|
|
<p>You can use any number of nested <code><fileset></code>
|
|
elements to define the files for this task and refer to
|
|
<code><fileset></code>s defined elsewhere.</p>
|
|
<h4>arg</h4>
|
|
<p>Command line arguments should be specified as nested
|
|
<code><arg></code> elements. See <a
|
|
href="../using.html#arg">Command line arguments</a>.</p>
|
|
<h4>srcfile</h4>
|
|
<p>By default the file names of the source files will be added to the
|
|
end of the command line. If you need to place it somewhere different,
|
|
use a nested <code><srcfile></code> element between your
|
|
<code><arg></code> elements to mark the insertion point.</p>
|
|
<h4>env</h4>
|
|
<p>It is possible to specify environment variables to pass to the
|
|
system command via nested <code><env></code> elements. See the
|
|
description in the section about <a href="exec.html#env">exec</a></p>
|
|
<p>Please note that the environment of the current Ant process is
|
|
<b>not</b> passed to the system command if you specify variables using
|
|
<code><env></code>.</p>
|
|
<h3>Examples</h3>
|
|
<blockquote><pre>
|
|
<execon executable="ls" >
|
|
<arg value="-l"/>
|
|
<fileset dir="/tmp">
|
|
<patternset>
|
|
<exclude name="**/*.txt"/>
|
|
</patternset>
|
|
</fileset>
|
|
<fileset refid="other.files"/>
|
|
</execon>
|
|
</pre></blockquote>
|
|
<p>invokes <code>ls -l</code>, adding the absolute filenames of all
|
|
files below <code>/tmp</code> not ending in <code>.txt</code> and all
|
|
files of the FileSet with <code>id</code> <code>other.files</code> to
|
|
the command line.</p>
|
|
<blockquote><pre>
|
|
<execon executable="somecommand" parallel="false" >
|
|
<arg value="arg1"/>
|
|
<srfile/>
|
|
<arg value="arg2"/>
|
|
<fileset dir="/tmp"/>
|
|
</execon>
|
|
</pre></blockquote>
|
|
<p>invokes <code>somecommand arg1 SOURCEFILENAME arg2</code> for each
|
|
file in <code>/tmp</code> replacing SOURCEFILENAME with the absolute
|
|
filename of each file in turn. If <code>parallel</code> had been set
|
|
to true, SOURCEFILENAME would be replaced with the absolute filenames
|
|
of all files separated by spaces.</p>
|
|
<hr>
|
|
<p align="center">Copyright © 2000,2001 Apache Software Foundation. All rights
|
|
Reserved.</p>
|
|
|
|
</body>
|
|
</html>
|
|
|