diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 8aa696813..8e1c27b0d 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -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 diff --git a/WHATSNEW b/WHATSNEW index 6df5e1676..259928488 100644 --- a/WHATSNEW +++ b/WHATSNEW @@ -248,6 +248,9 @@ Other changes: * Added isfileselected condition. +* Added verbose="true|false" attribute to . When verbose is enabled, + the directory name is logged on entry and exit of the sub-build. Bugzilla 33787. + Fixed bugs: ----------- diff --git a/docs/manual/CoreTasks/subant.html b/docs/manual/CoreTasks/subant.html index 0e9563525..a4a27fb47 100644 --- a/docs/manual/CoreTasks/subant.html +++ b/docs/manual/CoreTasks/subant.html @@ -128,7 +128,7 @@ String - + Optional @@ -229,6 +229,21 @@ + + + + verbose + + + + Enable/ disable log messages showing when each sub-build path is entered/ exited. + The default value is false. + + + boolean + + + @@ -491,7 +506,7 @@
- Copyright © 2000-2004, The Apache Software Foundation. All Rights Reserved. + Copyright © 2000-2005, The Apache Software Foundation. All Rights Reserved.
@@ -499,4 +514,4 @@ - \ No newline at end of file + diff --git a/src/main/org/apache/tools/ant/taskdefs/SubAnt.java b/src/main/org/apache/tools/ant/taskdefs/SubAnt.java index 1c8d45c45..1d5c46d09 100644 --- a/src/main/org/apache/tools/ant/taskdefs/SubAnt.java +++ b/src/main/org/apache/tools/ant/taskdefs/SubAnt.java @@ -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 <ant>'s * output attribute.