|
 |
4c9427 |
From 08a04cbff4fc6393ec56c61fff7f859d1d707cd6 Mon Sep 17 00:00:00 2001
|
|
 |
4c9427 |
From: Roland Grunberg <rgrunber@redhat.com>
|
|
 |
4c9427 |
Date: Fri, 26 Jun 2015 15:34:12 -0400
|
|
 |
4c9427 |
Subject: [PATCH] Respect compatibility with Java 7.
|
|
 |
4c9427 |
|
|
 |
4c9427 |
---
|
|
 |
4c9427 |
org.fedoraproject.p2/META-INF/MANIFEST.MF | 2 +-
|
|
 |
4c9427 |
.../p2/installer/impl/DefaultEclipseInstaller.java | 58 ++++++++++++++++------
|
|
 |
4c9427 |
xmvn-p2-installer-plugin/pom.xml | 4 +-
|
|
 |
4c9427 |
3 files changed, 45 insertions(+), 19 deletions(-)
|
|
 |
4c9427 |
|
|
 |
4c9427 |
diff --git a/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF b/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF
|
|
 |
4c9427 |
index 4319079..2967c22 100644
|
|
 |
4c9427 |
--- a/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF
|
|
 |
4c9427 |
+++ b/fedoraproject-p2/org.fedoraproject.p2/META-INF/MANIFEST.MF
|
|
 |
4c9427 |
@@ -4,7 +4,7 @@ Bundle-Name: Fedora Project P2 Repository
|
|
 |
4c9427 |
Bundle-SymbolicName: org.fedoraproject.p2;singleton:=true
|
|
 |
4c9427 |
Bundle-Version: 0.0.1.qualifier
|
|
 |
4c9427 |
Bundle-Vendor: Fedora
|
|
 |
4c9427 |
-Bundle-RequiredExecutionEnvironment: JavaSE-1.8
|
|
 |
4c9427 |
+Bundle-RequiredExecutionEnvironment: JavaSE-1.7
|
|
 |
4c9427 |
Require-Bundle: org.eclipse.core.runtime,
|
|
 |
4c9427 |
org.eclipse.equinox.p2.metadata,
|
|
 |
4c9427 |
org.eclipse.equinox.p2.repository,
|
|
 |
4c9427 |
diff --git a/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java b/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java
|
|
 |
4c9427 |
index 35c6657..77da1f5 100644
|
|
 |
4c9427 |
--- a/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java
|
|
 |
4c9427 |
+++ b/fedoraproject-p2/org.fedoraproject.p2/src/org/fedoraproject/p2/installer/impl/DefaultEclipseInstaller.java
|
|
 |
4c9427 |
@@ -26,11 +26,11 @@ import java.util.List;
|
|
 |
4c9427 |
import java.util.Map;
|
|
 |
4c9427 |
import java.util.Map.Entry;
|
|
 |
4c9427 |
import java.util.Set;
|
|
 |
4c9427 |
-import java.util.stream.Collectors;
|
|
 |
4c9427 |
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.metadata.IArtifactKey;
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.metadata.IInstallableUnit;
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.metadata.IInstallableUnitFragment;
|
|
 |
4c9427 |
+import org.eclipse.equinox.p2.metadata.IProvidedCapability;
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.metadata.IRequirement;
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.query.IQuery;
|
|
 |
4c9427 |
import org.eclipse.equinox.p2.query.QueryUtil;
|
|
 |
