Skip to content

Commit

Permalink
Use the updated p2 metadata once the project is packed
Browse files Browse the repository at this point in the history
Currently Tycho always uses the INITIAL dependency metadata to compute
the preliminary target platform. As this metadata can change once the
project is packed (e.g. headers added / removed) this can lead to
problems in plugins that depend on the changed plugin because P2 sees
the updated metadata afterwards and fails.

This now distinguish both cases and used the SEED metadata if the
project was already packed.

Fix eclipse-tycho#3824
  • Loading branch information
laeubi committed May 31, 2024
1 parent 04f02e8 commit 02da10a
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,10 @@ public final int hashCode() {
return Objects.hash(getArtifactId(), getGroupId(), getVersion());
}

@Override
public String toString() {
return "ReactorProjectIdentities [GroupId=" + getGroupId() + ", ArtifactId=" + getArtifactId() + ", Version="
+ getVersion() + ", Basedir=" + getBasedir() + "]";
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -451,8 +451,7 @@ public Map<String, IP2Artifact> generateMetadata(MavenProject project, boolean g
PublisherOptions options = new PublisherOptions();
options.setGenerateDownloadStats(generateDownloadStatsProperty);
options.setGenerateChecksums(generateChecksums);
Map<String, IP2Artifact> generatedMetadata = generateMetadata(artifacts, options, targetDir);
return generatedMetadata;
return generateMetadata(artifacts, options, targetDir);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -561,9 +561,15 @@ private Map<IInstallableUnit, ReactorProjectIdentities> getPreliminaryReactorPro
Map<IInstallableUnit, Set<File>> duplicateReactorUIs = new HashMap<>();

for (ReactorProject project : reactorProjects) {
Set<IInstallableUnit> projectIUs = project.getDependencyMetadata(DependencyMetadataType.INITIAL);

if (projectIUs == null) {
File artifact = project.getArtifact();
Set<IInstallableUnit> projectIUs;
if (artifact != null && artifact.isFile()) {
//the project was already build, use the seed units as they include anything maybe updated by p2-metadata mojo
projectIUs = project.getDependencyMetadata(DependencyMetadataType.SEED);
} else {
projectIUs = project.getDependencyMetadata(DependencyMetadataType.INITIAL);
}
if (projectIUs == null || projectIUs.isEmpty()) {
continue;
}
for (IInstallableUnit iu : projectIUs) {
Expand Down
1 change: 1 addition & 0 deletions tycho-its/projects/tycho-ds-dependency/.mvn/maven.config
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
-Dtycho.localArtifacts=ignore

0 comments on commit 02da10a

Please sign in to comment.