Browse Source

add verbose attribute to <subant> task

PR: 33787
Obtained from: Craig Ryan, Frank Somers


git-svn-id: https://svn.apache.org/repos/asf/ant/core/trunk@277799 13f79535-47bb-0310-9956-ffa450edef68
master
Peter Reilly 20 years ago
parent
commit
03c4f14818
4 changed files with 50 additions and 3 deletions
  1. +2
    -0
      CONTRIBUTORS
  2. +3
    -0
      WHATSNEW
  3. +18
    -3
      docs/manual/CoreTasks/subant.html
  4. +27
    -0
      src/main/org/apache/tools/ant/taskdefs/SubAnt.java

+ 2
- 0
CONTRIBUTORS View File

@@ -32,6 +32,7 @@ Conor MacNeill
Craeg Strong
Craig Cottingham
Craig R. McClanahan
Craig Ryan
Curtis White
Cyrille Morvan
Dale Anson
@@ -63,6 +64,7 @@ Erik Langenbach
Erik Meade
Ernst de Haan
Frederic Lavigne
Frank Somers
Gary S. Weaver
Gautam Guliani
Gero Vermaas


+ 3
- 0
WHATSNEW View File

@@ -248,6 +248,9 @@ Other changes:

* Added isfileselected condition.

* Added verbose="true|false" attribute to <subant>. When verbose is enabled,
the directory name is logged on entry and exit of the sub-build. Bugzilla 33787.

Fixed bugs:
-----------



+ 18
- 3
docs/manual/CoreTasks/subant.html View File

@@ -128,7 +128,7 @@
<td bgcolor="#eeeeee" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">String</font>
</td>
<td bgcolor="#eeeeee" valign="top" align="left" rowspan="9">
<td bgcolor="#eeeeee" valign="top" align="left" rowspan="10">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">Optional</font>
</td>
</tr>
@@ -229,6 +229,21 @@
</td>
</tr>

<!-- Attribute -->
<tr>
<td bgcolor="#eeeeee" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">verbose</font>
</td>
<td bgcolor="#eeeeee" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">
Enable/ disable log messages showing when each sub-build path is entered/ exited.
The default value is false.</font>
</td>
<td bgcolor="#eeeeee" valign="top" align="left">
<font color="#000000" size="-1" face="arial,helvetica,sanserif">boolean</font>
</td>
</tr>


</table>
</blockquote></td></tr>
@@ -491,7 +506,7 @@
<tr>
<td>
<div align="center"><font color="#525D76" size="-1"><em>
Copyright &copy; 2000-2004, The Apache Software Foundation. All Rights Reserved.
Copyright &copy; 2000-2005, The Apache Software Foundation. All Rights Reserved.
</em></font></div>
</td>
</tr>
@@ -499,4 +514,4 @@
</table>

</body>
</html>
</html>

+ 27
- 0
src/main/org/apache/tools/ant/taskdefs/SubAnt.java View File

@@ -65,6 +65,7 @@ public class SubAnt
private String subTarget = null;
private String antfile = "build.xml";
private File genericantfile = null;
private boolean verbose = false;
private boolean inheritAll = false;
private boolean inheritRefs = false;
private boolean failOnError = true;
@@ -180,11 +181,16 @@ public class SubAnt
BuildException buildException = null;
for (int i = 0; i < count; ++i) {
File file = null;
String subdirPath = null;
Throwable thrownException = null;
try {
File directory = null;
file = new File(filenames[i]);
if (file.isDirectory()) {
if (verbose) {
subdirPath = file.getPath();
log("Entering directory: " + subdirPath + "\n", Project.MSG_INFO);
}
if (genericantfile != null) {
directory = file;
file = genericantfile;
@@ -193,13 +199,22 @@ public class SubAnt
}
}
execute(file, directory);
if (verbose && subdirPath != null) {
log("Leaving directory: " + subdirPath + "\n", Project.MSG_INFO);
}
} catch (RuntimeException ex) {
if (!(getProject().isKeepGoingMode())) {
if (verbose && subdirPath != null) {
log("Leaving directory: " + subdirPath + "\n", Project.MSG_INFO);
}
throw ex; // throw further
}
thrownException = ex;
} catch (Throwable ex) {
if (!(getProject().isKeepGoingMode())) {
if (verbose && subdirPath != null) {
log("Leaving directory: " + subdirPath + "\n", Project.MSG_INFO);
}
throw new BuildException(ex);
}
thrownException = ex;
@@ -223,6 +238,9 @@ public class SubAnt
new BuildException(thrownException);
}
}
if (verbose && subdirPath != null) {
log("Leaving directory: " + subdirPath + "\n", Project.MSG_INFO);
}
}
}
// check if one of the builds failed in keep going mode
@@ -323,6 +341,15 @@ public class SubAnt
this.subTarget = target;
}

/**
* Enable/ disable verbose log messages showing when each sub-build path is entered/ exited.
* The default value is "false".
* @param on true to enable verbose mode, false otherwise (default).
*/
public void setVerbose(boolean on) {
this.verbose = on;
}

/**
* Corresponds to <code>&lt;ant&gt;</code>'s
* <code>output</code> attribute.


Loading…
Cancel
Save