incubator-easyant-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jlboud...@apache.org
Subject svn commit: r1399823 - /incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java
Date Thu, 18 Oct 2012 19:59:52 GMT
Author: jlboudart
Date: Thu Oct 18 19:59:52 2012
New Revision: 1399823

URL: http://svn.apache.org/viewvc?rev=1399823&view=rev
Log:
Be less aggressive when filtering targets, invoke resolve before publishing to build scope
repository

Modified:
    incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java

Modified: incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java
URL: http://svn.apache.org/viewvc/incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java?rev=1399823&r1=1399822&r2=1399823&view=diff
==============================================================================
--- incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java (original)
+++ incubator/easyant/core/trunk/src/main/java/org/apache/easyant/tasks/SubModule.java Thu
Oct 18 19:59:52 2012
@@ -37,6 +37,7 @@ import org.apache.easyant.core.ant.liste
 import org.apache.easyant.core.ivy.IvyInstanceHelper;
 import org.apache.ivy.ant.IvyAntSettings;
 import org.apache.ivy.ant.IvyPublish;
+import org.apache.ivy.ant.IvyResolve;
 import org.apache.tools.ant.BuildException;
 import org.apache.tools.ant.BuildListener;
 import org.apache.tools.ant.Location;
@@ -194,15 +195,22 @@ public class SubModule extends Task {
 
             ProjectUtils.injectTargetIntoExtensionPoint(subModule, helper);
 
-            filterTargets(subModule);
+            Set<String> targetsToRun = filterTargets(subModule);
             printExecutingTargetMsg(subModule);
 
-            if (targets != null && !targets.isEmpty()) {
-                subModule.executeTargets(targets);
+            if (targetsToRun != null && !targetsToRun.isEmpty()) {
+                subModule.executeTargets(new TargetList(targetsToRun));
                 if (useBuildRepository) {
-
                     File artifactsDir = subModule.resolveFile(subModule.getProperty("target.artifacts"));
                     if (artifactsDir.isDirectory()) {
+                        IvyResolve ivyResolve = new IvyResolve();
+                        ivyResolve.setFile(file);
+                        ivyResolve.setProject(subModule);
+                        ivyResolve.setOwningTarget(getOwningTarget());
+                        ivyResolve.setLocation(getLocation());
+                        ivyResolve.setTaskName("publish-buildscoped-repository");
+                        ivyResolve.setSettingsRef(IvyInstanceHelper.buildProjectIvyReference(subModule));
+                        ivyResolve.execute();
 
                         // this property set by LoadModule task when it
                         // configures the build repo
@@ -214,7 +222,8 @@ public class SubModule extends Task {
                         ivyPublish.setSettingsRef(IvyInstanceHelper.buildProjectIvyReference(subModule));
                         ivyPublish.setResolver(resolver);
                         // TODO: this should be more flexible!
-                        ivyPublish.setArtifactspattern("${target.artifacts}/[artifact](-[classifier]).[ext]");
+                        ivyPublish.setArtifactspattern(artifactsDir.getAbsolutePath()
+                                + "/[artifact](-[classifier]).[ext]");
                         // not all sub-build targets will generate ivy
                         // artifacts. we don't want to fail
                         // a successful build just because there's nothing to
@@ -304,15 +313,19 @@ public class SubModule extends Task {
     /**
      * Filter the active set of targets to only those defined in the given project.
      */
-    private void filterTargets(Project subProject) {
+    private Set<String> filterTargets(Project subProject) {
+        Set<String> filteredTargets = new HashSet<String>();
         Set<?> keys = subProject.getTargets().keySet();
+
         for (Iterator<String> it = targets.iterator(); it.hasNext();) {
             String target = it.next();
-            if (!keys.contains(target) && target.trim().length() > 0) {
+            if (keys.contains(target)) {
+                filteredTargets.add(target);
+            } else {
                 subProject.log("Skipping undefined target '" + target + "'", Project.MSG_VERBOSE);
-                it.remove();
             }
         }
+        return filteredTargets;
     }
 
     /**
@@ -656,5 +669,11 @@ public class SubModule extends Task {
             for (String target : targets)
                 add(target);
         }
+
+        public TargetList(Set<String> targets) {
+            for (String target : targets) {
+                add(target);
+            }
+        }
     }
 }



Mime
View raw message