mbenson 2004/09/10 08:16:11
Modified: . WHATSNEW
src/main/org/apache/tools/ant/taskdefs ExecTask.java
docs/manual/CoreTasks exec.html
Log:
Added searchpath attribute to <exec> for searching path
variables when resolveexecutable = true. Thanks to Stefan
for having already written the path-searching code.
Revision Changes Path
1.660 +3 -0 ant/WHATSNEW
Index: WHATSNEW
===================================================================
RCS file: /home/cvs/ant/WHATSNEW,v
retrieving revision 1.659
retrieving revision 1.660
diff -u -r1.659 -r1.660
--- WHATSNEW 10 Sep 2004 14:19:26 -0000 1.659
+++ WHATSNEW 10 Sep 2004 15:16:10 -0000 1.660
@@ -50,6 +50,9 @@
* It is now possible to specify the pattern created/parsed by <checksum>.
Bugzilla Report 16539.
+* Added searchpath attribute to <exec> for searching path variable(s)
+ when resolveexecutable = true.
+
Changes from Ant 1.6.2 to current Ant 1.6 CVS version
=====================================================
1.72 +13 -1 ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java
Index: ExecTask.java
===================================================================
RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/ExecTask.java,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- ExecTask.java 20 Aug 2004 10:56:52 -0000 1.71
+++ ExecTask.java 10 Sep 2004 15:16:11 -0000 1.72
@@ -51,6 +51,7 @@
private boolean failIfExecFails = true;
private String executable;
private boolean resolveExecutable = false;
+ private boolean searchPath = false;
private boolean spawn = false;
private boolean incompatibleWithSpawn = false;
@@ -261,6 +262,16 @@
}
/**
+ * Sets a flag indicating whether to search nested, then
+ * system PATH environment variables for the executable.
+ *
+ * @param searchPath if true, search PATHs
+ */
+ public void setSearchPath(boolean searchPath) {
+ this.searchPath = searchPath;
+ }
+
+ /**
* Indicates whether to attempt to resolve the executable to a
* file
*
@@ -345,6 +356,7 @@
* Add a <CODE>RedirectorElement</CODE> to this task.
*
* @param redirectorElement <CODE>RedirectorElement</CODE>.
+ * @since Ant 1.6.2
*/
public void addConfiguredRedirector(RedirectorElement redirectorElement)
{
if (this.redirectorElement != null) {
@@ -444,7 +456,7 @@
*/
public void execute() throws BuildException {
File savedDir = dir; // possibly altered in prepareExec
- cmdl.setExecutable(resolveExecutable(executable, false));
+ cmdl.setExecutable(resolveExecutable(executable, searchPath));
checkConfiguration();
if (isValidOs()) {
try {
1.41 +10 -2 ant/docs/manual/CoreTasks/exec.html
Index: exec.html
===================================================================
RCS file: /home/cvs/ant/docs/manual/CoreTasks/exec.html,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- exec.html 13 Apr 2004 10:36:42 -0000 1.40
+++ exec.html 10 Sep 2004 15:16:11 -0000 1.41
@@ -212,13 +212,21 @@
<td align="center" valign="top">No, default is <i>true</i></td>
</tr>
<tr>
- <td valign="top">resolveExecutable</td>
+ <td valign="top">resolveexecutable</td>
<td valign="top">When this attribute is true, the name of the executable
- if resolved firstly against the project basedir and
+ is resolved firstly against the project basedir and
if that does not exist, against the execution
directory if specified. On Unix systems, if you only
want to allow execution of commands in the user's path,
set this to false. <em>since Ant 1.6</em></td>
+ <td align="center" valign="top">No, default is <i>false</i></td>
+ </tr>
+ <tr>
+ <td valign="top">searchpath</td>
+ <td valign="top">When this attribute is true nested, then
+ system path environment variables will
+ be searched when resolving the location
+ of the executable. <em>since Ant 1.6.3</em></td>
<td align="center" valign="top">No, default is <i>false</i></td>
</tr>
</table>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]