Update eclipse-pde-tp-support-droplets.patch to handle source bundles.

This commit is contained in:
Roland Grunberg 2016-07-07 16:22:46 -04:00
parent bd92304a71
commit b201a3b968
2 changed files with 70 additions and 11 deletions

View File

@ -1,13 +1,14 @@
From ea1cb133841d9b2d9cb6fb7d8cf8fdb0d1095347 Mon Sep 17 00:00:00 2001
From 72e58be8c9c5fbc6f6527318b4381a58cebfc120 Mon Sep 17 00:00:00 2001
From: Roland Grunberg <rgrunber@redhat.com>
Date: Thu, 7 Apr 2016 10:23:49 -0400
Subject: [PATCH] Support reading BundleInfo from p2 Droplets enabled
installations.
- Additionally support reading source bundles from p2 Droplets location
---
ui/org.eclipse.pde.core/META-INF/MANIFEST.MF | 3 ++-
.../src/org/eclipse/pde/internal/core/P2Utils.java | 9 ++++++++-
2 files changed, 10 insertions(+), 2 deletions(-)
ui/org.eclipse.pde.core/META-INF/MANIFEST.MF | 3 +-
.../src/org/eclipse/pde/internal/core/P2Utils.java | 48 +++++++++++++++++++---
2 files changed, 45 insertions(+), 6 deletions(-)
diff --git eclipse.pde.ui/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF eclipse.pde.ui/ui/org.eclipse.pde.core/META-INF/MANIFEST.MF
index 7c20994..ab702e3 100644
@ -22,25 +23,39 @@ index 7c20994..ab702e3 100644
+ org.eclipse.equinox.internal.simpleconfigurator.utils
Bundle-ActivationPolicy: lazy
diff --git eclipse.pde.ui/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/P2Utils.java eclipse.pde.ui/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/P2Utils.java
index fbd4b81..ce4589d 100644
index fbd4b81..55cd40e 100644
--- eclipse.pde.ui/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/P2Utils.java
+++ eclipse.pde.ui/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/P2Utils.java
@@ -17,6 +17,8 @@ import java.net.URL;
@@ -12,11 +12,12 @@
package org.eclipse.pde.internal.core;
import java.io.*;
-import java.net.MalformedURLException;
-import java.net.URL;
+import java.net.*;
+import java.nio.file.Paths;
import java.util.*;
+import java.net.URI;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.frameworkadmin.BundleInfo;
+import org.eclipse.equinox.internal.simpleconfigurator.utils.SimpleConfiguratorUtils;
import org.eclipse.equinox.p2.core.IProvisioningAgent;
import org.eclipse.equinox.p2.core.IProvisioningAgentProvider;
import org.eclipse.equinox.p2.engine.*;
@@ -108,7 +109,16 @@ public class P2Utils {
@@ -29,6 +30,7 @@ import org.eclipse.osgi.service.resolver.*;
import org.eclipse.pde.core.plugin.*;
import org.eclipse.pde.internal.build.BundleHelper;
import org.eclipse.pde.internal.core.plugin.PluginBase;
+import org.eclipse.pde.internal.core.util.ManifestUtils;
import org.osgi.framework.Constants;
/**
@@ -108,7 +110,16 @@ public class P2Utils {
try {
URL bundlesTxt = new URL(configurationArea.getProtocol(), configurationArea.getHost(), new File(configurationArea.getFile(), SimpleConfiguratorManipulator.BUNDLES_INFO_PATH).getAbsolutePath());
File home = basePath.toFile();
- BundleInfo bundles[] = getBundlesFromFile(bundlesTxt, home);
+ List<org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo> ibundleList = SimpleConfiguratorUtils.readConfiguration(bundlesTxt, home.toURI());
+ List<BundleInfo> bundleList = new ArrayList<BundleInfo>();
+ List<BundleInfo> bundleList = new ArrayList<>();
+ for (org.eclipse.equinox.internal.simpleconfigurator.utils.BundleInfo b : ibundleList) {
+ URI location = b.getLocation();
+ if (!location.isAbsolute() && b.getBaseLocation() != null)
@ -52,6 +67,47 @@ index fbd4b81..ce4589d 100644
if (bundles == null || bundles.length == 0) {
return null;
}
@@ -140,11 +151,38 @@ public class P2Utils {
try {
File home = basePath.toFile();
URL srcBundlesTxt = new URL(configurationArea.getProtocol(), configurationArea.getHost(), configurationArea.getFile().concat(SimpleConfiguratorManipulator.SOURCE_INFO_PATH));
+ final List<BundleInfo> allSrcBundles = new ArrayList<>();
+ try {
+ for (File infoFile : SimpleConfiguratorUtils.getInfoFiles()) {
+ File pluginsDir = Paths.get(infoFile.getParent(), "plugins").toFile(); //$NON-NLS-1$
+ File[] sourceJars = pluginsDir.listFiles((dir, name) -> {
+ return name.matches(".*\\.source_.*\\.jar$"); //$NON-NLS-1$
+ });
+ for (File sourceJar : sourceJars) {
+ Map<String, String> manifest;
+ try {
+ manifest = ManifestUtils.loadManifest(sourceJar);
+ final String bsn = manifest.get(Constants.BUNDLE_SYMBOLICNAME);
+ final String version = manifest.get(Constants.BUNDLE_VERSION);
+ BundleInfo info = new BundleInfo(bsn, version, sourceJar.toURI(), -1, false);
+ allSrcBundles.add(info);
+ } catch (CoreException e) {
+ // continue
+ }
+ }
+ }
+ } catch (URISyntaxException e) {
+ // continue
+ }
+
BundleInfo srcBundles[] = getBundlesFromFile(srcBundlesTxt, home);
- if (srcBundles == null || srcBundles.length == 0) {
+ if (srcBundles != null && srcBundles.length > 0) {
+ allSrcBundles.addAll(Arrays.asList(srcBundles));
+ }
+ if (allSrcBundles.size() == 0) {
return null;
}
- return srcBundles;
+ return allSrcBundles.toArray(new BundleInfo[0]);
} catch (MalformedURLException e) {
PDECore.log(e);
return null;
--
2.5.5
2.7.4

View File

@ -49,7 +49,7 @@ Epoch: 1
Summary: An open, extensible IDE
Name: eclipse
Version: %{eclipse_version}
Release: 2%{?dist}
Release: 3%{?dist}
License: EPL
URL: http://www.eclipse.org/
@ -1094,6 +1094,9 @@ fi
%{_libdir}/eclipse/plugins/org.eclipse.osgi.compatibility.state_*
%changelog
* Wed Jul 13 2016 Roland Grunberg <rgrunber@redhat.com> - 1:4.6.0-3
- Update eclipse-pde-tp-support-droplets.patch to handle source bundles.
* Thu Jun 16 2016 Alexander Kurtakov <akurtako@redhat.com> 1:4.6.0-2
- BR rhino and it's buildtime deps to unbreak build.