Skip to content

Commit

Permalink
Adapt to P2 enhancements in Eclipse 2023-12
Browse files Browse the repository at this point in the history
This also reverts the temporary changes of PublishProductToolImpl made
in eclipse-tycho#2929, which are obsolete
now that the new P2 version has support for names of update-sites built
in.
  • Loading branch information
HannesWell committed Dec 9, 2023
1 parent cd3d5f0 commit ae36610
Show file tree
Hide file tree
Showing 21 changed files with 76 additions and 329 deletions.
18 changes: 9 additions & 9 deletions p2-maven-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.8.100</version>
<version>1.9.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.director</artifactId>
<version>2.6.100</version>
<version>2.6.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.engine</artifactId>
<version>2.8.100</version>
<version>2.9.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata</artifactId>
<version>2.7.100</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -66,7 +66,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher.eclipse</artifactId>
<version>1.5.100</version>
<version>1.5.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand Down Expand Up @@ -97,12 +97,12 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId>
<version>1.5.100</version>
<version>1.5.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.updatesite</artifactId>
<version>1.3.100</version>
<version>1.3.200</version>
</dependency>
<!-- used API packages from Tycho -->
<dependency>
Expand Down Expand Up @@ -144,12 +144,12 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.director.app</artifactId>
<version>1.3.100</version>
<version>1.3.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.repository.tools</artifactId>
<version>2.4.100</version>
<version>2.4.200</version>
</dependency>
<!-- Equinox -->
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public IQueryResult<IInstallableUnit> computeDependencies(Collection<IInstallabl
IQueryable<IInstallableUnit> avaiableIUs) throws CoreException {
NullProgressMonitor monitor = new NullProgressMonitor();
PermissiveSlicer slicer = new TychoSlicer(avaiableIUs);
IQueryable<IInstallableUnit> slice = slicer.slice(rootIus.toArray(IInstallableUnit[]::new), monitor);
IQueryable<IInstallableUnit> slice = slicer.slice(rootIus, monitor);
IStatus sliceStatus = slicer.getStatus();
if (sliceStatus.matches(IStatus.ERROR)) {
throw new CoreException(sliceStatus);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,8 @@ public Iterator<R> iterator() {
return stream().iterator();
}

private Stream<R> stream() {
@Override
public Stream<R> stream() {
return resultList.stream().flatMap(r -> StreamSupport
.stream(Spliterators.spliteratorUnknownSize(r.iterator(), Spliterator.ORDERED), false));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,7 @@ protected void processPlugin(Attributes attributes) {
if (os != null || ws != null || arch != null) {
entry.setEnvironment(os, ws, arch, null);
}

if (isFragment) {
fragments.add(entry);
} else {
plugins.add(entry);
}
plugins.add(entry);
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.repository</artifactId>
<version>2.7.100</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand Down
4 changes: 2 additions & 2 deletions tycho-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata</artifactId>
<version>2.7.100</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.8.100</version>
<version>1.9.0</version>
</dependency>
</dependencies>
<build>
Expand Down
12 changes: 6 additions & 6 deletions tycho-build/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -59,26 +59,26 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher</artifactId>
<version>1.8.100</version>
<version>1.9.0</version>
</dependency>

<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.director</artifactId>
<version>2.6.100</version>
<version>2.6.200</version>
</dependency>

<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.engine</artifactId>
<version>2.8.100</version>
<version>2.9.0</version>
</dependency>


<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata</artifactId>
<version>2.7.100</version>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.eclipse.platform</groupId>
Expand All @@ -95,7 +95,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.publisher.eclipse</artifactId>
<version>1.5.100</version>
<version>1.5.200</version>
</dependency>


Expand Down Expand Up @@ -124,7 +124,7 @@
<dependency>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.equinox.p2.metadata.repository</artifactId>
<version>1.5.100</version>
<version>1.5.200</version>
</dependency>
<dependency>
<groupId>org.eclipse.tycho</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ public void addReferences(Collection<? extends IRepositoryReference> references)
// not supported
}

@Override
public boolean removeReferences(Collection<? extends IRepositoryReference> references) {
// not supported
return false;
}

@Override
public Collection<IRepositoryReference> getReferences() {
// not supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,21 +24,23 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.director.QueryableArray;
import org.eclipse.equinox.p2.core.IPool;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.repository.IRepositoryReference;
import org.eclipse.equinox.p2.repository.IRunnableWithProgress;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;

public class ImmutableInMemoryMetadataRepository implements IMetadataRepository {

private final QueryableCollection units;
private final IQueryable<IInstallableUnit> units;

public ImmutableInMemoryMetadataRepository(Set<IInstallableUnit> units) {
this.units = new QueryableCollection(units);
this.units = new QueryableArray(units);
}

@Override
Expand Down Expand Up @@ -142,6 +144,11 @@ public void addReferences(Collection<? extends IRepositoryReference> references)
throw new UnsupportedOperationException();
}

@Override
public boolean removeReferences(Collection<? extends IRepositoryReference> references) {
throw new UnsupportedOperationException();
}

@Override
public boolean removeInstallableUnits(Collection<IInstallableUnit> installableUnits) {
throw new UnsupportedOperationException();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -67,26 +67,16 @@ public String getVersion() {
}

@Override
public List<IVersionedId> getBundles(boolean includeFragments) {
if (includeFragments == false) {
// currently not needed -> omitted for simplicity
throw new UnsupportedOperationException();
}
public List<IVersionedId> getBundles() {
if (getProductContentType() == ProductContentType.FEATURES) {
// don't expand versions if bundles are not included in the product
// TODO why is this method called anyway?
return defaults.getBundles(includeFragments);
return defaults.getBundles();
}

return expandedBundles;
}

@Override
public List<IVersionedId> getFragments() {
// currently not needed -> omitted for simplicity
throw new UnsupportedOperationException();
}

@Override
public List<IVersionedId> getFeatures() {
return getFeatures(INCLUDED_FEATURES);
Expand All @@ -111,7 +101,7 @@ private void expandVersions() {
ProductVersionExpansionRun resolver = new ProductVersionExpansionRun(targetPlatform, getLocation());
if (contentType != ProductContentType.FEATURES) {
expandedBundles = resolver.resolveReferences("plugin", ArtifactType.TYPE_ECLIPSE_PLUGIN,
defaults.getBundles(true));
defaults.getBundles());
}
if (contentType != ProductContentType.BUNDLES) {
expandedFeatures = resolver.resolveReferences("feature", ArtifactType.TYPE_ECLIPSE_FEATURE,
Expand Down Expand Up @@ -143,9 +133,9 @@ private Map<String, String> expandVariables(Map<String, String> originalMap) {
// delegating methods

@Override
public boolean hasBundles(boolean includeFragments) {
public boolean hasBundles() {
// don't need to expand versions for this check
return defaults.hasBundles(includeFragments);
return defaults.hasBundles();
}

@Override
Expand Down
Loading

0 comments on commit ae36610

Please sign in to comment.