diff --git a/NOTICE b/NOTICE index 2e00cb5..1ad8924 100755 --- a/NOTICE +++ b/NOTICE @@ -16,3 +16,6 @@ Licensed under Apache License 2.0 Copyright 2001-2014 The Apache Software Foundation Available from https://commons.apache.org/ +Eclipse PDE pre-2020-09 +Licensed under the Eclipse Public License v2.0 +Available from https://git.eclipse.org/c/pde/eclipse.pde.ui.git/tree/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginPathFinder.java?id=11a09692b07fd57ba1e9e85f225edff215eb5a0f diff --git a/eclipse/bundles/org.openntf.xsp.sdk/META-INF/MANIFEST.MF b/eclipse/bundles/org.openntf.xsp.sdk/META-INF/MANIFEST.MF index cce1dec..23cc58b 100644 --- a/eclipse/bundles/org.openntf.xsp.sdk/META-INF/MANIFEST.MF +++ b/eclipse/bundles/org.openntf.xsp.sdk/META-INF/MANIFEST.MF @@ -25,6 +25,7 @@ Bundle-ManifestVersion: 2 Bundle-Vendor: OpenNTF Import-Package: org.apache.commons.lang, org.eclipse.core.resources, + org.eclipse.core.runtime, org.eclipse.core.variables, org.eclipse.debug.core, org.eclipse.debug.internal.core, @@ -33,16 +34,16 @@ Import-Package: org.apache.commons.lang, org.eclipse.jdt.internal.ui.wizards, org.eclipse.jdt.launching, org.eclipse.jdt.ui.wizards, + org.eclipse.jface, org.eclipse.jface.preference, org.eclipse.jface.text, + org.eclipse.pde.launching, org.eclipse.swt, + org.eclipse.ui, org.eclipse.ui.actions, org.eclipse.ui.forms, org.eclipse.ui.forms.widgets, - org.eclipse.ui, org.eclipse.ui.plugin, - org.eclipse.jface, - org.eclipse.pde.launching, - org.eclipse.core.runtime + org.eclipse.update.configurator diff --git a/eclipse/bundles/org.openntf.xsp.sdk/src/com/ibm/domino/osgi/debug/launch/AbstractDominoLaunchConfiguration.java b/eclipse/bundles/org.openntf.xsp.sdk/src/com/ibm/domino/osgi/debug/launch/AbstractDominoLaunchConfiguration.java index 09a4bdc..ad29784 100644 --- a/eclipse/bundles/org.openntf.xsp.sdk/src/com/ibm/domino/osgi/debug/launch/AbstractDominoLaunchConfiguration.java +++ b/eclipse/bundles/org.openntf.xsp.sdk/src/com/ibm/domino/osgi/debug/launch/AbstractDominoLaunchConfiguration.java @@ -26,6 +26,7 @@ import java.util.Arrays; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.LinkedHashSet; import java.util.Map; import java.util.Properties; @@ -33,11 +34,14 @@ import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.ILog; +import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor; +import org.eclipse.core.runtime.Path; +import org.eclipse.core.runtime.Platform; import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubProgressMonitor; +import org.eclipse.core.runtime.SubMonitor; import org.eclipse.debug.core.DebugPlugin; import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; @@ -51,10 +55,10 @@ import org.eclipse.ui.PlatformUI; import org.openntf.xsp.sdk.Activator; import org.openntf.xsp.sdk.commons.osgi.LaunchUtil; -import org.openntf.xsp.sdk.exceptions.AbortException; import org.openntf.xsp.sdk.commons.platform.INotesDominoPlatform; import org.openntf.xsp.sdk.commons.utils.CommonUtils; import org.openntf.xsp.sdk.commons.utils.StringUtil; +import org.openntf.xsp.sdk.exceptions.AbortException; /** * @author dtaieb @@ -141,7 +145,7 @@ private void doLaunch(ILaunchConfiguration configuration, String mode, ILaunch l // Call preLaunchCheck to fill the bundleMap try { - preLaunchCheck(configuration, launch, new SubProgressMonitor(monitor, 2)); + preLaunchCheck(configuration, launch, SubMonitor.convert(monitor, 2)); } catch (CoreException e) { if (e.getStatus().getSeverity() == IStatus.CANCEL) { monitor.setCanceled(true); @@ -326,7 +330,7 @@ private String getBundleUrl(IPluginModelBase model, boolean bIncludeReference) { private Map computeTargetModels(Map workspacePlugins, String eclipseLocation) { Map modelMap = new HashMap(); - URL[] pluginPaths = PluginPathFinder.getPluginPaths(eclipseLocation, false); + URL[] pluginPaths = PluginPathFinder.scanLocations(getSites(eclipseLocation, false)); PDEState pdeState; // The signature for PDEState's constructor changed in Eclipse 2019-03 // https://github.com/eclipse/eclipse.pde.ui/commit/3db2f1e50aa7ae5efc0e07a1f26eecedd80a7159#diff-a56311895a435ece21aa9ef829607884 @@ -401,4 +405,89 @@ private Collection computeOsgiBundles(INotesDominoPlatform ndPlatform, S public abstract String[] getProfiles(); public abstract String getName(); + // ******************************************************************************* + // * Code from older PluginPathFinder build for patched compatibility + // ******************************************************************************* + + /** + * + * @param platformHome + * @param features false for plugin sites, true for feature sites + * @return array of ".../plugins" or ".../features" Files + */ + private static File[] getSites(String platformHome, boolean features) { + HashSet sites = new HashSet<>(); + File file = new File(platformHome, features ? "features" : "plugins"); //$NON-NLS-1$ //$NON-NLS-2$ + if (!features && !file.exists()) { + file = new File(platformHome); + } + if (file.exists()) { + sites.add(file); + } + + File[] linkFiles = new File(platformHome + IPath.SEPARATOR + "links").listFiles(); //$NON-NLS-1$ + if (linkFiles != null) { + for (File linkFile : linkFiles) { + String path = getSitePath(platformHome, linkFile, features); + if (path != null) { + sites.add(new File(path)); + } + } + } + + // If there is no features/plugins folder and no linked files, try the home location + if (sites.isEmpty()) { + file = new File(platformHome); + if (file.exists()) { + sites.add(file); + } + } + + return sites.toArray(new File[sites.size()]); + } + + public static boolean isDevLaunchMode() { + if (Boolean.getBoolean("eclipse.pde.launch")) { //$NON-NLS-1$ + return true; + } + String[] args = Platform.getApplicationArgs(); + for (String arg : args) { + if (arg.equals("-pdelaunch")) { //$NON-NLS-1$ + return true; + } + } + return false; + } + + /** + * + * @param platformHome + * @param linkFile + * @param features false for plugins, true for features + * @return path of plugins or features directory of an extension site + */ + private static String getSitePath(String platformHome, File linkFile, boolean features) { + String prefix = new Path(platformHome).removeLastSegments(1).toString(); + Properties properties = new Properties(); + try (FileInputStream fis = new FileInputStream(linkFile)) { + properties.load(fis); + String path = properties.getProperty("path"); //$NON-NLS-1$ + if (path != null) { + if (!new Path(path).isAbsolute()) { + path = prefix + IPath.SEPARATOR + path; + } + path += IPath.SEPARATOR + "eclipse" + IPath.SEPARATOR; //$NON-NLS-1$ + if (features) { + path += "features"; //$NON-NLS-1$ + } else { + path += "plugins"; //$NON-NLS-1$ + } + if (new File(path).exists()) { + return path; + } + } + } catch (IOException e) { + } + return null; + } }