From 61163a43d9ec78705cff398a65b6957cc1c8d8b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Mon, 4 Dec 2023 19:24:36 +0100 Subject: [PATCH] Add support for bnd classpath as a replacement for jars.extra.classpath --- .../core/RequiredPluginsClasspathContainer.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java index ccce3be142..db12a96c6c 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/RequiredPluginsClasspathContainer.java @@ -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 @@ -10,6 +10,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Christoph Läubrich - add bnd support *******************************************************************************/ package org.eclipse.pde.internal.core; @@ -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 { @@ -235,12 +237,21 @@ private void addBndClasspath(BundleDescription desc, Set adde try { Optional 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$