Lines 44-57
Link Here
|
44 |
return accessRules; |
44 |
return accessRules; |
45 |
} |
45 |
} |
46 |
public boolean equals(Object obj) { |
46 |
public boolean equals(Object obj) { |
47 |
if(obj instanceof ClasspathElement){ |
47 |
if (obj instanceof ClasspathElement) { |
48 |
ClasspathElement element = (ClasspathElement) obj; |
48 |
ClasspathElement element = (ClasspathElement) obj; |
49 |
return path.equals(element.getPath()) && accessRules.equals(element.getAccessRules()); |
49 |
if (path == null || !path.equals(element.getPath())) |
|
|
50 |
return false; |
51 |
if (accessRules == null) |
52 |
return (element.getAccessRules() == null); |
53 |
return accessRules.equals(element.getAccessRules()); |
50 |
} |
54 |
} |
51 |
return false; |
55 |
return false; |
52 |
} |
56 |
} |
53 |
} |
57 |
} |
54 |
|
58 |
|
|
|
59 |
private static final String EXCLUDE_ALL_RULE = "-**/*"; //$NON-NLS-1$ |
60 |
|
55 |
private ModelBuildScriptGenerator generator; |
61 |
private ModelBuildScriptGenerator generator; |
56 |
private Map visiblePackages = null; |
62 |
private Map visiblePackages = null; |
57 |
|
63 |
|
Lines 89-94
Link Here
|
89 |
private Map getVisiblePackages(BundleDescription model) { |
95 |
private Map getVisiblePackages(BundleDescription model) { |
90 |
Map packages = new HashMap(20); |
96 |
Map packages = new HashMap(20); |
91 |
StateHelper helper = Platform.getPlatformAdmin().getStateHelper(); |
97 |
StateHelper helper = Platform.getPlatformAdmin().getStateHelper(); |
|
|
98 |
addVisiblePackagesFromState(helper, model, packages); |
99 |
if (model.getHost() != null) |
100 |
addVisiblePackagesFromState(helper, (BundleDescription)model.getHost().getSupplier(), packages); |
101 |
return packages; |
102 |
} |
103 |
|
104 |
private void addVisiblePackagesFromState(StateHelper helper, BundleDescription model, Map packages) { |
92 |
ExportPackageDescription[] exports = helper.getVisiblePackages(model); |
105 |
ExportPackageDescription[] exports = helper.getVisiblePackages(model); |
93 |
for (int i = 0; i < exports.length; i++) { |
106 |
for (int i = 0; i < exports.length; i++) { |
94 |
BundleDescription exporter = exports[i].getExporter(); |
107 |
BundleDescription exporter = exports[i].getExporter(); |
Lines 109-115
Link Here
|
109 |
|
122 |
|
110 |
packages.put(exporter.getSymbolicName(), rules); |
123 |
packages.put(exporter.getSymbolicName(), rules); |
111 |
} |
124 |
} |
112 |
return packages; |
|
|
113 |
} |
125 |
} |
114 |
/** |
126 |
/** |
115 |
* Add the specified plugin (including its jars) and its fragments |
127 |
* Add the specified plugin (including its jars) and its fragments |
Lines 138-144
Link Here
|
138 |
ModelBuildScriptGenerator.specialDotProcessing(modelProps, libraries); |
150 |
ModelBuildScriptGenerator.specialDotProcessing(modelProps, libraries); |
139 |
for (int i = 0; i < libraries.length; i++) { |
151 |
for (int i = 0; i < libraries.length; i++) { |
140 |
addDevEntries(model, baseLocation, classpath, Utils.getArrayFromString(modelProps.getProperty(PROPERTY_OUTPUT_PREFIX + libraries[i]))); |
152 |
addDevEntries(model, baseLocation, classpath, Utils.getArrayFromString(modelProps.getProperty(PROPERTY_OUTPUT_PREFIX + libraries[i]))); |
141 |
addPathAndCheck(model.getSymbolicName(), base, libraries[i], modelProps, classpath); |
153 |
addPathAndCheck(model, base, libraries[i], modelProps, classpath); |
142 |
} |
154 |
} |
143 |
} |
155 |
} |
144 |
|
156 |
|
Lines 187-193
Link Here
|
187 |
IPath base = Utils.makeRelative(new Path(root), new Path(baseLocation)); |
199 |
IPath base = Utils.makeRelative(new Path(root), new Path(baseLocation)); |
188 |
Properties modelProps = getBuildPropertiesFor(fragment); |
200 |
Properties modelProps = getBuildPropertiesFor(fragment); |
189 |
for (int i = 0; i < libraries.length; i++) { |
201 |
for (int i = 0; i < libraries.length; i++) { |
190 |
addPathAndCheck(fragment.getSymbolicName(), base, libraries[i], modelProps, classpath); |
202 |
addPathAndCheck(fragment, base, libraries[i], modelProps, classpath); |
191 |
} |
203 |
} |
192 |
} |
204 |
} |
193 |
|
205 |
|
Lines 217-230
Link Here
|
217 |
// pluginId the plugin we are adding to the classpath |
229 |
// pluginId the plugin we are adding to the classpath |
218 |
// basePath : the relative path between the plugin from which we are adding the classpath and the plugin that is requiring this entry |
230 |
// basePath : the relative path between the plugin from which we are adding the classpath and the plugin that is requiring this entry |
219 |
// classpath : The classpath in which we want to add this path |
231 |
// classpath : The classpath in which we want to add this path |
220 |
private void addPathAndCheck(String pluginId, IPath basePath, String libraryName, Properties modelProperties, List classpath) { |
232 |
private void addPathAndCheck(BundleDescription model, IPath basePath, String libraryName, Properties modelProperties, List classpath) { |
221 |
final String EXCLUDE_ALL_RULE = "-**/*"; //$NON-NLS-1$ |
233 |
String pluginId = null; |
222 |
String rules = null; |
234 |
String rules = ""; //$NON-NLS-1$ |
223 |
if (visiblePackages.containsKey(pluginId)) { |
235 |
if (model != null) { |
224 |
rules = "[" + (String) visiblePackages.get(pluginId) + File.pathSeparator + EXCLUDE_ALL_RULE + "]"; //$NON-NLS-1$ //$NON-NLS-2$ |
236 |
pluginId = model.getSymbolicName(); |
225 |
} else { |
237 |
|
226 |
rules = "[" + EXCLUDE_ALL_RULE + "]"; //$NON-NLS-1$//$NON-NLS-2$ |
238 |
String packageKey = pluginId; |
|
|
239 |
if (model.isResolved() && model.getHost() != null) { |
240 |
packageKey = ((BundleDescription) model.getHost().getSupplier()).getSymbolicName(); |
241 |
} |
242 |
if (visiblePackages.containsKey(packageKey)) { |
243 |
rules = "[" + (String) visiblePackages.get(packageKey) + File.pathSeparator + EXCLUDE_ALL_RULE + "]"; //$NON-NLS-1$ //$NON-NLS-2$ |
244 |
} else { |
245 |
rules = "[" + EXCLUDE_ALL_RULE + "]"; //$NON-NLS-1$//$NON-NLS-2$ |
246 |
} |
227 |
} |
247 |
} |
|
|
248 |
|
228 |
String path = null; |
249 |
String path = null; |
229 |
if ("jar".equalsIgnoreCase(basePath.getFileExtension())) { //$NON-NLS-1$ |
250 |
if ("jar".equalsIgnoreCase(basePath.getFileExtension())) { //$NON-NLS-1$ |
230 |
path = basePath.toOSString(); |
251 |
path = basePath.toOSString(); |
Lines 277-283
Link Here
|
277 |
//Potential pb: here there maybe a nasty case where the libraries variable may refer to something which is part of the base |
298 |
//Potential pb: here there maybe a nasty case where the libraries variable may refer to something which is part of the base |
278 |
//but $xx$ will replace it by the $xx instead of $basexx. The solution is for the user to use the explicitly set the content |
299 |
//but $xx$ will replace it by the $xx instead of $basexx. The solution is for the user to use the explicitly set the content |
279 |
// of its build.property file |
300 |
// of its build.property file |
280 |
addPathAndCheck(model.getSymbolicName(), Path.EMPTY, libraryName, modelProperties, classpath); |
301 |
addPathAndCheck(model, Path.EMPTY, libraryName, modelProperties, classpath); |
281 |
} |
302 |
} |
282 |
} |
303 |
} |
283 |
} else { |
304 |
} else { |
Lines 287-293
Link Here
|
287 |
if (order[i].equals(jar.getName(false))) |
308 |
if (order[i].equals(jar.getName(false))) |
288 |
break; |
309 |
break; |
289 |
addDevEntries(model, location, classpath, Utils.getArrayFromString((String) modelProperties.get(PROPERTY_OUTPUT_PREFIX + order[i]))); |
310 |
addDevEntries(model, location, classpath, Utils.getArrayFromString((String) modelProperties.get(PROPERTY_OUTPUT_PREFIX + order[i]))); |
290 |
addPathAndCheck(model.getSymbolicName(), Path.EMPTY, order[i], modelProperties, classpath); |
311 |
addPathAndCheck(model, Path.EMPTY, order[i], modelProperties, classpath); |
291 |
} |
312 |
} |
292 |
// Then we add all the "pure libraries" (the one that does not contain source) |
313 |
// Then we add all the "pure libraries" (the one that does not contain source) |
293 |
String[] libraries = getClasspathEntries(model); |
314 |
String[] libraries = getClasspathEntries(model); |
Lines 296-302
Link Here
|
296 |
if (modelProperties.get(PROPERTY_SOURCE_PREFIX + libraryName) == null) { |
317 |
if (modelProperties.get(PROPERTY_SOURCE_PREFIX + libraryName) == null) { |
297 |
//Potential pb: if the pure library is something that is being compiled (which is supposetly not the case, but who knows...) |
318 |
//Potential pb: if the pure library is something that is being compiled (which is supposetly not the case, but who knows...) |
298 |
//the user will get $basexx instead of $ws |
319 |
//the user will get $basexx instead of $ws |
299 |
addPathAndCheck(model.getSymbolicName(), Path.EMPTY, libraryName, modelProperties, classpath); |
320 |
addPathAndCheck(model, Path.EMPTY, libraryName, modelProperties, classpath); |
300 |
} |
321 |
} |
301 |
} |
322 |
} |
302 |
} |
323 |
} |
Lines 489-495
Link Here
|
489 |
|
510 |
|
490 |
IPath root = Utils.makeRelative(new Path(generator.getLocation(model)), new Path(baseLocation)); |
511 |
IPath root = Utils.makeRelative(new Path(generator.getLocation(model)), new Path(baseLocation)); |
491 |
for (int i = 0; i < entries.length; i++) { |
512 |
for (int i = 0; i < entries.length; i++) { |
492 |
addPathAndCheck(model.getSymbolicName(), root, entries[i], null, classpath); |
513 |
addPathAndCheck(model, root, entries[i], null, classpath); |
493 |
} |
514 |
} |
494 |
} |
515 |
} |
495 |
|
516 |
|