Fix to not generate manifests each startup.
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
index 6e21757..3b8761e 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java
@@ -11,6 +11,8 @@
package org.eclipse.core.runtime.adaptor;
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.URL;
import java.util.*;
@@ -21,6 +23,7 @@
import org.eclipse.osgi.framework.internal.core.Constants;
import org.eclipse.osgi.framework.internal.defaultadaptor.*;
import org.eclipse.osgi.framework.util.Headers;
+import org.eclipse.osgi.service.resolver.Version;
import org.eclipse.osgi.util.ManifestElement;
import org.osgi.framework.BundleException;
@@ -168,6 +171,18 @@
}
private Dictionary generateManifest(Dictionary originalManifest) throws BundleException {
+ String cacheLocation = (String) System.getProperties().get("osgi.manifest.cache");
+ if (getSymbolicName() != null) {
+ Version version = getVersion();
+ File currentFile = new File(cacheLocation, getSymbolicName() + '_' + version.toString() + ".MF");
+ if (PluginConverterImpl.upToDate(currentFile,getBaseFile()))
+ try {
+ return Headers.parseManifest(new FileInputStream(currentFile));
+ } catch (FileNotFoundException e) {
+ // do nothing.
+ }
+ }
+
PluginConverterImpl converter = PluginConverterImpl.getDefault();
setManifestTimeStamp(getBaseFile().lastModified());
@@ -185,8 +200,8 @@
}
//write the generated manifest
- String cacheLocation = (String) System.getProperties().get("osgi.manifest.cache");
- File bundleManifestLocation = new File(cacheLocation, ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue() + '_' + generatedManifest.get(Constants.BUNDLE_VERSION) + ".MF");
+ Version version = new Version((String)generatedManifest.get(Constants.BUNDLE_VERSION));
+ File bundleManifestLocation = new File(cacheLocation, ManifestElement.parseHeader(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME, (String) generatedManifest.get(org.osgi.framework.Constants.BUNDLE_SYMBOLICNAME))[0].getValue() + '_' + version.toString() + ".MF");
try {
converter.writeManifest(bundleManifestLocation, generatedManifest, true);
} catch (Exception e) {
diff --git a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
index 43d96d8..accf719 100644
--- a/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
+++ b/bundles/org.eclipse.osgi/eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java
@@ -553,7 +553,7 @@
}
}
- private boolean upToDate(File generationLocation, File pluginLocation) {
+ public static boolean upToDate(File generationLocation, File pluginLocation) {
if (!generationLocation.isFile())
return false;
String secondLine = null;