### Eclipse Workspace Patch 1.0 #P org.eclipse.pde.core Index: src/org/eclipse/pde/internal/core/PluginModelManager.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PluginModelManager.java,v retrieving revision 1.120 diff -u -r1.120 PluginModelManager.java --- src/org/eclipse/pde/internal/core/PluginModelManager.java 21 Jan 2008 21:22:20 -0000 1.120 +++ src/org/eclipse/pde/internal/core/PluginModelManager.java 30 Jan 2008 01:20:52 -0000 @@ -638,7 +638,7 @@ */ public ModelEntry findEntry(String id) { if ("system.bundle".equals(id)) //$NON-NLS-1$ - id = "org.eclipse.osgi"; //$NON-NLS-1$ + id = getState().getSystemBundle(); return id == null ? null : (ModelEntry) getEntryTable().get(id); } Index: src/org/eclipse/pde/internal/core/TargetPlatformHelper.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/TargetPlatformHelper.java,v retrieving revision 1.17 diff -u -r1.17 TargetPlatformHelper.java --- src/org/eclipse/pde/internal/core/TargetPlatformHelper.java 7 Jan 2008 19:02:20 -0000 1.17 +++ src/org/eclipse/pde/internal/core/TargetPlatformHelper.java 30 Jan 2008 01:20:52 -0000 @@ -27,8 +27,6 @@ public class TargetPlatformHelper { - private static final String SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$ - private static String REFERENCE_PREFIX = "reference:"; //$NON-NLS-1$ private static String FILE_URL_PREFIX = "file:"; //$NON-NLS-1$ @@ -192,25 +190,31 @@ public static Dictionary getTargetEnvironment() { Dictionary result = new Hashtable(); - result.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$ - result.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$ - result.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$ - result.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$ - result.put("osgi.resolveOptional", "true"); //$NON-NLS-1$ //$NON-NLS-2$ - result.put("osgi.resolverMode", "development"); //$NON-NLS-1$ //$NON-NLS-2$ + result.put(ICoreConstants.OSGI_OS, TargetPlatform.getOS()); + result.put(ICoreConstants.OSGI_WS, TargetPlatform.getWS()); + result.put(ICoreConstants.OSGI_NL, TargetPlatform.getNL()); + result.put(ICoreConstants.OSGI_ARCH, TargetPlatform.getOSArch()); + result.put(ICoreConstants.OSGI_RESOLVE_OPTIONAL, "true"); //$NON-NLS-1$ + result.put(ICoreConstants.OSGI_RESOLVER_MODE, "development"); //$NON-NLS-1$ + return result; + } + + public static Dictionary getTargetEnvironment(MinimalState state) { + Dictionary result = getTargetEnvironment(); + result.put(ICoreConstants.OSGI_SYSTEM_BUNDLE, state.getSystemBundle()); return result; } public static Dictionary[] getPlatformProperties(String[] profiles, MinimalState state) { if (profiles == null || profiles.length == 0) - return new Dictionary[] {getTargetEnvironment()}; + return new Dictionary[] {getTargetEnvironment(state)}; // add java profiles for those EE's that have a .profile file in the current system bundle ArrayList result = new ArrayList(profiles.length); for (int i = 0; i < profiles.length; i++) { - Properties profileProps = getJavaProfileProperties(profiles[i], state.getState()); + Properties profileProps = getJavaProfileProperties(profiles[i], state); if (profileProps != null) { - Dictionary props = TargetPlatformHelper.getTargetEnvironment(); + Dictionary props = TargetPlatformHelper.getTargetEnvironment(state); String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES); if (systemPackages != null) props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages); @@ -222,11 +226,13 @@ } if (result.size() > 0) return (Dictionary[]) result.toArray(new Dictionary[result.size()]); - return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()}; + return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment(state)}; } - private static Properties getJavaProfileProperties(String ee, State state) { - BundleDescription osgiBundle = state.getBundle(SYSTEM_BUNDLE, null); + // We need system bundle passed here, because we are building the properties to be passed to + // the State - it doesn't know which is the system bundle yet. + private static Properties getJavaProfileProperties(String ee, MinimalState state) { + BundleDescription osgiBundle = state.getState().getBundle(state.getSystemBundle(), null); if (osgiBundle == null) return null; Index: src/org/eclipse/pde/internal/core/PDEState.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/PDEState.java,v retrieving revision 1.104 diff -u -r1.104 PDEState.java --- src/org/eclipse/pde/internal/core/PDEState.java 29 Jan 2008 15:35:32 -0000 1.104 +++ src/org/eclipse/pde/internal/core/PDEState.java 30 Jan 2008 01:20:52 -0000 @@ -121,6 +121,13 @@ resolveState(false); saveState(dir); } else { + // get the system bundle from the State + if (fState.getPlatformProperties() != null && fState.getPlatformProperties().length > 0) { + String systemBundle = (String) fState.getPlatformProperties()[0].get(ICoreConstants.OSGI_SYSTEM_BUNDLE); + if (systemBundle != null) + fSystemBundle = systemBundle; + } + boolean propertiesChanged = initializePlatformProperties(); fState.setResolver(Platform.getPlatformAdmin().getResolver()); if (propertiesChanged) Index: src/org/eclipse/pde/internal/core/ClasspathHelper.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ClasspathHelper.java,v retrieving revision 1.24 diff -u -r1.24 ClasspathHelper.java --- src/org/eclipse/pde/internal/core/ClasspathHelper.java 2 Jan 2008 15:56:18 -0000 1.24 +++ src/org/eclipse/pde/internal/core/ClasspathHelper.java 30 Jan 2008 01:20:52 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2003, 2007 IBM Corporation and others. + * Copyright (c) 2003, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,40 +10,16 @@ *******************************************************************************/ package org.eclipse.pde.internal.core; -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; +import java.io.*; import java.net.URL; -import java.util.ArrayList; -import java.util.Dictionary; -import java.util.HashMap; -import java.util.Hashtable; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Properties; -import java.util.StringTokenizer; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; +import java.util.*; +import org.eclipse.core.resources.*; +import org.eclipse.core.runtime.*; import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; +import org.eclipse.jdt.core.*; import org.eclipse.pde.core.build.IBuild; import org.eclipse.pde.core.build.IBuildEntry; -import org.eclipse.pde.core.plugin.IFragmentModel; -import org.eclipse.pde.core.plugin.IPluginBase; -import org.eclipse.pde.core.plugin.IPluginLibrary; -import org.eclipse.pde.core.plugin.IPluginModelBase; -import org.eclipse.pde.core.plugin.PluginRegistry; +import org.eclipse.pde.core.plugin.*; import org.eclipse.pde.internal.core.build.WorkspaceBuildModel; public class ClasspathHelper { @@ -253,7 +229,7 @@ IPluginLibrary[] libraries = base.getLibraries(); try { if (project.hasNature(JavaCore.NATURE_ID)) { - Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals("org.eclipse.osgi"), false); //$NON-NLS-1$ + Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals(PDECore.getDefault().getModelManager().getState().getSystemBundle()), false); IFile file = project.getFile("build.properties"); //$NON-NLS-1$ boolean searchBuild = file.exists(); if (searchBuild) { Index: src/org/eclipse/pde/internal/core/ICoreConstants.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/ICoreConstants.java,v retrieving revision 1.61 diff -u -r1.61 ICoreConstants.java --- src/org/eclipse/pde/internal/core/ICoreConstants.java 7 Jan 2008 19:02:20 -0000 1.61 +++ src/org/eclipse/pde/internal/core/ICoreConstants.java 30 Jan 2008 01:20:52 -0000 @@ -108,8 +108,18 @@ public static final String ECLIPSE_GENERIC_REQUIRED = "Eclipse-GenericRequire"; //$NON-NLS-1$ public static final String PLATFORM_FILTER = "Eclipse-PlatformFilter"; //$NON-NLS-1$ public static final String ECLIPSE_SOURCE_BUNDLE = "Eclipse-SourceBundle"; //$NON-NLS-1$ + public static final String ECLIPSE_SYSTEM_BUNDLE = "Eclipse-SystemBundle"; //$NON-NLS-1$ - // Equinox-specifid directives + // Equinox-specific system properties + public static final String OSGI_SYSTEM_BUNDLE = "osgi.system.bundle"; //$NON-NLS-1$ + public static final String OSGI_OS = "osgi.os"; //$NON-NLS-1$ + public static final String OSGI_WS = "osgi.ws"; //$NON-NLS-1$ + public static final String OSGI_NL = "osgi.nl"; //$NON-NLS-1$ + public static final String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$ + public static final String OSGI_RESOLVE_OPTIONAL = "osgi.resolveOptional"; //$NON-NLS-1$ + public static final String OSGI_RESOLVER_MODE = "osgi.resolverMode"; //$NON-NLS-1$ + + // Equinox-specific directives public static final String INTERNAL_DIRECTIVE = "x-internal"; //$NON-NLS-1$ public static final String FRIENDS_DIRECTIVE = "x-friends"; //$NON-NLS-1$ Index: src/org/eclipse/pde/internal/core/MinimalState.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/MinimalState.java,v retrieving revision 1.43 diff -u -r1.43 MinimalState.java --- src/org/eclipse/pde/internal/core/MinimalState.java 2 Jan 2008 15:56:18 -0000 1.43 +++ src/org/eclipse/pde/internal/core/MinimalState.java 30 Jan 2008 01:20:52 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2007 IBM Corporation and others. + * Copyright (c) 2005, 2008 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -10,34 +10,15 @@ *******************************************************************************/ package org.eclipse.pde.internal.core; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.io.InputStream; +import java.io.*; import java.util.Dictionary; import java.util.jar.JarFile; import java.util.zip.ZipEntry; import java.util.zip.ZipFile; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.MultiStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.*; import org.eclipse.osgi.service.pluginconversion.PluginConversionException; import org.eclipse.osgi.service.pluginconversion.PluginConverter; -import org.eclipse.osgi.service.resolver.BundleDescription; -import org.eclipse.osgi.service.resolver.BundleSpecification; -import org.eclipse.osgi.service.resolver.HostSpecification; -import org.eclipse.osgi.service.resolver.ImportPackageSpecification; -import org.eclipse.osgi.service.resolver.State; -import org.eclipse.osgi.service.resolver.StateDelta; -import org.eclipse.osgi.service.resolver.StateHelper; -import org.eclipse.osgi.service.resolver.StateObjectFactory; -import org.eclipse.osgi.service.resolver.VersionConstraint; -import org.eclipse.osgi.service.resolver.VersionRange; +import org.eclipse.osgi.service.resolver.*; import org.eclipse.osgi.util.ManifestElement; import org.eclipse.pde.core.plugin.IPluginModelBase; import org.eclipse.pde.internal.core.util.Headers; @@ -61,7 +42,7 @@ private boolean fNoProfile; - private static final String SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$ + private static final String DEFAULT_SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$ protected static boolean DEBUG = false; @@ -69,6 +50,8 @@ protected static String DIR; + protected String fSystemBundle = DEFAULT_SYSTEM_BUNDLE; + static { DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/cache")); //$NON-NLS-1$ //$NON-NLS-2$ DIR = PDECore.getDefault().getStateLocation().toOSString(); @@ -83,6 +66,7 @@ this.fEEListChanged = state.fEEListChanged; this.fExecutionEnvironments = state.fExecutionEnvironments; this.fNoProfile = state.fNoProfile; + this.fSystemBundle = state.fSystemBundle; } protected MinimalState() { @@ -145,11 +129,12 @@ throw new CoreException(new Status(IStatus.ERROR, PDECore.PLUGIN_ID, IStatus.ERROR, "Error parsing plug-in manifest file at " + bundleLocation.toString(), null)); //$NON-NLS-1$ } BundleDescription desc = addBundle(manifest, bundleLocation, bundleId); - if (desc != null && SYSTEM_BUNDLE.equals(desc.getSymbolicName())) { + if (desc != null && "true".equals(manifest.get(ICoreConstants.ECLIPSE_SYSTEM_BUNDLE))) { //$NON-NLS-1$ // if this is the system bundle then // indicate that the javaProfile has changed since the new system // bundle may not contain profiles for all EE's in the list fEEListChanged = true; + fSystemBundle = desc.getSymbolicName(); } if (desc != null) { addAuxiliaryData(desc, manifest, hasBundleStructure); @@ -332,4 +317,8 @@ return constraint.getName() + '_' + versionRange; } + public String getSystemBundle() { + return fSystemBundle; + } + }