Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for bnd classpath as a replacement for jars.extra.classpath #979

Merged
merged 1 commit into from
Dec 4, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2000, 2018 IBM Corporation and others.
* Copyright (c) 2000, 2023 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
Expand All @@ -10,6 +10,7 @@
*
* Contributors:
* IBM Corporation - initial API and implementation
* Christoph Läubrich - add bnd support
*******************************************************************************/
package org.eclipse.pde.internal.core;

Expand Down Expand Up @@ -60,6 +61,7 @@

import aQute.bnd.build.Container;
import aQute.bnd.build.Project;
import aQute.bnd.osgi.Constants;

public class RequiredPluginsClasspathContainer extends PDEClasspathContainer implements IClasspathContainer {

Expand Down Expand Up @@ -235,12 +237,21 @@ private void addBndClasspath(BundleDescription desc, Set<BundleDescription> adde
try {
Optional<Project> bndProject = BndProjectManager.getBndProject(project);
if (bndProject.isPresent()) {
for (Container container : bndProject.get().getBuildpath()) {
Project bnd = bndProject.get();
for (Container container : bnd.getBuildpath()) {
addExtraModel(desc, added, entries, container.getBundleSymbolicName());
}
for (Container container : bndProject.get().getTestpath()) {
for (Container container : bnd.getTestpath()) {
addExtraModel(desc, added, entries, container.getBundleSymbolicName());
}
String cp = bnd.getProperty(Constants.CLASSPATH);
if (cp != null) {
String[] tokens = cp.split(","); //$NON-NLS-1$
for (int i = 0; i < tokens.length; i++) {
tokens[i] = tokens[i].trim();
}
addExtraClasspathEntries(entries, tokens);
}
}
} catch (Exception e) {
PDECore.logException(e, "Can't set classpath from bnd!"); //$NON-NLS-1$
Expand Down
Loading