Skip to content

Commit 5721bf9

Browse files
Add getAdditionalEntries to IClasspathContributor
Adds a new method to allow classpath contributor to append additional classpath entries at the end of the calculation process.
1 parent 92fa880 commit 5721bf9

4 files changed

Lines changed: 57 additions & 2 deletions

File tree

org.eclipse.pde.doc.user/META-INF/MANIFEST.MF

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
22
Bundle-ManifestVersion: 2
33
Bundle-Name: %pluginName
44
Bundle-SymbolicName: org.eclipse.pde.doc.user; singleton:=true
5-
Bundle-Version: 3.17.200.qualifier
5+
Bundle-Version: 3.17.300.qualifier
66
Bundle-Vendor: %providerName
77
Bundle-Localization: plugin
88
Require-Bundle: org.eclipse.help;bundle-version="[3.2.0,4.0.0)"

org.eclipse.pde.doc.user/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
<version>4.37.0-SNAPSHOT</version>
1818
</parent>
1919
<artifactId>org.eclipse.pde.doc.user</artifactId>
20-
<version>3.17.200-SNAPSHOT</version>
20+
<version>3.17.300-SNAPSHOT</version>
2121
<packaging>eclipse-plugin</packaging>
2222

2323
<properties>
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/*******************************************************************************
2+
* Copyright (c) 2025 Vector Informatik GmbH and others.
3+
*
4+
* This program and the accompanying materials
5+
* are made available under the terms of the Eclipse Public License 2.0
6+
* which accompanies this distribution, and is available at
7+
* https://www.eclipse.org/legal/epl-2.0/
8+
*
9+
* SPDX-License-Identifier: EPL-2.0
10+
*
11+
*******************************************************************************/
12+
package org.eclipse.pde.core;
13+
14+
import java.util.stream.Stream;
15+
16+
import org.eclipse.jdt.core.IClasspathEntry;
17+
import org.eclipse.osgi.service.resolver.BundleDescription;
18+
import org.eclipse.pde.core.plugin.PluginRegistry;
19+
import org.osgi.resource.Resource;
20+
21+
/**
22+
* Extension interface for {@link org.eclipse.pde.core.IClasspathContributor}.
23+
* <p>
24+
* This interface allows adding classpath entries after the classpath has been
25+
* calculated.
26+
* </p>
27+
*
28+
* @since 3.21
29+
*/
30+
public interface IClasspathContributor2 extends IClasspathContributor {
31+
32+
/**
33+
* Get any additional classpath entries to add to a project when its
34+
* classpath is first computed. The provided {@link BundleDescription}
35+
* describes the plug-in project that the classpath is being computed for.
36+
* The entries are added at the end of the calculation process. Additional
37+
* PDE model information can be obtained using
38+
* {@link PluginRegistry#findModel(Resource)}.
39+
*
40+
* @param project
41+
* the bundle descriptor for the plug-in project having its
42+
* classpath computed
43+
* @return additional classpath entries to add to the project at the end of
44+
* the classpath calculation, possibly empty, must not be
45+
* <code>null</code>
46+
* @since 3.21
47+
*/
48+
Stream<IClasspathEntry> getAdditionalEntries(BundleDescription project);
49+
}

ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@
5454
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
5555
import org.eclipse.osgi.service.resolver.StateHelper;
5656
import org.eclipse.pde.core.IClasspathContributor;
57+
import org.eclipse.pde.core.IClasspathContributor2;
5758
import org.eclipse.pde.core.build.IBuild;
5859
import org.eclipse.pde.core.build.IBuildEntry;
5960
import org.eclipse.pde.core.plugin.IPluginModelBase;
@@ -278,7 +279,12 @@ private List<IClasspathEntry> computePluginEntriesByModel() {
278279
addJunit5RuntimeDependencies(added, entries);
279280
addImplicitDependencies(desc, added, entries);
280281

282+
// Add any additional library entries contributed via classpath
283+
// contributor
284+
entries.addAll(getClasspathContributors().filter(IClasspathContributor2.class::isInstance)
285+
.map(IClasspathContributor2.class::cast).flatMap(cc -> cc.getAdditionalEntries(desc)).toList());
281286
} catch (CoreException e) {
287+
282288
}
283289
return entries;
284290
}

0 commit comments

Comments
 (0)