diff --git a/p2-maven-plugin/pom.xml b/p2-maven-plugin/pom.xml
index 303f5df95e..066715e30a 100644
--- a/p2-maven-plugin/pom.xml
+++ b/p2-maven-plugin/pom.xml
@@ -42,7 +42,7 @@
org.eclipse.platform
org.eclipse.equinox.p2.director
- 2.6.100
+ 2.6.200
org.eclipse.platform
diff --git a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java
index 885964014e..2c9779fd2f 100644
--- a/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java
+++ b/p2-maven-plugin/src/main/java/org/eclipse/tycho/p2maven/InstallableUnitSlicer.java
@@ -57,7 +57,7 @@ public IQueryResult computeDependencies(Collection avaiableIUs) throws CoreException {
NullProgressMonitor monitor = new NullProgressMonitor();
PermissiveSlicer slicer = new TychoSlicer(avaiableIUs);
- IQueryable slice = slicer.slice(rootIus.toArray(IInstallableUnit[]::new), monitor);
+ IQueryable slice = slicer.slice(rootIus, monitor);
IStatus sliceStatus = slicer.getStatus();
if (sliceStatus.matches(IStatus.ERROR)) {
throw new CoreException(sliceStatus);
diff --git a/tycho-build/pom.xml b/tycho-build/pom.xml
index 8bad5fd366..db342ca291 100644
--- a/tycho-build/pom.xml
+++ b/tycho-build/pom.xml
@@ -65,7 +65,7 @@
org.eclipse.platform
org.eclipse.equinox.p2.director
- 2.6.100
+ 2.6.200
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractSlicerResolutionStrategy.java b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractSlicerResolutionStrategy.java
index 25631f6cbf..f2c74192d2 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractSlicerResolutionStrategy.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2resolver/AbstractSlicerResolutionStrategy.java
@@ -42,7 +42,6 @@
import org.eclipse.equinox.p2.metadata.expression.IExpression;
import org.eclipse.equinox.p2.metadata.expression.IMatchExpression;
import org.eclipse.equinox.p2.publisher.actions.JREAction;
-import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.tycho.core.shared.MavenLogger;
@@ -96,22 +95,18 @@ protected final IQueryable slice(Map propertie
}
QueryableCollection baseIUCollection = new QueryableCollection(availableIUs);
- Slicer slicer = newSlicer(new IQueryable() {
+ Slicer slicer = newSlicer((query, monitor1) -> {
- @Override
- public IQueryResult query(IQuery query, IProgressMonitor monitor) {
-
- IQueryResult queryResult = baseIUCollection.query(query, monitor);
- if (queryResult.isEmpty()) {
- IQueryable additionalUnitStore = data.getAdditionalUnitStore();
- if (additionalUnitStore != null) {
- return additionalUnitStore.query(query, monitor);
- }
+ IQueryResult queryResult = baseIUCollection.query(query, monitor1);
+ if (queryResult.isEmpty()) {
+ IQueryable additionalUnitStore = data.getAdditionalUnitStore();
+ if (additionalUnitStore != null) {
+ return additionalUnitStore.query(query, monitor1);
}
- return queryResult;
}
+ return queryResult;
}, properties);
- IQueryable slice = slicer.slice(seedIUs.toArray(EMPTY_IU_ARRAY), monitor);
+ IQueryable slice = slicer.slice(seedIUs, monitor);
MultiStatus slicerStatus = slicer.getStatus();
if (slice == null || isSlicerError(slicerStatus)) {
throw new ResolverException(StatusTool.toLogMessage(slicerStatus), properties.toString(),
@@ -175,8 +170,7 @@ protected IInstallableUnit createUnitProviding(String name, Collection matches = propertiesMatch.getMatches();
Map properties = new HashMap<>();
Object p = matches.getParameters()[1];
- if (p instanceof IExpression) {
- IExpression expression = (IExpression) p;
+ if (p instanceof IExpression expression) {
IExpression operand = ExpressionUtil.getOperand(expression);
IExpression[] operands = ExpressionUtil.getOperands(operand);
for (IExpression eq : operands) {
@@ -222,8 +216,7 @@ private static IRequirement createStrictRequirementTo(IInstallableUnit unit) {
int min = 1;
int max = Integer.MAX_VALUE;
boolean greedy = true;
- IRequirement requirement = MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(),
- strictRange, unit.getFilter(), min, max, greedy);
- return requirement;
+ return MetadataFactory.createRequirement(IInstallableUnit.NAMESPACE_IU_ID, unit.getId(), strictRange,
+ unit.getFilter(), min, max, greedy);
}
}
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/MirrorApplicationServiceImpl.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/MirrorApplicationServiceImpl.java
index a715ef23a1..fe7cf9b8c3 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/MirrorApplicationServiceImpl.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/MirrorApplicationServiceImpl.java
@@ -217,10 +217,7 @@ public void recreateArtifactRepository(DestinationRepositoryDescriptor destinati
artifactsXz.delete();
}
descriptor.setLocation(location.toURI());
- //TODO this is to trigger loading of the osgi services and we can not pass the agent directly see
- // https://github.com/eclipse-equinox/p2/issues/151
- agent.getService(IArtifactRepositoryManager.class);
- RecreateRepositoryApplication application = new RecreateRepositoryApplication();
+ RecreateRepositoryApplication application = new RecreateRepositoryApplication(agent);
application.setArtifactRepository(descriptor.getRepoLocation());
try {
application.run(new NullProgressMonitor());
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/TychoMirrorApplication.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/TychoMirrorApplication.java
index 9b3320b1c5..7c371baf18 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/TychoMirrorApplication.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/TychoMirrorApplication.java
@@ -162,7 +162,7 @@ private boolean matchesSelectionContext(IMatchExpression filte
}
@Override
- public IQueryable slice(IInstallableUnit[] ius, IProgressMonitor monitor) {
+ public IQueryable slice(Collection ius, IProgressMonitor monitor) {
IQueryable slice = super.slice(ius, monitor);
if (includeAllSource && targetPlatform != null) {
Set collected = slice.query(QueryUtil.ALL_UNITS, null).toSet();
diff --git a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/MirrorApplication.java b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/MirrorApplication.java
index 2e7879dae9..6983b42940 100644
--- a/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/MirrorApplication.java
+++ b/tycho-core/src/main/java/org/eclipse/tycho/p2tools/copiedfromp2/MirrorApplication.java
@@ -280,7 +280,7 @@ protected Mirroring getMirroring(Collection ius, IProgressMoni
* Collect all artifacts from the IUs that should be mirrored
*
* @param ius
- * the IUs that are selected for mirroring
+ * the IUs that are selected for mirroring
* @return a (modifiable) list of {@link IArtifactKey}s that must be mirrored
*/
protected List collectArtifactKeys(Collection ius, IProgressMonitor monitor)
@@ -315,21 +315,20 @@ private void mirrorMetadata(Collection units, IProgressMonitor
* Collect all IUS from the slice that should be mirrored
*
* @param slice
- * the slice for mirroring
+ * the slice for mirroring
* @return a (modifiable) set of {@link IInstallableUnit}s that must be mirrored
* @throws ProvisionException
*/
protected Set collectUnits(IQueryable slice, IProgressMonitor monitor)
throws ProvisionException {
IQueryResult allIUs = slice.query(QueryUtil.createIUAnyQuery(), monitor);
- Set units = allIUs.toSet();
- return units;
+ return allIUs.toSet();
}
/*
- * Ensure all mandatory parameters have been set. Throw an exception if there are any missing. We
- * don't require the user to specify the artifact repository here, we will default to the ones
- * already registered in the manager. (callers are free to add more if they wish)
+ * Ensure all mandatory parameters have been set. Throw an exception if there are any missing.
+ * We don't require the user to specify the artifact repository here, we will default to the
+ * ones already registered in the manager. (callers are free to add more if they wish)
*/
private void validate() throws ProvisionException {
if (sourceRepositories.isEmpty())
@@ -362,7 +361,7 @@ private void initializeIUs() throws ProvisionException {
while (queryResult.hasNext())
sourceIUs.add(queryResult.next());
/* old metadata mirroring app did not throw an exception here */
- if (sourceIUs.size() == 0 && destinationMetadataRepository != null && metadataOrArtifacts == null)
+ if (sourceIUs.isEmpty() && destinationMetadataRepository != null && metadataOrArtifacts == null)
throw new ProvisionException(Messages.MirrorApplication_no_IUs);
}
}
@@ -443,8 +442,7 @@ private IQueryable slice(IProgressMonitor monitor) throws Prov
return performResolution(monitor);
Slicer slicer = createSlicer(slicingOptions);
- IQueryable slice = slicer.slice(sourceIUs.toArray(new IInstallableUnit[sourceIUs.size()]),
- monitor);
+ IQueryable slice = slicer.slice(sourceIUs, monitor);
if (slice != null && slicingOptions.latestVersionOnly()) {
IQueryResult queryResult = slice.query(QueryUtil.createLatestIUQuery(), monitor);
@@ -460,10 +458,9 @@ private IQueryable slice(IProgressMonitor monitor) throws Prov
}
protected Slicer createSlicer(SlicingOptions options) {
- PermissiveSlicer slicer = new PermissiveSlicer(getCompositeMetadataRepository(), options.getFilter(),
+ return new PermissiveSlicer(getCompositeMetadataRepository(), options.getFilter(),
options.includeOptionalDependencies(), options.isEverythingGreedy(), options.forceFilterTo(),
options.considerStrictDependencyOnly(), options.followOnlyFilteredRequirements());
- return slicer;
}
public void setEnvironments(List environments) {