View | Details | Raw Unified | Return to bug 195281 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/pde/internal/core/PluginModelManager.java (-1 / +1 lines)
Lines 638-644 Link Here
638
	 */
638
	 */
639
	public ModelEntry findEntry(String id) {
639
	public ModelEntry findEntry(String id) {
640
		if ("system.bundle".equals(id)) //$NON-NLS-1$
640
		if ("system.bundle".equals(id)) //$NON-NLS-1$
641
			id = "org.eclipse.osgi"; //$NON-NLS-1$
641
			id = getState().getSystemBundle();
642
		return id == null ? null : (ModelEntry) getEntryTable().get(id);
642
		return id == null ? null : (ModelEntry) getEntryTable().get(id);
643
	}
643
	}
644
644
(-)src/org/eclipse/pde/internal/core/TargetPlatformHelper.java (-14 / +20 lines)
Lines 27-34 Link Here
27
27
28
public class TargetPlatformHelper {
28
public class TargetPlatformHelper {
29
29
30
	private static final String SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$
31
32
	private static String REFERENCE_PREFIX = "reference:"; //$NON-NLS-1$
30
	private static String REFERENCE_PREFIX = "reference:"; //$NON-NLS-1$
33
	private static String FILE_URL_PREFIX = "file:"; //$NON-NLS-1$
31
	private static String FILE_URL_PREFIX = "file:"; //$NON-NLS-1$
34
32
Lines 192-216 Link Here
192
190
193
	public static Dictionary getTargetEnvironment() {
191
	public static Dictionary getTargetEnvironment() {
194
		Dictionary result = new Hashtable();
192
		Dictionary result = new Hashtable();
195
		result.put("osgi.os", TargetPlatform.getOS()); //$NON-NLS-1$
193
		result.put(ICoreConstants.OSGI_OS, TargetPlatform.getOS());
196
		result.put("osgi.ws", TargetPlatform.getWS()); //$NON-NLS-1$
194
		result.put(ICoreConstants.OSGI_WS, TargetPlatform.getWS());
197
		result.put("osgi.nl", TargetPlatform.getNL()); //$NON-NLS-1$
195
		result.put(ICoreConstants.OSGI_NL, TargetPlatform.getNL());
198
		result.put("osgi.arch", TargetPlatform.getOSArch()); //$NON-NLS-1$
196
		result.put(ICoreConstants.OSGI_ARCH, TargetPlatform.getOSArch());
199
		result.put("osgi.resolveOptional", "true"); //$NON-NLS-1$ //$NON-NLS-2$
197
		result.put(ICoreConstants.OSGI_RESOLVE_OPTIONAL, "true"); //$NON-NLS-1$
200
		result.put("osgi.resolverMode", "development"); //$NON-NLS-1$ //$NON-NLS-2$
198
		result.put(ICoreConstants.OSGI_RESOLVER_MODE, "development"); //$NON-NLS-1$
199
		return result;
200
	}
201
202
	public static Dictionary getTargetEnvironment(MinimalState state) {
203
		Dictionary result = getTargetEnvironment();
204
		result.put(ICoreConstants.OSGI_SYSTEM_BUNDLE, state.getSystemBundle());
201
		return result;
205
		return result;
202
	}
206
	}
203
207
204
	public static Dictionary[] getPlatformProperties(String[] profiles, MinimalState state) {
208
	public static Dictionary[] getPlatformProperties(String[] profiles, MinimalState state) {
205
		if (profiles == null || profiles.length == 0)
209
		if (profiles == null || profiles.length == 0)
206
			return new Dictionary[] {getTargetEnvironment()};
210
			return new Dictionary[] {getTargetEnvironment(state)};
207
211
208
		// add java profiles for those EE's that have a .profile file in the current system bundle
212
		// add java profiles for those EE's that have a .profile file in the current system bundle
209
		ArrayList result = new ArrayList(profiles.length);
213
		ArrayList result = new ArrayList(profiles.length);
210
		for (int i = 0; i < profiles.length; i++) {
214
		for (int i = 0; i < profiles.length; i++) {
211
			Properties profileProps = getJavaProfileProperties(profiles[i], state.getState());
215
			Properties profileProps = getJavaProfileProperties(profiles[i], state);
212
			if (profileProps != null) {
216
			if (profileProps != null) {
213
				Dictionary props = TargetPlatformHelper.getTargetEnvironment();
217
				Dictionary props = TargetPlatformHelper.getTargetEnvironment(state);
214
				String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
218
				String systemPackages = profileProps.getProperty(Constants.FRAMEWORK_SYSTEMPACKAGES);
215
				if (systemPackages != null)
219
				if (systemPackages != null)
216
					props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
220
					props.put(Constants.FRAMEWORK_SYSTEMPACKAGES, systemPackages);
Lines 222-232 Link Here
222
		}
226
		}
223
		if (result.size() > 0)
227
		if (result.size() > 0)
224
			return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
228
			return (Dictionary[]) result.toArray(new Dictionary[result.size()]);
225
		return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment()};
229
		return new Dictionary[] {TargetPlatformHelper.getTargetEnvironment(state)};
226
	}
230
	}
227
231
228
	private static Properties getJavaProfileProperties(String ee, State state) {
232
	// We need system bundle passed here, because we are building the properties to be passed to
229
		BundleDescription osgiBundle = state.getBundle(SYSTEM_BUNDLE, null);
233
	// the State - it doesn't know which is the system bundle yet.
234
	private static Properties getJavaProfileProperties(String ee, MinimalState state) {
235
		BundleDescription osgiBundle = state.getState().getBundle(state.getSystemBundle(), null);
230
		if (osgiBundle == null)
236
		if (osgiBundle == null)
231
			return null;
237
			return null;
232
238
(-)src/org/eclipse/pde/internal/core/PDEState.java (+3 lines)
Lines 121-126 Link Here
121
			resolveState(false);
121
			resolveState(false);
122
			saveState(dir);
122
			saveState(dir);
123
		} else {
123
		} else {
124
			// get the system bundle from the State
125
			if (fState.getPlatformProperties() != null && fState.getPlatformProperties().length > 0)
126
				fSystemBundle = (String) fState.getPlatformProperties()[0].get(ICoreConstants.OSGI_SYSTEM_BUNDLE);
124
			boolean propertiesChanged = initializePlatformProperties();
127
			boolean propertiesChanged = initializePlatformProperties();
125
			fState.setResolver(Platform.getPlatformAdmin().getResolver());
128
			fState.setResolver(Platform.getPlatformAdmin().getResolver());
126
			if (propertiesChanged)
129
			if (propertiesChanged)
(-)src/org/eclipse/pde/internal/core/ClasspathHelper.java (-32 / +8 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2003, 2007 IBM Corporation and others.
2
 * Copyright (c) 2003, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-49 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core;
11
package org.eclipse.pde.internal.core;
12
12
13
import java.io.File;
13
import java.io.*;
14
import java.io.FileOutputStream;
15
import java.io.IOException;
16
import java.net.URL;
14
import java.net.URL;
17
import java.util.ArrayList;
15
import java.util.*;
18
import java.util.Dictionary;
16
import org.eclipse.core.resources.*;
19
import java.util.HashMap;
17
import org.eclipse.core.runtime.*;
20
import java.util.Hashtable;
21
import java.util.Iterator;
22
import java.util.List;
23
import java.util.ListIterator;
24
import java.util.Map;
25
import java.util.Properties;
26
import java.util.StringTokenizer;
27
28
import org.eclipse.core.resources.IFile;
29
import org.eclipse.core.resources.IProject;
30
import org.eclipse.core.resources.IResource;
31
import org.eclipse.core.resources.ProjectScope;
32
import org.eclipse.core.runtime.CoreException;
33
import org.eclipse.core.runtime.IPath;
34
import org.eclipse.core.runtime.Path;
35
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
18
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
36
import org.eclipse.jdt.core.IClasspathEntry;
19
import org.eclipse.jdt.core.*;
37
import org.eclipse.jdt.core.IJavaProject;
38
import org.eclipse.jdt.core.JavaCore;
39
import org.eclipse.jdt.core.JavaModelException;
40
import org.eclipse.pde.core.build.IBuild;
20
import org.eclipse.pde.core.build.IBuild;
41
import org.eclipse.pde.core.build.IBuildEntry;
21
import org.eclipse.pde.core.build.IBuildEntry;
42
import org.eclipse.pde.core.plugin.IFragmentModel;
22
import org.eclipse.pde.core.plugin.*;
43
import org.eclipse.pde.core.plugin.IPluginBase;
44
import org.eclipse.pde.core.plugin.IPluginLibrary;
45
import org.eclipse.pde.core.plugin.IPluginModelBase;
46
import org.eclipse.pde.core.plugin.PluginRegistry;
47
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
23
import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
48
24
49
public class ClasspathHelper {
25
public class ClasspathHelper {
Lines 253-259 Link Here
253
		IPluginLibrary[] libraries = base.getLibraries();
229
		IPluginLibrary[] libraries = base.getLibraries();
254
		try {
230
		try {
255
			if (project.hasNature(JavaCore.NATURE_ID)) {
231
			if (project.hasNature(JavaCore.NATURE_ID)) {
256
				Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals("org.eclipse.osgi"), false); //$NON-NLS-1$
232
				Map classpathMap = getClasspathMap(project, checkExcluded, !base.getId().equals(PDECore.getDefault().getModelManager().getState().getSystemBundle()), false);
257
				IFile file = project.getFile("build.properties"); //$NON-NLS-1$
233
				IFile file = project.getFile("build.properties"); //$NON-NLS-1$
258
				boolean searchBuild = file.exists();
234
				boolean searchBuild = file.exists();
259
				if (searchBuild) {
235
				if (searchBuild) {
(-)src/org/eclipse/pde/internal/core/ICoreConstants.java (-1 / +11 lines)
Lines 108-115 Link Here
108
	public static final String ECLIPSE_GENERIC_REQUIRED = "Eclipse-GenericRequire"; //$NON-NLS-1$
108
	public static final String ECLIPSE_GENERIC_REQUIRED = "Eclipse-GenericRequire"; //$NON-NLS-1$
109
	public static final String PLATFORM_FILTER = "Eclipse-PlatformFilter"; //$NON-NLS-1$
109
	public static final String PLATFORM_FILTER = "Eclipse-PlatformFilter"; //$NON-NLS-1$
110
	public static final String ECLIPSE_SOURCE_BUNDLE = "Eclipse-SourceBundle"; //$NON-NLS-1$
110
	public static final String ECLIPSE_SOURCE_BUNDLE = "Eclipse-SourceBundle"; //$NON-NLS-1$
111
	public static final String ECLIPSE_SYSTEM_BUNDLE = "Eclipse-SystemBundle"; //$NON-NLS-1$
111
112
112
	// Equinox-specifid directives
113
	// Equinox-specific system properties
114
	public static final String OSGI_SYSTEM_BUNDLE = "osgi.system.bundle"; //$NON-NLS-1$
115
	public static final String OSGI_OS = "osgi.os"; //$NON-NLS-1$
116
	public static final String OSGI_WS = "osgi.ws"; //$NON-NLS-1$
117
	public static final String OSGI_NL = "osgi.nl"; //$NON-NLS-1$
118
	public static final String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$
119
	public static final String OSGI_RESOLVE_OPTIONAL = "osgi.resolveOptional"; //$NON-NLS-1$
120
	public static final String OSGI_RESOLVER_MODE = "osgi.resolverMode"; //$NON-NLS-1$
121
122
	// Equinox-specific directives
113
	public static final String INTERNAL_DIRECTIVE = "x-internal"; //$NON-NLS-1$
123
	public static final String INTERNAL_DIRECTIVE = "x-internal"; //$NON-NLS-1$
114
	public static final String FRIENDS_DIRECTIVE = "x-friends"; //$NON-NLS-1$
124
	public static final String FRIENDS_DIRECTIVE = "x-friends"; //$NON-NLS-1$
115
125
(-)src/org/eclipse/pde/internal/core/MinimalState.java (-25 / +14 lines)
Lines 1-5 Link Here
1
/*******************************************************************************
1
/*******************************************************************************
2
 * Copyright (c) 2005, 2007 IBM Corporation and others.
2
 * Copyright (c) 2005, 2008 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
5
 * which accompanies this distribution, and is available at
Lines 10-43 Link Here
10
 *******************************************************************************/
10
 *******************************************************************************/
11
package org.eclipse.pde.internal.core;
11
package org.eclipse.pde.internal.core;
12
12
13
import java.io.File;
13
import java.io.*;
14
import java.io.FileInputStream;
15
import java.io.FileNotFoundException;
16
import java.io.IOException;
17
import java.io.InputStream;
18
import java.util.Dictionary;
14
import java.util.Dictionary;
19
import java.util.jar.JarFile;
15
import java.util.jar.JarFile;
20
import java.util.zip.ZipEntry;
16
import java.util.zip.ZipEntry;
21
import java.util.zip.ZipFile;
17
import java.util.zip.ZipFile;
22
18
import org.eclipse.core.runtime.*;
23
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.IStatus;
25
import org.eclipse.core.runtime.MultiStatus;
26
import org.eclipse.core.runtime.Path;
27
import org.eclipse.core.runtime.Platform;
28
import org.eclipse.core.runtime.Status;
29
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
19
import org.eclipse.osgi.service.pluginconversion.PluginConversionException;
30
import org.eclipse.osgi.service.pluginconversion.PluginConverter;
20
import org.eclipse.osgi.service.pluginconversion.PluginConverter;
31
import org.eclipse.osgi.service.resolver.BundleDescription;
21
import org.eclipse.osgi.service.resolver.*;
32
import org.eclipse.osgi.service.resolver.BundleSpecification;
33
import org.eclipse.osgi.service.resolver.HostSpecification;
34
import org.eclipse.osgi.service.resolver.ImportPackageSpecification;
35
import org.eclipse.osgi.service.resolver.State;
36
import org.eclipse.osgi.service.resolver.StateDelta;
37
import org.eclipse.osgi.service.resolver.StateHelper;
38
import org.eclipse.osgi.service.resolver.StateObjectFactory;
39
import org.eclipse.osgi.service.resolver.VersionConstraint;
40
import org.eclipse.osgi.service.resolver.VersionRange;
41
import org.eclipse.osgi.util.ManifestElement;
22
import org.eclipse.osgi.util.ManifestElement;
42
import org.eclipse.pde.core.plugin.IPluginModelBase;
23
import org.eclipse.pde.core.plugin.IPluginModelBase;
43
import org.eclipse.pde.internal.core.util.Headers;
24
import org.eclipse.pde.internal.core.util.Headers;
Lines 61-67 Link Here
61
42
62
	private boolean fNoProfile;
43
	private boolean fNoProfile;
63
44
64
	private static final String SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$
45
	private static final String DEFAULT_SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$
65
46
66
	protected static boolean DEBUG = false;
47
	protected static boolean DEBUG = false;
67
48
Lines 69-74 Link Here
69
50
70
	protected static String DIR;
51
	protected static String DIR;
71
52
53
	protected String fSystemBundle = DEFAULT_SYSTEM_BUNDLE;
54
72
	static {
55
	static {
73
		DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/cache")); //$NON-NLS-1$ //$NON-NLS-2$
56
		DEBUG = PDECore.getDefault().isDebugging() && "true".equals(Platform.getDebugOption("org.eclipse.pde.core/cache")); //$NON-NLS-1$ //$NON-NLS-2$
74
		DIR = PDECore.getDefault().getStateLocation().toOSString();
57
		DIR = PDECore.getDefault().getStateLocation().toOSString();
Lines 83-88 Link Here
83
		this.fEEListChanged = state.fEEListChanged;
66
		this.fEEListChanged = state.fEEListChanged;
84
		this.fExecutionEnvironments = state.fExecutionEnvironments;
67
		this.fExecutionEnvironments = state.fExecutionEnvironments;
85
		this.fNoProfile = state.fNoProfile;
68
		this.fNoProfile = state.fNoProfile;
69
		this.fSystemBundle = state.fSystemBundle;
86
	}
70
	}
87
71
88
	protected MinimalState() {
72
	protected MinimalState() {
Lines 145-155 Link Here
145
				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$
129
				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$
146
		}
130
		}
147
		BundleDescription desc = addBundle(manifest, bundleLocation, bundleId);
131
		BundleDescription desc = addBundle(manifest, bundleLocation, bundleId);
148
		if (desc != null && SYSTEM_BUNDLE.equals(desc.getSymbolicName())) {
132
		if (desc != null && "true".equals(manifest.get(ICoreConstants.ECLIPSE_SYSTEM_BUNDLE))) { //$NON-NLS-1$
149
			// if this is the system bundle then 
133
			// if this is the system bundle then 
150
			// indicate that the javaProfile has changed since the new system
134
			// indicate that the javaProfile has changed since the new system
151
			// bundle may not contain profiles for all EE's in the list
135
			// bundle may not contain profiles for all EE's in the list
152
			fEEListChanged = true;
136
			fEEListChanged = true;
137
			fSystemBundle = desc.getSymbolicName();
153
		}
138
		}
154
		if (desc != null) {
139
		if (desc != null) {
155
			addAuxiliaryData(desc, manifest, hasBundleStructure);
140
			addAuxiliaryData(desc, manifest, hasBundleStructure);
Lines 332-335 Link Here
332
		return constraint.getName() + '_' + versionRange;
317
		return constraint.getName() + '_' + versionRange;
333
	}
318
	}
334
319
320
	public String getSystemBundle() {
321
		return fSystemBundle;
322
	}
323
335
}
324
}

Return to bug 195281