Methods Summary |
---|
public void | addConfiguredFileset(org.apache.tools.ant.types.FileSet fileset)
this.fileset = fileset;
|
public void | execute()
if (!getManifest().isFile())
throw new BuildException("manifest must be a file.");
Expand expand = newExpand();
if (!getTempdir().isDirectory())
throw new BuildException("tempdir must be a directory.");
expand.setDest(tempdir);
final File m = new File(tempdir + File.separator + "META-INF/MANIFEST.MF");
Delete delete = newDelete();
delete.setFile(m);
BufferedWriter bw;
try {
bw = new BufferedWriter(new FileWriter(getManifest(), true));
DirectoryScanner ds = fileset.getDirectoryScanner(this.project);
for (String file : ds.getIncludedFiles()) {
delete.execute();
expand.setSrc(new File(ds.getBasedir() + File.separator + file));
expand.execute();
writeManifest(bw, file, m);
}
bw.flush();
bw.close();
} catch (IOException e) {
throw new BuildException(e);
}
|
public java.io.File | getManifest()
return manifest;
|
public java.io.File | getTempdir()
return tempdir;
|
private org.apache.tools.ant.taskdefs.Delete | newDelete()
Delete delete = new Delete();
delete.setProject(this.project);
delete.setFailOnError(false);
delete.setQuiet(true);
return delete;
|
private org.apache.tools.ant.taskdefs.Expand | newExpand()
Expand expand = new Expand();
expand.setProject(this.project);
return expand;
|
public void | setManifest(java.io.File manifest)
this.manifest = manifest;
|
public void | setTempdir(java.io.File tempdir)
this.tempdir = tempdir;
|
private void | writeManifest(java.io.BufferedWriter bw, java.lang.String file, java.io.File m)
bw.write("\nName: " + file + "\n");
BufferedReader br;
try {
br = new BufferedReader(new FileReader(m));
} catch (FileNotFoundException e) {
log("No manifest found for " + file, Project.MSG_WARN);
// ignore this exception and continue
return;
}
String line = br.readLine();
log("\nManifest for " + file, Project.MSG_DEBUG);
while (line != null) {
log(line, Project.MSG_DEBUG);
bw.write(line + "\n");
line = br.readLine();
}
bw.write("\n");
|