Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 78588 | Differences between
and this patch

Collapse All | Expand All

(-)defaultAdaptor/src/org/eclipse/osgi/framework/internal/defaultadaptor/DevClassPathHelper.java (-11 / +21 lines)
Lines 17-46 Link Here
17
import java.util.*;
17
import java.util.*;
18
18
19
public class DevClassPathHelper {
19
public class DevClassPathHelper {
20
	static protected boolean inDevelopmentMode = false;
20
	static protected boolean _inDevelopmentMode = false;
21
	static protected String[] devDefaultClasspath;
21
	static protected String[] _devDefaultClasspath;
22
	static protected Properties devProperties = null;
22
	static protected Dictionary _devProperties = null;
23
23
24
	static {
24
	static {
25
		// Check the osgi.dev property to see if dev classpath entries have been defined.
25
		// Check the osgi.dev property to see if dev classpath entries have been defined.
26
		String osgiDev = System.getProperty("osgi.dev"); //$NON-NLS-1$
26
		String osgiDev = System.getProperty("osgi.dev"); //$NON-NLS-1$
27
		if (osgiDev != null) {
27
		if (osgiDev != null) {
28
			try {
28
			try {
29
				inDevelopmentMode = true;
29
				_inDevelopmentMode = true;
30
				URL location = new URL(osgiDev);
30
				URL location = new URL(osgiDev);
31
				devProperties = load(location);
31
				_devProperties = load(location);
32
				if (devProperties != null)
32
				if (_devProperties != null)
33
					devDefaultClasspath = getArrayFromList(devProperties.getProperty("*")); //$NON-NLS-1$
33
					_devDefaultClasspath = getArrayFromList((String) _devProperties.get("*")); //$NON-NLS-1$
34
			} catch (MalformedURLException e) {
34
			} catch (MalformedURLException e) {
35
				devDefaultClasspath = getArrayFromList(osgiDev);
35
				_devDefaultClasspath = getArrayFromList(osgiDev);
36
			}
36
			}
37
		}
37
		}
38
	}
38
	}
39
39
40
	public static String[] getDevClassPath(String id) {
40
	private static String[] getDevClassPath(String id, Dictionary devProperties, String[] devDefaultClasspath) {
41
		String[] result = null;
41
		String[] result = null;
42
		if (id != null && devProperties != null) {
42
		if (id != null && devProperties != null) {
43
			String entry = devProperties.getProperty(id);
43
			String entry = (String) devProperties.get(id);
44
			if (entry != null)
44
			if (entry != null)
45
				result = getArrayFromList(entry);
45
				result = getArrayFromList(entry);
46
		}
46
		}
Lines 49-54 Link Here
49
		return result;
49
		return result;
50
	}
50
	}
51
51
52
	public static String[] getDevClassPath(String id, Dictionary devProperties) {
53
		if (devProperties == null)
54
			return getDevClassPath(id, _devProperties, _devDefaultClasspath);
55
		return getDevClassPath(id, devProperties, getArrayFromList((String) devProperties.get("*"))); //$NON-NLS-1$
56
	}
57
58
	public static String[] getDevClassPath(String id) {
59
		return getDevClassPath(id, null);
60
	}
61
52
	/**
62
	/**
53
	 * Returns the result of converting a list of comma-separated tokens into an array
63
	 * Returns the result of converting a list of comma-separated tokens into an array
54
	 * 
64
	 * 
Lines 69-75 Link Here
69
	}
79
	}
70
80
71
	public static boolean inDevelopmentMode() {
81
	public static boolean inDevelopmentMode() {
72
		return inDevelopmentMode;
82
		return _inDevelopmentMode;
73
	}
83
	}
74
84
75
	/*
85
	/*
(-)eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/EclipseBundleData.java (-1 / +1 lines)
Lines 244-250 Link Here
244
244
245
		Dictionary generatedManifest;
245
		Dictionary generatedManifest;
246
		try {
246
		try {
247
			generatedManifest = converter.convertManifest(getBaseFile(), true, null, true);
247
			generatedManifest = converter.convertManifest(getBaseFile(), true, null, true, null);
248
		} catch (PluginConversionException pce) {
248
		} catch (PluginConversionException pce) {
249
			String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_ERROR_CONVERTING, getBaseFile()); //$NON-NLS-1$
249
			String message = NLS.bind(EclipseAdaptorMsg.ECLIPSE_CONVERTER_ERROR_CONVERTING, getBaseFile()); //$NON-NLS-1$
250
			throw new BundleException(message, pce); //$NON-NLS-1$
250
			throw new BundleException(message, pce); //$NON-NLS-1$
(-)eclipseAdaptor/src/org/eclipse/core/runtime/adaptor/PluginConverterImpl.java (-11 / +17 lines)
Lines 43-48 Link Here
43
	private Dictionary generatedManifest;
43
	private Dictionary generatedManifest;
44
	private byte manifestType;
44
	private byte manifestType;
45
	private String target;
45
	private String target;
46
	private Dictionary devProperties;
46
	static final String TARGET31 = "3.1"; //$NON-NLS-1$
47
	static final String TARGET31 = "3.1"; //$NON-NLS-1$
47
	private static final String MANIFEST_VERSION = "Manifest-Version"; //$NON-NLS-1$
48
	private static final String MANIFEST_VERSION = "Manifest-Version"; //$NON-NLS-1$
48
	private static final String PLUGIN_PROPERTIES_FILENAME = "plugin"; //$NON-NLS-1$
49
	private static final String PLUGIN_PROPERTIES_FILENAME = "plugin"; //$NON-NLS-1$
Lines 80-85 Link Here
80
		generatedManifest = new Hashtable(10);
81
		generatedManifest = new Hashtable(10);
81
		manifestType = EclipseBundleData.MANIFEST_TYPE_UNKNOWN;
82
		manifestType = EclipseBundleData.MANIFEST_TYPE_UNKNOWN;
82
		target = null;
83
		target = null;
84
		devProperties = null;
83
	}
85
	}
84
86
85
	private void fillPluginInfo(File pluginBaseLocation) throws PluginConversionException {
87
	private void fillPluginInfo(File pluginBaseLocation) throws PluginConversionException {
Lines 396-403 Link Here
396
			return null;
398
			return null;
397
399
398
		//If we are in dev mode, then add the binary folders on the list libs with the export clause set to be the cumulation of the export clause of the real libs   
400
		//If we are in dev mode, then add the binary folders on the list libs with the export clause set to be the cumulation of the export clause of the real libs   
399
		if (DevClassPathHelper.inDevelopmentMode()) {
401
		if (devProperties != null || DevClassPathHelper.inDevelopmentMode()) {
400
			String[] devClassPath = DevClassPathHelper.getDevClassPath(pluginInfo.getUniqueId());
402
			String[] devClassPath = DevClassPathHelper.getDevClassPath(pluginInfo.getUniqueId(), devProperties);
401
403
402
			// collect export clauses
404
			// collect export clauses
403
			List allExportClauses = new ArrayList(libs.size());
405
			List allExportClauses = new ArrayList(libs.size());
Lines 421-427 Link Here
421
				continue;
423
				continue;
422
			String libEntryText = (String) element.getKey();
424
			String libEntryText = (String) element.getKey();
423
			File libraryLocation;
425
			File libraryLocation;
424
			if (DevClassPathHelper.inDevelopmentMode()) {
426
			if (devProperties != null || DevClassPathHelper.inDevelopmentMode()) {
425
				// in development time, libEntries may contain absolute locations (linked folders)				
427
				// in development time, libEntries may contain absolute locations (linked folders)				
426
				File libEntryAsPath = new File(libEntryText);
428
				File libEntryAsPath = new File(libEntryText);
427
				libraryLocation = libEntryAsPath.isAbsolute() ? libEntryAsPath : new File(pluginManifestLocation, libEntryText);
429
				libraryLocation = libEntryAsPath.isAbsolute() ? libEntryAsPath : new File(pluginManifestLocation, libEntryText);
Lines 654-684 Link Here
654
		return result.toString();
656
		return result.toString();
655
	}
657
	}
656
658
657
	public synchronized Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars) throws PluginConversionException {
659
	public synchronized Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars, Dictionary devProperties) throws PluginConversionException {
658
		if (DEBUG)
660
		if (DEBUG)
659
			System.out.println("Convert " + pluginBaseLocation); //$NON-NLS-1$
661
			System.out.println("Convert " + pluginBaseLocation); //$NON-NLS-1$
660
		init();
662
		init();
661
		this.target = target == null ? TARGET31 : target;
663
		this.target = target == null ? TARGET31 : target;
664
		this.devProperties = devProperties;
662
		fillPluginInfo(pluginBaseLocation);
665
		fillPluginInfo(pluginBaseLocation);
663
		fillManifest(compatibility, analyseJars);
666
		fillManifest(compatibility, analyseJars);
664
		return generatedManifest;
667
		return generatedManifest;
665
	}
668
	}
666
669
667
	public synchronized File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars) throws PluginConversionException {
670
	public synchronized Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars) throws PluginConversionException {
668
		if (DEBUG)
671
		return convertManifest(pluginBaseLocation, compatibility, target, analyseJars, null);
669
			System.out.println("Convert " + pluginBaseLocation); //$NON-NLS-1$
672
	}
670
		init();
673
671
		this.target = target == null ? TARGET31 : target;
674
	public synchronized File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars, Dictionary devProperties) throws PluginConversionException {
672
		fillPluginInfo(pluginBaseLocation);
675
		convertManifest(pluginBaseLocation, compatibilityManifest, target, analyseJars, devProperties);
673
		if (bundleManifestLocation == null) {
676
		if (bundleManifestLocation == null) {
674
			String cacheLocation = (String) System.getProperties().get(LocationManager.PROP_MANIFEST_CACHE);
677
			String cacheLocation = (String) System.getProperties().get(LocationManager.PROP_MANIFEST_CACHE);
675
			bundleManifestLocation = new File(cacheLocation, pluginInfo.getUniqueId() + '_' + pluginInfo.getVersion() + ".MF"); //$NON-NLS-1$
678
			bundleManifestLocation = new File(cacheLocation, pluginInfo.getUniqueId() + '_' + pluginInfo.getVersion() + ".MF"); //$NON-NLS-1$
676
		}
679
		}
677
		fillManifest(compatibilityManifest, analyseJars);
678
		if (upToDate(bundleManifestLocation, pluginManifestLocation, manifestType))
680
		if (upToDate(bundleManifestLocation, pluginManifestLocation, manifestType))
679
			return bundleManifestLocation;
681
			return bundleManifestLocation;
680
		writeManifest(bundleManifestLocation, generatedManifest, compatibilityManifest);
682
		writeManifest(bundleManifestLocation, generatedManifest, compatibilityManifest);
681
		return bundleManifestLocation;
683
		return bundleManifestLocation;
684
	}
685
686
	public synchronized File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars) throws PluginConversionException {
687
		return convertManifest(pluginBaseLocation, bundleManifestLocation, compatibilityManifest, target, analyseJars, null);
682
	}
688
	}
683
689
684
	private String getVersionRange(String reqVersion, String matchRule) {
690
	private String getVersionRange(String reqVersion, String matchRule) {
(-)eclipseAdaptor/src/org/eclipse/osgi/service/pluginconversion/PluginConverter.java (-2 / +39 lines)
Lines 29-41 Link Here
29
	 * in backward compatibility
29
	 * in backward compatibility
30
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted 
30
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted 
31
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
31
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
32
	 *	@return the generated manifest file location, if a bundle manifest was successfully 
32
	 * @return the generated manifest file location, if a bundle manifest was successfully 
33
	 * generated (or already existed), <code>null</code> otherwise.
33
	 * generated (or already existed), <code>null</code> otherwise.
34
	 * @deprecated use {@link #convertManifest(File, File, boolean, String, boolean, Dictionary)}
34
	 */
35
	 */
35
	public File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars) throws PluginConversionException;
36
	public File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars) throws PluginConversionException;
