Skip to content

Commit

Permalink
TychoGraphBuilder: -amd should pick up dependencies of dependants
Browse files Browse the repository at this point in the history
Also add a few more integration tests.

Change-Id: I0538fb5bd285c8d2d4132e95c4d44d09c5b2026c
  • Loading branch information
sratz committed Feb 1, 2022
1 parent 4e8adec commit 4269c03
Show file tree
Hide file tree
Showing 9 changed files with 89 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -220,9 +220,9 @@ public Result<ProjectDependencyGraph> build(MavenSession session) {
.distinct()//
.peek(project -> loggerAdapter.debug(" + add downstream project '" + project.getName()
+ "' of project '" + projectRequest.mavenProject.getName() + "'..."))//
// make behaviors are both false here as projectDependenciesMap includes transitive already
// request dependencies of dependants, otherwise, -amd would not be able to produce a satisfiable build graph
.forEach(
project -> queue.add(new ProjectRequest(project, false, false, projectRequest)));
project -> queue.add(new ProjectRequest(project, false, true, projectRequest)));
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bundle 1a
Bundle-SymbolicName: bundle1a;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: bundle1
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
16 changes: 16 additions & 0 deletions tycho-its/projects/reactor.makeBehaviour/bundle1a/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<version>1.0.0-SNAPSHOT</version>
<artifactId>bundle1a</artifactId>
<packaging>eclipse-plugin</packaging>

<parent>
<groupId>tycho-its-project.reactor.makeBehaviour</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Bundle 1b
Bundle-SymbolicName: bundle1b;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Require-Bundle: bundle1a
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
source.. = src/
output.. = bin/
bin.includes = META-INF/,\
.
16 changes: 16 additions & 0 deletions tycho-its/projects/reactor.makeBehaviour/bundle1b/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<version>1.0.0-SNAPSHOT</version>
<artifactId>bundle1b</artifactId>
<packaging>eclipse-plugin</packaging>

<parent>
<groupId>tycho-its-project.reactor.makeBehaviour</groupId>
<artifactId>parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
</parent>

</project>
2 changes: 2 additions & 0 deletions tycho-its/projects/reactor.makeBehaviour/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<module>feature1</module>
<module>feature2</module>
<module>bundle1</module>
<module>bundle1a</module>
<module>bundle1b</module>
<module>bundle2</module>
</modules>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,12 @@
* Test project dependencies:
*
* <pre>
* feature2 -> feature1,bundle2
* feature1 -> bundle1
* bundle1a <-- bundle1b
* |
* |
* bundle1 <-- feature1 <-- feature2
* |
* bundle2 <--|
* </pre>
*
*/
Expand All @@ -48,6 +52,8 @@ public void testCompleteBuild() throws Exception {
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();
verifier.assertFilePresent("bundle1/target/bundle1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1a-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1b-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle2/target/bundle2-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature1/target/feature1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature2/target/feature2-1.0.0-SNAPSHOT.jar");
Expand All @@ -61,19 +67,38 @@ public void testAlsoMake() throws Exception {
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();
verifier.assertFilePresent("bundle1/target/bundle1-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("bundle1/target/bundle1a-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("bundle1/target/bundle1b-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("bundle2/target/bundle2-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature1/target/feature1-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("feature2/target/feature2-1.0.0-SNAPSHOT.jar");
}

@Test
public void testAlsoMakeDependents() throws Exception {
public void testAlsoMakeWithIndirectDependencies() throws Exception {
// REACTOR_MAKE_UPSTREAM
verifier.addCliOption("-am");
verifier.addCliOption("-pl bundle1b");
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();
verifier.assertFilePresent("bundle1/target/bundle1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1a-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1b-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("bundle2/target/bundle2-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("feature1/target/feature1-1.0.0-SNAPSHOT.jar");
verifier.assertFileNotPresent("feature2/target/feature2-1.0.0-SNAPSHOT.jar");
}

@Test
public void testAlsoMakeDependentsNeedsToPickUpDependenciesOfDependents() throws Exception {
// REACTOR_MAKE_DOWNSTREAM
verifier.addCliOption("-amd");
verifier.addCliOption("-pl bundle1,bundle2");
verifier.addCliOption("-pl bundle1");
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();
verifier.assertFilePresent("bundle1/target/bundle1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1a-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1b-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle2/target/bundle2-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature1/target/feature1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature2/target/feature2-1.0.0-SNAPSHOT.jar");
Expand All @@ -88,6 +113,8 @@ public void testBoth() throws Exception {
verifier.executeGoals(List.of("clean", "verify"));
verifier.verifyErrorFreeLog();
verifier.assertFilePresent("bundle1/target/bundle1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1a-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle1/target/bundle1b-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("bundle2/target/bundle2-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature1/target/feature1-1.0.0-SNAPSHOT.jar");
verifier.assertFilePresent("feature2/target/feature2-1.0.0-SNAPSHOT.jar");
Expand Down

0 comments on commit 4269c03

Please sign in to comment.