Skip to content

Commit

Permalink
Add support for bnd classpath as a replacement for jars.extra.classpath
Browse files Browse the repository at this point in the history
  • Loading branch information
laeubi committed Dec 4, 2023
1 parent 67c0453 commit eb34cab
Showing 1 changed file with 14 additions and 3 deletions.
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

0 comments on commit eb34cab

Please sign in to comment.