From 9f033bfbd9005c173c6370099d3aa82172d4164c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Tue, 5 Dec 2023 06:13:55 +0100 Subject: [PATCH] Gather extra IUs from all reactor projects --- .../tycho/p2resolver/TargetPlatformFactoryImpl.java | 7 +++++-- .../tycho/p2resolver/TargetPlatformFactoryTest.java | 5 +++-- .../org/eclipse/tycho/test/util/ReactorProjectStub.java | 4 ++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java index 82c410df41..34ac10e159 100644 --- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java +++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryImpl.java @@ -33,6 +33,7 @@ import java.util.List; import java.util.Map; import java.util.Map.Entry; +import java.util.Objects; import java.util.Optional; import java.util.Set; @@ -264,8 +265,10 @@ public P2TargetPlatform createTargetPlatform(TargetPlatformConfigurationStub tpC return Optional.empty(); }).ifPresent(externalUIs::add); } - //add p2.inf items... - gatherP2InfUnits(project, externalUIs); + //add p2.inf extra units from all projects... + for (ReactorProject reactorProject : Objects.requireNonNullElse(reactorProjects, List. of())) { + gatherP2InfUnits(reactorProject, externalUIs); + } Map reactorProjectUIs = getPreliminaryReactorProjectUIs( reactorProjects); diff --git a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java index 41867661a3..1fa142563c 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/p2resolver/TargetPlatformFactoryTest.java @@ -44,8 +44,9 @@ import org.eclipse.equinox.p2.metadata.IVersionedId; import org.eclipse.tycho.ArtifactType; import org.eclipse.tycho.DefaultArtifactKey; -import org.eclipse.tycho.IRawArtifactFileProvider; import org.eclipse.tycho.IDependencyMetadata.DependencyMetadataType; +import org.eclipse.tycho.IRawArtifactFileProvider; +import org.eclipse.tycho.PackagingType; import org.eclipse.tycho.ReactorProject; import org.eclipse.tycho.ReactorProjectIdentities; import org.eclipse.tycho.TargetEnvironment; @@ -328,12 +329,12 @@ private String[] asArrayUnlessNull(String string) { private ReactorProject createReactorProject(String artifactId, String[] primaryUnitIds, String[] secondaryUnitIds) { File basedir = new File("tychotestdummy"); // not dereferenced in the code under test, so the path doesn't need to exist ReactorProjectStub result = new ReactorProjectStub(basedir, artifactId); + result.setPackagingType(PackagingType.TYPE_ECLIPSE_PLUGIN); DependencyMetadata dependencyMetadata = new DependencyMetadata(); dependencyMetadata.setDependencyMetadata(DependencyMetadataType.SEED, createUnits(primaryUnitIds)); dependencyMetadata.setDependencyMetadata(DependencyMetadataType.RESOLVE, createUnits(secondaryUnitIds)); result.setDependencyMetadata(dependencyMetadata); - return result; } diff --git a/tycho-core/src/test/java/org/eclipse/tycho/test/util/ReactorProjectStub.java b/tycho-core/src/test/java/org/eclipse/tycho/test/util/ReactorProjectStub.java index e293d4a95e..61a3bf97f3 100644 --- a/tycho-core/src/test/java/org/eclipse/tycho/test/util/ReactorProjectStub.java +++ b/tycho-core/src/test/java/org/eclipse/tycho/test/util/ReactorProjectStub.java @@ -98,6 +98,10 @@ public String getPackaging() { return unlessNull(packagingType); } + public void setPackagingType(String packagingType) { + this.packagingType = packagingType; + } + @Override public Set getDependencyMetadata(DependencyMetadataType type) { return switch (type) {