cmdline.createArgument().setValue(target.toString());
log(cmdline.describeCommand(), Project.MSG_VERBOSE);
// redirect output generated by ANTLR to temporary file
Redirector r = new Redirector(this);
File f;
try {
f = File.createTempFile("depend", null, getOutputdirectory());
f.deleteOnExit();
log("Write dependencies for '" + target.toString() + "' to file '" + f.getCanonicalPath() + "'", Project.MSG_VERBOSE);
r.setOutput(f);
r.setAlwaysLog(false);
r.createStreams();
} catch (IOException e) {
throw new BuildException("Redirection of output failed: " + e);
}
// execute antlr -depend ...
int err = 0;
try {
err = run(cmdline.getCommandline(), r.getOutputStream(), null);
} catch (IOException e) {
try {
r.complete();
log("Redirection of output terminated.", Project.MSG_VERBOSE);
} catch (IOException ex) {
log("Termination of output redirection failed: " + ex, Project.MSG_ERR);
}
throw new BuildException(e, getLocation());
} finally {
try {
bos.close();
} catch (IOException e) {
// ignore
}
}
try {
r.complete();
log("Redirection of output terminated.", Project.MSG_VERBOSE);
} catch (IOException e) {
log("Termination of output redirection failed: " + e, Project.MSG_ERR);
}