protected void processLibrary(Jar jarTask, Library lib, HashMap<File, ZipFileSet> fileSets, File srcDir) {
final String jarName = jarTask.getDestFile().getName();
final File f = getLibraryFile(lib, srcDir);
ZipFileSet fs = fileSets.get(f);
if (fs == null) {
fs = new ZipFileSet();
if (f.isFile()) {
fs.setSrc(f);
} else {
fs.setDir(f);
}
fileSets.put(f, fs);
jarTask.addFileset(fs);
}
fs.createExclude().setName("**/package.html");
final String[] excludes = lib.getExcludes();
for (int i = 0; i < excludes.length; i++) {
final String exclude = excludes[i];
if (exclude.equals("*")) {
fs.createExclude().setName("**/*");
} else {
String exp = exclude.replace('.', '/');
fs.createExclude().setName(exp + ".*");
fs.createExclude().setName(exp + ".class");
if (!exp.endsWith("*")) {
fs.createExclude().setName(exp + "*");
} else {
fs.createExclude().setName(exp);
}
}
}
final String[] exports = lib.getExports();
for (int i = 0; i < exports.length; i++) {
final String export = exports[i];
if (export.equals("*")) {
checkPackageExists(jarName, export, f);
fs.createInclude().setName("**/*");
} else {
String exp = export.replace('.', '/');
fs.createInclude().setName(exp + ".*");
if (!exp.endsWith("*")) {
checkPackageExists(jarName, exp, f);
fs.createInclude().setName(exp + "*");
} else {
checkPackageExists(jarName, exp, f);
fs.createInclude().setName(exp);
}
}
}
}