4c9427 |
@@ -89,13 +89,27 @@ public class DefaultEclipseInstaller implements EclipseInstaller {
|
|
 |
4c9427 |
Director.publish(reactorRepo, plugins, features);
|
|
 |
4c9427 |
reactor = reactorRepo.getAllUnits();
|
|
 |
4c9427 |
// Remove all host localization fragments
|
|
 |
4c9427 |
- reactor.removeAll(reactor.stream()
|
|
 |
4c9427 |
- .filter(u -> u.getId().endsWith("translated_host_properties"))
|
|
 |
4c9427 |
- .collect(Collectors.toSet()));
|
|
 |
4c9427 |
- Set<Path> reactorPaths = reactor.stream().map(u -> P2Utils.getPath(u)).collect(Collectors.toSet());
|
|
 |
4c9427 |
- request.getArtifacts().stream().filter(a -> !reactorPaths.contains(a.getPath()))
|
|
 |
4c9427 |
- .forEach(a -> logger.error("Not a valid {}: {}", a.isFeature() ? "feature" : "plugin", a.getPath()));
|
|
 |
4c9427 |
- if (reactor.stream().collect(Collectors.summingInt(u -> u.getArtifacts().size()))
|
|
 |
4c9427 |
+ Set<IInstallableUnit> hostLocalizationFragments = new LinkedHashSet<>();
|
|
 |
4c9427 |
+ for (IInstallableUnit u : reactor) {
|
|
 |
4c9427 |
+ if (u.getId().endsWith("translated_host_properties")) {
|
|
 |
4c9427 |
+ hostLocalizationFragments.add(u);
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ reactor.removeAll(hostLocalizationFragments);
|
|
 |
4c9427 |
+ Set<Path> reactorPaths = new LinkedHashSet<>();
|
|
 |
4c9427 |
+ for (IInstallableUnit u : reactor) {
|
|
 |
4c9427 |
+ reactorPaths.add(P2Utils.getPath(u));
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ for (EclipseArtifact a : request.getArtifacts()) {
|
|
 |
4c9427 |
+ if (!reactorPaths.contains(a.getPath())) {
|
|
 |
4c9427 |
+ logger.error("Not a valid {}: {}", a.isFeature() ? "feature" : "plugin", a.getPath());
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ int numOfArtifacts = 0;
|
|
 |
4c9427 |
+ for (IInstallableUnit u : reactor) {
|
|
 |
4c9427 |
+ numOfArtifacts += u.getArtifacts().size();
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ if (numOfArtifacts
|
|
 |
4c9427 |
!= plugins.size() + features.size()) {
|
|
 |
4c9427 |
throw new RuntimeException("Reactor contains invalid plugin or feature");
|
|
 |
4c9427 |
}
|
|
 |
4c9427 |
@@ -106,7 +120,10 @@ public class DefaultEclipseInstaller implements EclipseInstaller {
|
|
 |
4c9427 |
List<Path> sclConfs = request.getConfigFiles();
|
|
 |
4c9427 |
if (sclConfs.isEmpty())
|
|
 |
4c9427 |
sclConfs = EclipseSystemLayout.getSclConfFiles();
|
|
 |
4c9427 |
- List<SCL> scls = sclConfs.stream().map(c -> new SCL(c)).collect(Collectors.toList());
|
|
 |
4c9427 |
+ List<SCL> scls = new LinkedList<>();
|
|
 |
4c9427 |
+ for (Path c : sclConfs) {
|
|
 |
4c9427 |
+ scls.add(new SCL(c));
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
index = new CompoundBundleRepository(scls);
|
|
 |
4c9427 |
|
|
 |
4c9427 |
SCL currentScl = scls.iterator().next();
|
|
 |
4c9427 |
@@ -223,14 +240,23 @@ public class DefaultEclipseInstaller implements EclipseInstaller {
|
|
 |
4c9427 |
.get(unit);
|
|
 |
4c9427 |
requires.removeAll(content);
|
|
 |
4c9427 |
// Remove all fragments from requires generation
|
|
 |
4c9427 |
- requires.removeAll(requires.stream().filter(
|
|
 |
4c9427 |
- r -> r.getProvidedCapabilities().stream().anyMatch(
|
|
 |
4c9427 |
- p -> p.getNamespace().equals("osgi.fragment")))
|
|
 |
4c9427 |
- .collect(Collectors.toSet()));
|
|
 |
4c9427 |
+ Set<IInstallableUnit> fragments = new LinkedHashSet<>();
|
|
 |
4c9427 |
+ for (IInstallableUnit u : requires) {
|
|
 |
4c9427 |
+ for (IProvidedCapability p : u.getProvidedCapabilities()) {
|
|
 |
4c9427 |
+ if (p.getNamespace().equals("osgi.fragment")) {
|
|
 |
4c9427 |
+ fragments.add(u);
|
|
 |
4c9427 |
+ break;
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ requires.removeAll(fragments);
|
|
 |
4c9427 |
if (!requires.isEmpty()) {
|
|
 |
4c9427 |
- provide.setProperty("osgi.requires", requires
|
|
 |
4c9427 |
- .stream().map(u -> P2Utils.toString(u))
|
|
 |
4c9427 |
- .collect(Collectors.joining(",")));
|
|
 |
4c9427 |
+ StringBuffer osgiRequiresString = new StringBuffer();
|
|
 |
4c9427 |
+ for (IInstallableUnit u : requires) {
|
|
 |
4c9427 |
+ osgiRequiresString.append(",");
|
|
 |
4c9427 |
+ osgiRequiresString.append(P2Utils.toString(u));
|
|
 |
4c9427 |
+ }
|
|
 |
4c9427 |
+ provide.setProperty("osgi.requires", osgiRequiresString.substring(1));
|
|
 |
4c9427 |
}
|
|
 |
4c9427 |
}
|
|
 |
4c9427 |
}
|
|
 |
4c9427 |
diff --git a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml
|
|
 |
4c9427 |
index 2974dda..3ca2d3c 100644
|
|
 |
4c9427 |
--- a/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml
|
|
 |
4c9427 |
+++ b/fedoraproject-p2/xmvn-p2-installer-plugin/pom.xml
|
|
 |
4c9427 |
@@ -85,8 +85,8 @@
|
|
 |
4c9427 |
<plugin>
|
|
 |
4c9427 |
<artifactId>maven-compiler-plugin</artifactId>
|
|
 |
4c9427 |
<configuration>
|
|
 |
4c9427 |
- <source>1.8</source>
|
|
 |
4c9427 |
- <target>1.8</target>
|
|
 |
4c9427 |
+ <source>1.7</source>
|
|
 |
4c9427 |
+ <target>1.7</target>
|
|
 |
4c9427 |
</configuration>
|
|
 |
4c9427 |
</plugin>
|
|
 |
4c9427 |
</plugins>
|
|
 |
4c9427 |
--
|
|
 |
4c9427 |
2.1.0
|
|
 |
4c9427 |
|