You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ant.apache.org by jl...@apache.org on 2014/11/25 08:35:10 UTC
ant-easyant-core git commit: fix EASYANT-70 Specified targets order not kept when building multi-modules (thanks to Jérôme Leroux)
Repository: ant-easyant-core
Updated Branches:
refs/heads/master 0b161f88f -> d2d5fb91e
fix EASYANT-70 Specified targets order not kept when building multi-modules (thanks to Jérôme Leroux)
Project: http://git-wip-us.apache.org/repos/asf/ant-easyant-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/ant-easyant-core/commit/d2d5fb91
Tree: http://git-wip-us.apache.org/repos/asf/ant-easyant-core/tree/d2d5fb91
Diff: http://git-wip-us.apache.org/repos/asf/ant-easyant-core/diff/d2d5fb91
Branch: refs/heads/master
Commit: d2d5fb91ec90896f53c80874abc603fc4cb8a0f5
Parents: 0b161f8
Author: Jean-Louis Boudart <je...@gmail.com>
Authored: Tue Nov 25 08:35:02 2014 +0100
Committer: Jean-Louis Boudart <je...@gmail.com>
Committed: Tue Nov 25 08:35:02 2014 +0100
----------------------------------------------------------------------
.../org/apache/easyant/tasks/SubModule.java | 2 +-
.../org/apache/easyant/tasks/SubModuleTest.java | 40 ++++++++++++++++----
.../ants/modulewithtarget-0.1.ant | 18 +++++++++
3 files changed, 52 insertions(+), 8 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ant-easyant-core/blob/d2d5fb91/src/main/java/org/apache/easyant/tasks/SubModule.java
----------------------------------------------------------------------
diff --git a/src/main/java/org/apache/easyant/tasks/SubModule.java b/src/main/java/org/apache/easyant/tasks/SubModule.java
index 7d05658..b53a4ff 100644
--- a/src/main/java/org/apache/easyant/tasks/SubModule.java
+++ b/src/main/java/org/apache/easyant/tasks/SubModule.java
@@ -307,7 +307,7 @@ public class SubModule extends AbstractEasyAntTask {
* Filter the active set of targets to only those defined in the given project.
*/
private String filterTargets(Project subProject) {
- Set<String> filteredTargets = new HashSet<String>();
+ List<String> filteredTargets = new ArrayList<String>();
Set<?> keys = subProject.getTargets().keySet();
for (String target : targets) {
http://git-wip-us.apache.org/repos/asf/ant-easyant-core/blob/d2d5fb91/src/test/java/org/apache/easyant/tasks/SubModuleTest.java
----------------------------------------------------------------------
diff --git a/src/test/java/org/apache/easyant/tasks/SubModuleTest.java b/src/test/java/org/apache/easyant/tasks/SubModuleTest.java
index a0f3c4d..22a9a1f 100644
--- a/src/test/java/org/apache/easyant/tasks/SubModuleTest.java
+++ b/src/test/java/org/apache/easyant/tasks/SubModuleTest.java
@@ -18,8 +18,16 @@
package org.apache.easyant.tasks;
+import static org.hamcrest.CoreMatchers.notNullValue;
+import static org.junit.Assert.assertThat;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+
import org.apache.easyant.core.EasyAntMagicNames;
import org.apache.easyant.core.ant.listerners.MultiModuleLogger;
+import org.apache.easyant.tasks.SubModule.TargetList;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.types.FileSet;
import org.apache.tools.ant.types.Path;
@@ -29,13 +37,6 @@ import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.junit.rules.TemporaryFolder;
-import java.io.File;
-import java.io.IOException;
-import java.net.URISyntaxException;
-
-import static org.hamcrest.CoreMatchers.notNullValue;
-import static org.junit.Assert.assertThat;
-
public class SubModuleTest extends AntTaskBaseTest {
private SubModule submodule;
@@ -159,4 +160,29 @@ public class SubModuleTest extends AntTaskBaseTest {
assertThat(submodule.getProject().getReference(MultiModuleLogger.EXECUTION_TIMER_BUILD_RESULTS),
notNullValue());
}
+
+ @Test
+ public void shouldRunTargetInRightOrder() throws URISyntaxException {
+ configureBuildLogger(submodule.getProject(), Project.MSG_DEBUG);
+
+ Path path = new Path(submodule.getProject());
+ FileSet fs = new FileSet();
+ File multimodule = new File(this.getClass().getResource("multimodule").toURI());
+ fs.setDir(multimodule);
+ path.addFileset(fs);
+ path.createPath();
+
+ submodule.setBuildpath(path);
+ submodule.setTargets(new TargetList("modulewithtarget:firstTarget", "modulewithtarget:secondTarget", "modulewithtarget:thirdTarget"));
+ submodule.execute();
+
+ assertLogContaining("Executing [modulewithtarget:firstTarget, modulewithtarget:secondTarget, modulewithtarget:thirdTarget] on module1");
+ assertLogContaining("Executing [modulewithtarget:firstTarget, modulewithtarget:secondTarget, modulewithtarget:thirdTarget] on module2");
+ assertLogContaining("ant.project.invoked-targets -> modulewithtarget:firstTarget,modulewithtarget:secondTarget,modulewithtarget:thirdTarget");
+ assertLogContaining("project.executed.targets -> modulewithtarget:firstTarget,modulewithtarget:secondTarget,modulewithtarget:thirdTarget");
+ assertLogContaining("firstProperty=first secondProperty=second thirdProperty=third");
+
+ assertThat(submodule.getProject().getReference(MultiModuleLogger.EXECUTION_TIMER_BUILD_RESULTS),
+ notNullValue());
+ }
}
http://git-wip-us.apache.org/repos/asf/ant-easyant-core/blob/d2d5fb91/src/test/resources/repositories/plugins/mycompany/modulewithtarget/ants/modulewithtarget-0.1.ant
----------------------------------------------------------------------
diff --git a/src/test/resources/repositories/plugins/mycompany/modulewithtarget/ants/modulewithtarget-0.1.ant b/src/test/resources/repositories/plugins/mycompany/modulewithtarget/ants/modulewithtarget-0.1.ant
index cf1c9bb..9f45420 100644
--- a/src/test/resources/repositories/plugins/mycompany/modulewithtarget/ants/modulewithtarget-0.1.ant
+++ b/src/test/resources/repositories/plugins/mycompany/modulewithtarget/ants/modulewithtarget-0.1.ant
@@ -19,4 +19,22 @@
<echo>a message from mytarget</echo>
<property name="apropertyinmytarget" value="foobar"/>
</target>
+
+ <target name="modulewithtarget:firstTarget">
+ <property name="firstProperty" value="first"/>
+ </target>
+
+ <target name="modulewithtarget:secondTarget">
+ <property name="firstProperty" value="invalid"/>
+ <property name="secondProperty" value="second"/>
+ </target>
+
+ <target name="modulewithtarget:thirdTarget">
+ <property name="firstProperty" value="invalid"/>
+ <property name="secondProperty" value="invalid"/>
+ <property name="thirdProperty" value="third"/>
+
+ <echo>firstProperty=${firstProperty} secondProperty=${secondProperty} thirdProperty=${thirdProperty}</echo>
+ </target>
+
</project>
\ No newline at end of file