// First analyze the exports resource collections
for (Iterator it = exportsResourceCollections.iterator(); it.hasNext(); ) {
final ResourceCollection rc = (ResourceCollection) it.next();
for (Iterator rcIt = rc.iterator(); rcIt.hasNext();) {
final Resource res = (Resource) rcIt.next();
log("Exports resource: "+res, Project.MSG_DEBUG);
analyze(res);
}
}// Scan done
// Get the sub-set of the provided packages that are the exports set
final Set providedExportSet = new TreeSet(bpInfo.getProvidedPackages());
final Set manifestExportSet = getPredefinedExportSet();
if (null!=manifestExportSet) {
// An Export-Package header was given it shall contain
// precisely the provided export set of Java packages.
if (!manifestExportSet.equals(providedExportSet)) {
// Found export package missmatch
log("Provided package to export: " +providedExportSet,
Project.MSG_ERR);
log("Given Export-Package header: " +manifestExportSet,
Project.MSG_ERR);
final StringBuffer msg = new StringBuffer();
final TreeSet tmp = new TreeSet(manifestExportSet);
tmp.removeAll(providedExportSet);
if (0<tmp.size()) {
msg.append("The following non-provided packages are present in the ")
.append("Export-Package header: ")
.append(tmp.toString())
.append(". ");
}
tmp.clear();
tmp.addAll(providedExportSet);
tmp.removeAll(manifestExportSet);
if (0<tmp.size()) {
if (0<msg.length()) {
msg.append("\n");
}
msg.append("The following packages are missing from ")
.append("the given Export-Package header: ")
.append(tmp.toString())
.append(".");
}
tmp.clear();
if (failOnExports) {
log(msg.toString(), Project.MSG_ERR);
throw new BuildException(msg.toString(), getLocation());
} else {
log(msg.toString(), Project.MSG_WARN);
}
}
}
log("Provided packages to export: " +providedExportSet,
Project.MSG_VERBOSE);
// Analyze the impls resource collections to find all provided
// Java packages.
for (Iterator it = implsResourceCollections.iterator(); it.hasNext(); ) {
final ResourceCollection rc = (ResourceCollection) it.next();
for (Iterator rcIt = rc.iterator(); rcIt.hasNext();) {
final Resource res = (Resource) rcIt.next();
log("Impl resource: "+res, Project.MSG_DEBUG);
analyze(res);
}
}// Scan done