Lines 130-136
Link Here
|
130 |
String bld = attr.getValue("OpenIDE-Module-Build-Version"); // NOI18N |
130 |
String bld = attr.getValue("OpenIDE-Module-Build-Version"); // NOI18N |
131 |
buildVersion = bld == null ? implVersion : bld; |
131 |
buildVersion = bld == null ? implVersion : bld; |
132 |
|
132 |
|
133 |
this.provides = computeProvides(forModule, attr, verifyCNBs); |
133 |
this.provides = computeProvides(forModule, attr, verifyCNBs, false); |
134 |
|
134 |
|
135 |
// Exports |
135 |
// Exports |
136 |
String exportsS = attr.getValue("OpenIDE-Module-Public-Packages"); // NOI18N |
136 |
String exportsS = attr.getValue("OpenIDE-Module-Public-Packages"); // NOI18N |
Lines 237-244
Link Here
|
237 |
this.buildVersion = bld == null ? implVersion : bld; |
237 |
this.buildVersion = bld == null ? implVersion : bld; |
238 |
this.friendNames = Collections.emptySet(); |
238 |
this.friendNames = Collections.emptySet(); |
239 |
this.publicPackages = null; |
239 |
this.publicPackages = null; |
240 |
this.provides = computeProvides(m, mf.getMainAttributes(), false); |
240 |
this.provides = computeProvides(m, mf.getMainAttributes(), false, true); |
241 |
this.dependencies = null; |
241 |
this.dependencies = computeImported(mf.getMainAttributes()); |
242 |
this.coveredPackages = new HashSet<String>(); |
242 |
this.coveredPackages = new HashSet<String>(); |
243 |
} |
243 |
} |
244 |
|
244 |
|
Lines 274-280
Link Here
|
274 |
Module.PackageExport.write(dos, publicPackages); |
274 |
Module.PackageExport.write(dos, publicPackages); |
275 |
} |
275 |
} |
276 |
|
276 |
|
277 |
private String[] computeProvides(Module forModule, Attributes attr, boolean verifyCNBs) throws InvalidException, IllegalArgumentException { |
277 |
private Dependency[] computeImported(Attributes attr) { |
|
|
278 |
String pkgs = attr.getValue("Import-Package"); // NOI18N |
279 |
List<Dependency> arr = null; |
280 |
if (pkgs != null) { |
281 |
arr = new ArrayList<Dependency>(); |
282 |
StringTokenizer tok = createTokenizer(pkgs); // NOI18N |
283 |
while (tok.hasMoreElements()) { |
284 |
String dep = beforeSemicolon(tok); |
285 |
arr.addAll(Dependency.create(Dependency.TYPE_RECOMMENDS, dep)); |
286 |
} |
287 |
} |
288 |
String recomm = attr.getValue("Require-Bundle"); // NOI18N |
289 |
if (recomm != null) { |
290 |
if (arr == null) { |
291 |
arr = new ArrayList<Dependency>(); |
292 |
} |
293 |
StringTokenizer tok = createTokenizer(recomm); // NOI18N |
294 |
while (tok.hasMoreElements()) { |
295 |
String dep = beforeSemicolon(tok); |
296 |
arr.addAll(Dependency.create(Dependency.TYPE_MODULE, dep)); |
297 |
} |
298 |
} |
299 |
return arr == null ? null : arr.toArray(new Dependency[0]); |
300 |
} |
301 |
|
302 |
private static StringTokenizer createTokenizer(String osgiDep) { |
303 |
for (;;) { |
304 |
int first = osgiDep.indexOf('"'); |
305 |
if (first == -1) { |
306 |
break; |
307 |
} |
308 |
int second = osgiDep.indexOf('"', first + 1); |
309 |
if (second == -1) { |
310 |
break; |
311 |
} |
312 |
osgiDep = osgiDep.substring(0, first - 1) + osgiDep.substring(second + 1); |
313 |
} |
314 |
|
315 |
return new StringTokenizer(osgiDep, ","); |
316 |
} |
317 |
|
318 |
private static String beforeSemicolon(StringTokenizer tok) { |
319 |
String dep = tok.nextToken().trim(); |
320 |
int semicolon = dep.indexOf(';'); |
321 |
if (semicolon >= 0) { |
322 |
dep = dep.substring(0, semicolon); |
323 |
} |
324 |
return dep; |
325 |
} |
326 |
|
327 |
private String[] computeExported(boolean useOSGi, String[] addTo, Attributes attr) { |
328 |
if (!useOSGi) { |
329 |
return addTo; |
330 |
} |
331 |
String pkgs = attr.getValue("Export-Package"); // NOI18N |
332 |
if (pkgs == null) { |
333 |
return addTo; |
334 |
} |
335 |
List<String> arr = new ArrayList<String>(Arrays.asList(addTo)); |
336 |
StringTokenizer tok = createTokenizer(pkgs); // NOI18N |
337 |
while (tok.hasMoreElements()) { |
338 |
arr.add(beforeSemicolon(tok)); |
339 |
} |
340 |
return arr.toArray(new String[0]); |
341 |
} |
342 |
|
343 |
private String[] computeProvides( |
344 |
Module forModule, Attributes attr, boolean verifyCNBs, boolean useOSGi |
345 |
) throws InvalidException, IllegalArgumentException { |
278 |
String[] arr; |
346 |
String[] arr; |
279 |
// Token provides |
347 |
// Token provides |
280 |
String providesS = attr.getValue("OpenIDE-Module-Provides"); // NOI18N |
348 |
String providesS = attr.getValue("OpenIDE-Module-Provides"); // NOI18N |
Lines 309-315
Link Here
|
309 |
arr = l.toArray (arr); |
377 |
arr = l.toArray (arr); |
310 |
} |
378 |
} |
311 |
} |
379 |
} |
312 |
return arr; |
380 |
return computeExported(useOSGi, arr, attr); |
313 |
} |
381 |
} |
314 |
|
382 |
|
315 |
/** |
383 |
/** |