36
37
37
	/**
38
	/**
38
	 * Converts a plug-in/fragment manifest at the given source base location (a directory) and 
39
	 * Converts a plug-in/fragment manifest at the given source base location (a directory) and 
40
	 * generates a corresponding bundle manifest at the given default target locaton (a file).
41
	 * 
42
	 * @param pluginBaseLocation the base location for the plug-in/fragment manifest to be converted
43
	 * (a directory, e.g. the plug-in install location)
44
	 * @param bundleManifestLocation the location for the bundle manifest to be generated
45
	 * (including the file name). 
46
	 * @param compatibilityManifest a boolean indicating if the manifest should contain headers to run  
47
	 * in backward compatibility
48
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted 
49
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
50
	 * @param devProperties a dictionary of development time classpath properties.  The dictionary contains a mapping from plugin id to development 
51
	 * time classpath.  A value of <code>null</code> indicates that the default development time classpath properties will be used.
52
	 * @return the generated manifest file location, if a bundle manifest was successfully 
53
	 * generated (or already existed), <code>null</code> otherwise.
54
	 */
55
	public File convertManifest(File pluginBaseLocation, File bundleManifestLocation, boolean compatibilityManifest, String target, boolean analyseJars, Dictionary devProperties) throws PluginConversionException;
56
57
	/**
58
	 * Converts a plug-in/fragment manifest at the given source base location (a directory) and 
39
	 * generates a corresponding bundle manifest returned as a dictionary.
59
	 * generates a corresponding bundle manifest returned as a dictionary.
40
	 * 
60
	 * 
41
	 * @param pluginBaseLocation the base location for the plug-in/fragment manifest to be converted
61
	 * @param pluginBaseLocation the base location for the plug-in/fragment manifest to be converted
Lines 44-54 Link Here
44
	 * in backward compatibility
64
	 * in backward compatibility
45
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted
65
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted
46
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
66
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
47
	 *	@return the generated manifest as a dictionary,  if a bundle manifest was successfully 
67
	 * @return the generated manifest as a dictionary,  if a bundle manifest was successfully 
48
	 * generated, <code>null</code> otherwise
68
	 * generated, <code>null</code> otherwise
69
	 * @deprecated use {@link #convertManifest(File, boolean, String, boolean, Dictionary)}
49
	 */
