You are viewing a plain text version of this content. The canonical link for it is here.
Posted to easyant-commits@incubator.apache.org by jl...@apache.org on 2012/10/18 19:58:21 UTC

svn commit: r1399820 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/core/ant/MetaBuildExecutor.java

Author: jlboudart
Date: Thu Oct 18 19:58:21 2012
New Revision: 1399820

URL: http://svn.apache.org/viewvc?rev=1399820&view=rev
Log:
Remove deprecated code in MetaBuildExecutor, no more need to publish the meta-build descriptor

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=1399820&r1=1399819&r2=1399820&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 Thu Oct 18 19:58:21 2012
@@ -17,8 +17,6 @@
  */
 package org.apache.easyant.core.ant;
 
-import java.io.File;
-import java.net.URL;
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
@@ -28,17 +26,8 @@ import org.apache.easyant.core.EasyAntMa
 import org.apache.easyant.core.ant.listerners.BuildExecutionTimer;
 import org.apache.easyant.core.ant.listerners.BuildExecutionTimer.ExecutionResult;
 import org.apache.easyant.core.ant.listerners.SubBuildExecutionTimer;
-import org.apache.easyant.core.ivy.IvyInstanceHelper;
 import org.apache.easyant.tasks.SubModule;
 import org.apache.easyant.tasks.SubModule.TargetList;
-import org.apache.ivy.ant.IvyAntSettings;
-import org.apache.ivy.core.module.descriptor.Artifact;
-import org.apache.ivy.core.module.descriptor.MDArtifact;
-import org.apache.ivy.core.module.descriptor.ModuleDescriptor;
-import org.apache.ivy.core.settings.IvySettings;
-import org.apache.ivy.plugins.parser.ModuleDescriptorParser;
-import org.apache.ivy.plugins.parser.ModuleDescriptorParserRegistry;
-import org.apache.ivy.plugins.repository.url.URLResource;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.Project;
 import org.apache.tools.ant.helper.DefaultExecutor;
@@ -53,54 +42,20 @@ public class MetaBuildExecutor extends D
     private static final String DEMARKER = "======================================================================";
 
     @Override
-    public void executeTargets(Project project, String[] targets)
-            throws BuildException {
-        if (project.getReference("build-path")==null) {
+    public void executeTargets(Project project, String[] targets) throws BuildException {
+        if (project.getReference("build-path") == null) {
             throw new BuildException("build-path is required to use MetaBuildExecutor");
         }
 
-        // publish the parent module descriptor into the build-scoped
-        // repository, so that it can
-        // be used by submodules if needed
-        File moduleFile = new File(project.getBaseDir(), "module.ivy");
-        String buildRepo = EasyAntConstants.BUILD_SCOPE_REPOSITORY;
-        if (moduleFile.isFile() && buildRepo != null) {
-
-            project.log("Publishing module descriptor " + moduleFile.getPath()
-                    + " to build repository '" + buildRepo + "'");
-
-            IvyAntSettings projectSettings = IvyInstanceHelper
-                    .getProjectIvyAntSettings(project);
-            IvySettings ivy = projectSettings.getConfiguredIvyInstance(null).getSettings();
-
-            try {
-                URL ivyUrl = moduleFile.toURI().toURL();
-                ModuleDescriptorParser mdp = ModuleDescriptorParserRegistry
-                        .getInstance().getParser(
-                                new URLResource(moduleFile.toURI().toURL()));
-                ModuleDescriptor descriptor = mdp.parseDescriptor(ivy, ivyUrl,
-                        true);
-                Artifact artifact = MDArtifact.newIvyArtifact(descriptor);
-                ivy.getResolver(buildRepo).publish(artifact, moduleFile, true);
-            } catch (Exception ioe) {
-                throw new BuildException("Error publishing meta-module file "
-                        + moduleFile.getAbsolutePath() + " to " + buildRepo,
-                        ioe);
-            }
-
-        }
-
         // hook for pre-module-targets
-        String preModuleTargets = project
-                .getProperty(EasyAntMagicNames.PRE_MODULE_TARGETS);
+        String preModuleTargets = project.getProperty(EasyAntMagicNames.PRE_MODULE_TARGETS);
         if (preModuleTargets == null) {
             preModuleTargets = EasyAntConstants.DEFAULT_PRE_MODULE_TARGETS;
         }
 
         List<String> postTargetsToRun = new ArrayList<String>();
         List<String> preTargetsToRun = new ArrayList<String>();
-        List<String> preModuleTargetList = Arrays.asList(preModuleTargets
-                .split(","));
+        List<String> preModuleTargetList = Arrays.asList(preModuleTargets.split(","));
         for (int i = 0; i < targets.length; i++) {
             if (preModuleTargetList.contains(targets[i])) {
                 // fill a list of targets to run BEFORE subproject delegation
@@ -111,8 +66,7 @@ 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);
                 }
 
             }
@@ -130,11 +84,8 @@ public class MetaBuildExecutor extends D
         subModule.setTaskName("meta:submodule");
         subModule.setProject(project);
 
-        Boolean useBuildRepository = project
-                .getProperty(EasyAntMagicNames.USE_BUILD_REPOSITORY) != null ? Boolean
-                .parseBoolean(project
-                        .getProperty(EasyAntMagicNames.USE_BUILD_REPOSITORY))
-                : true;
+        Boolean useBuildRepository = project.getProperty(EasyAntMagicNames.USE_BUILD_REPOSITORY) != null ? Boolean
+                .parseBoolean(project.getProperty(EasyAntMagicNames.USE_BUILD_REPOSITORY)) : true;
         subModule.setUseBuildRepository(useBuildRepository);
 
         subModule.setBuildpathRef(new Reference(project, "build-path"));
@@ -143,16 +94,13 @@ public class MetaBuildExecutor extends D
 
         // now call the default executor to include any extra targets defined in
         // the root module.ant
-        super
-                .executeTargets(project, postTargetsToRun
-                        .toArray(new String[] {}));
+        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
+     * 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
@@ -161,13 +109,11 @@ public class MetaBuildExecutor extends D
         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("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(" * ").append(subModules[i].trim()).append(StringUtils.LINE_SEP);
             }
             sb.append(DEMARKER);
             project.log(sb.toString());
@@ -179,13 +125,9 @@ public class MetaBuildExecutor extends D
                 .getReference(SubBuildExecutionTimer.EXECUTION_TIMER_SUBBUILD_RESULTS);
         if (allSubBuildResults != null && allSubBuildResults.size() > 0) {
             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).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());
         }