private void completeOutjar() {
if (((null == tmpOutjar) || !tmpOutjar.canRead())
|| (!copyInjars && (null == sourceRootCopyFilter) && (null == inpathDirCopyFilter))) {
return;
}
Zip zip = new Zip();
Project project = getProject();
zip.setProject(project);
zip.setTaskName(getTaskName() + " - zip");
zip.setDestFile(outjar);
ZipFileSet zipfileset = new ZipFileSet();
zipfileset.setProject(project);
zipfileset.setSrc(tmpOutjar);
zipfileset.setIncludes("**/*.class");
zip.addZipfileset(zipfileset);
if (copyInjars) {
String[] paths = injars.list();
if (!LangUtil.isEmpty(paths)) {
for (int i = 0; i < paths.length; i++) {
File jarFile = new File(paths[i]);
zipfileset = new ZipFileSet();
zipfileset.setProject(project);
zipfileset.setSrc(jarFile);
zipfileset.setIncludes("**/*");
zipfileset.setExcludes("**/*.class");
zip.addZipfileset(zipfileset);
}
}
}
if ((null != sourceRootCopyFilter) && (null != sourceRoots)) {
String[] paths = sourceRoots.list();
if (!LangUtil.isEmpty(paths)) {
for (int i = 0; i < paths.length; i++) {
File srcRoot = new File(paths[i]);
FileSet fileset = new FileSet();
fileset.setProject(project);
fileset.setDir(srcRoot);
fileset.setIncludes("**/*");
fileset.setExcludes(sourceRootCopyFilter);
zip.addFileset(fileset);
}
}
}
if ((null != inpathDirCopyFilter) && (null != inpath)) {
String[] paths = inpath.list();
if (!LangUtil.isEmpty(paths)) {
for (int i = 0; i < paths.length; i++) {
File inpathDir = new File(paths[i]);
if (inpathDir.isDirectory() && inpathDir.canRead()) {
FileSet fileset = new FileSet();
fileset.setProject(project);
fileset.setDir(inpathDir);
fileset.setIncludes("**/*");
fileset.setExcludes(inpathDirCopyFilter);
zip.addFileset(fileset);
}
}
}
}
zip.execute();
}