70
	 */
50
	public Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars) throws PluginConversionException;
71
	public Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars) throws PluginConversionException;
51
72
73
	/**
74
	 * Converts a plug-in/fragment manifest at the given source base location (a directory) and 
75
	 * generates a corresponding bundle manifest returned as a dictionary.
76
	 * 
77
	 * @param pluginBaseLocation the base location for the plug-in/fragment manifest to be converted
78
	 * (a directory, e.g. the plug-in install location)
79
	 * @param compatibility a boolean indicating if the manifest should contain headers to run  
80
	 * in backward compatibility
81
	 * @param target a string indicating the version of the runtime for which the manifest generated is targeted
82
	 * @param analyseJars a boolean indicating if the code jars of the given plugin must be analysed. When set to false the provided-package har
83
	 * @param devProperties a dictionary of development time classpath properties.  The dictionary contains a mapping from plugin id to development 
84
	 * time classpath.  A value of <code>null</code> indicates that the default development time classpath properties will be used.
85
	 * @return the generated manifest as a dictionary,  if a bundle manifest was successfully 
86
	 * generated, <code>null</code> otherwise
87
	 */
88
	public Dictionary convertManifest(File pluginBaseLocation, boolean compatibility, String target, boolean analyseJars, Dictionary devProperties) throws PluginConversionException;
52
	/** 
89
	/** 
53
	 * Write the dictionary into the specified location. 
90
	 * Write the dictionary into the specified location. 
54
	 * @param generationLocation the location for the bundle manifest to be written
91
	 * @param generationLocation the location for the bundle manifest to be written

Return to bug 78588