Skip to content

Commit

Permalink
Transitive dependency projects are not discovered with --also-make
Browse files Browse the repository at this point in the history
Currently it can happen that if one selects a project with -pl / -am
this project has initially not any maven dependencies but then later on
tycho adds one as a dependency and then the one declared in the pom are
not found.

This now adds an additional step each time a project is added as a
dependency to look if that project also has maven dependencies that map
to reactor projects.
  • Loading branch information
laeubi committed Mar 29, 2024
1 parent 42d40a9 commit 45cf05f
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ The following Organizations support Tycho getting processing power for their bui
* <img src="https://www.eclipse.org/favicon.ico" width="16" height="16"> [Eclipse Foundation](https://www.eclipse.org/sponsor/) - host our CI Infrastructure, become a friend of Eclipse and support the Eclipse Foundation in general
* <img src="https://www.renesas.com/favicon.ico" width="16" height="16"> [Renesas Electronics Corporation](https://www.eclipse.org/membership/showMember.php?member_id=1069) - sponsors a resource pack with 2 CPU / 8 GB RAM
* <img src="https://www.sap.com/favicon.ico" width="16" height="16"> [SAP SE](https://www.eclipse.org/membership/showMember.php?member_id=665) - sponsors two resource packs with 2 CPU / 8 GB RAM each
* <img src="https://www.redhat.com/favicon.ico" width="16" height="16"> [Red Hat, Inc.](https://www.eclipse.org/membership/showMember.php?member_id=731) - sponsors a resource pack with 2 CPU / 8 GB RAM
* <img src="https://www.redhat.com/themes/custom/rhdc/favicon.ico" width="16" height="16"> [Red Hat, Inc.](https://www.eclipse.org/membership/showMember.php?member_id=731) - sponsors a resource pack with 2 CPU / 8 GB RAM
* <img src="https://www.sigasi.com/img/logoSquare.png" width="16" height="16"> [Sigasi](https://www.eclipse.org/membership/showMember.php?member_id=990) - sponsors a resource pack with 2 CPU / 8 GB RAM

If your Organizations is an [Eclipse Member](https://www.eclipse.org/membership/exploreMembership.php) you can help us by [sponsoring one of the included resource packs](https://wiki.eclipse.org/CBI#Assigning_Resource_Packs_to_a_Project) to speed up builds. Organizations can check how many Resource Packs they have left for project sponsoring on the [membership portal](https://membership.eclipse.org/portal/login).

If your Organizations is an [Eclipse Member](https://www.eclipse.org/membership/exploreMembership.php) you can help us by [sponsoring one of the included resource packs](https://github.com/eclipse-cbi/cbi/wiki#assigning-additional-resources-to-a-project) to speed up builds. Organizations can check how many Resource Packs they have left for project sponsoring on the [membership portal](https://membership.eclipse.org/portal/login).
23 changes: 23 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,29 @@

This page describes the noteworthy improvements provided by each release of Eclipse Tycho.

## 4.0.8

backports:
- maven dependencies of transitive projects are not discovered with `-am` / `--also-make`

## 4.0.7

backports:
- update to next eclipse release
- tycho-p2-director:director: Fix handling of destination on macOS
- Prevent ConcurrentModificationException in PomInstallableUnitStore
- Add an option to enhance the compile log with baseline problems
- assemble-repository: Prevent sources from being included inadvertently
- ExpandedProduct.getFeatures(ROOT_FEATURES) returns over-qualified IDs
- provide suggested version for features
- Do not fail the DS build if one dependency failed to add
- Add a timestamp provider that inherits the timestamp from the parent
- Add option to include all configured sources in ApiFileGenerationMojo
- Do not fail target resolution if a referenced repository fails
- Add URI to message of GOAWAY info
- Reduce printed warnings in builds


## 4.0.6

### backports:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ForkJoinPool;
import java.util.function.Function;
import java.util.stream.Collectors;

import org.apache.maven.execution.MavenExecutionRequest;
Expand All @@ -38,6 +39,7 @@
import org.apache.maven.graph.DefaultGraphBuilder;
import org.apache.maven.graph.DefaultProjectDependencyGraph;
import org.apache.maven.graph.GraphBuilder;
import org.apache.maven.model.Dependency;
import org.apache.maven.model.building.DefaultModelProblem;
import org.apache.maven.model.building.ModelProblem;
import org.apache.maven.model.building.ModelProblem.Severity;
Expand Down Expand Up @@ -142,6 +144,8 @@ public Result<ProjectDependencyGraph> build(MavenSession session) {
}
ProjectDependencyGraph graph = graphResult.get();
List<MavenProject> projects = graph.getAllProjects();
Map<String, MavenProject> projectIdMap = projects.stream()
.collect(Collectors.toMap(p -> getProjectKey(p), Function.identity()));
int degreeOfConcurrency = request.getDegreeOfConcurrency();
Optional<ExecutorService> executor;
if (degreeOfConcurrency > 1) {
Expand Down Expand Up @@ -201,6 +205,22 @@ public Result<ProjectDependencyGraph> build(MavenSession session) {
// we also need to add the dependencies of the dependency project
queue.add(new ProjectRequest(project, false, true, projectRequest));
});
// special case: a (transitive) Tycho project might have declared a dependency
// to another project in the reactor but this can not be discovered by maven
// before we add it here...
List<Dependency> dependencies = projectRequest.mavenProject.getDependencies();
for (Dependency dependency : dependencies) {
MavenProject reactorMavenProjectDependency = projectIdMap.get(getProjectKey(dependency));
if (reactorMavenProjectDependency != null) {
if (DEBUG) {
log.info(" + add (maven) dependency project '"
+ reactorMavenProjectDependency.getId() + "' of project '"
+ projectRequest.mavenProject.getId() + "'");
}
queue.add(
new ProjectRequest(reactorMavenProjectDependency, false, true, projectRequest));
}
}
}
if (projectRequest.addRequires) {
dependencyClosure.dependencies(always -> List.of())//
Expand Down Expand Up @@ -248,6 +268,14 @@ public Result<ProjectDependencyGraph> build(MavenSession session) {
}
}

private String getProjectKey(Dependency project) {
return project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
}

private String getProjectKey(MavenProject project) {
return project.getGroupId() + ":" + project.getArtifactId() + ":" + project.getVersion();
}

private List<ModelProblem> toProblems(IStatus status, List<ModelProblem> problems) {
int severity = status.getSeverity();
if (severity == IStatus.OK || severity == IStatus.INFO) {
Expand Down

0 comments on commit 45cf05f

Please sign in to comment.