incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From kpsiddha...@apache.org
Subject svn commit: r1091666 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
Date Wed, 13 Apr 2011 06:27:12 GMT
Author: kpsiddharth
Date: Wed Apr 13 06:27:12 2011
New Revision: 1091666

URL: http://svn.apache.org/viewvc?rev=1091666&view=rev
Log:
EASYANT-9: Changes to output sub-modules build summary information

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java?rev=1091666&r1=1091665&r2=1091666&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
(original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java
Wed Apr 13 06:27:12 2011
@@ -25,6 +25,9 @@ import java.util.List;
 
 import org.apache.easyant.core.EasyAntConstants;
 import org.apache.easyant.core.EasyAntMagicNames;
+import org.apache.easyant.core.ant.listerners.BuildExecutionTimer;
+import org.apache.easyant.core.ant.listerners.SubBuildExecutionTimer;
+import org.apache.easyant.core.ant.listerners.BuildExecutionTimer.ExecutionResult;
 import org.apache.easyant.core.ivy.IvyInstanceHelper;
 import org.apache.easyant.tasks.SubModule;
 import org.apache.easyant.tasks.SubModule.TargetList;
@@ -43,12 +46,15 @@ import org.apache.tools.ant.helper.Defau
 import org.apache.tools.ant.types.FileSet;
 import org.apache.tools.ant.types.Reference;
 import org.apache.tools.ant.types.selectors.FilenameSelector;
+import org.apache.tools.ant.util.StringUtils;
 
 /**
  * Recursively executes build targets on sub-modules for a multi-module project.
  */
 public class MetaBuildExecutor extends DefaultExecutor {
 
+    private static final String DEMARKER = "======================================================================";
+    
     @Override
     public void executeTargets(Project project, String[] targets)
             throws BuildException {
@@ -130,8 +136,8 @@ public class MetaBuildExecutor extends D
                 if (project.getTargets().get(targets[i]) != null) {
                     postTargetsToRun.add(targets[i]);
                 } else {
-                    project.log("Skipping undefined target '" + targets[i] + "'",
-                            Project.MSG_VERBOSE);
+                    project.log("Skipping undefined target '" + targets[i]
+                            + "'", Project.MSG_VERBOSE);
                 }
 
             }
@@ -141,6 +147,8 @@ public class MetaBuildExecutor extends D
         // targets defined in the root module.ant
         super.executeTargets(project, preTargetsToRun.toArray(new String[] {}));
 
+        printSubBuildsInOrder(project);
+
         // delegate to the ea:submodule task to execute the list of targets on
         // all modules in the build list
         SubModule subModule = new SubModule();
@@ -163,6 +171,45 @@ public class MetaBuildExecutor extends D
         super
                 .executeTargets(project, postTargetsToRun
                         .toArray(new String[] {}));
+
+        printExecutionSubBuildsExecutionTimes(project);
     }
 
+    /*
+     * informs all the sub-modules that will be built, in the order they will be
+     * built
+     */
+    private void printSubBuildsInOrder(Project project) {
+        // print all sub modules and order in which they will
+        // be executed
+        String sortedModules = project.getProperty("ivy.sorted.modules");
+        if (sortedModules != null && sortedModules.length() > 0) {
+            StringBuilder sb = new StringBuilder();
+            sb.append(DEMARKER).append(StringUtils.LINE_SEP);
+            sb.append("Build Order for Sub Modules").append(
+                    StringUtils.LINE_SEP);
+            sb.append(DEMARKER).append(StringUtils.LINE_SEP);
+            String[] subModules = sortedModules.split("\\,");
+            for (int i = 0; i < subModules.length; i++) {
+                sb.append(" * ").append(subModules[i].trim()).append(
+                        StringUtils.LINE_SEP);
+            }
+            sb.append(DEMARKER);
+            project.log(sb.toString());
+        }
+    }
+
+    private void printExecutionSubBuildsExecutionTimes(Project project) {
+        List<ExecutionResult> allSubBuildResults = (List<ExecutionResult>) project
+                .getReference(SubBuildExecutionTimer.EXECUTION_TIMER_SUBBUILD_RESULTS);
+        StringBuilder sb = new StringBuilder();
+        sb.append(StringUtils.LINE_SEP).append(DEMARKER).append(
+                StringUtils.LINE_SEP);
+        sb.append("Project Sub-modules Summary: ").append(StringUtils.LINE_SEP).append(
+                DEMARKER);
+        sb.append(StringUtils.LINE_SEP).append(
+                BuildExecutionTimer.formatExecutionResults(allSubBuildResults));
+        sb.append(StringUtils.LINE_SEP).append(DEMARKER);
+        project.log(sb.toString());
+    }
 }



Mime
View raw message