in src/main/java/org/apache/easyant/core/EasyAntEngine.java [564:619]
public void doBuild(final Project project) {
project.fireBuildStarted();
Throwable error = null;
try {
PrintStream savedErr = System.err;
PrintStream savedOut = System.out;
InputStream savedIn = System.in;
// use a system manager that prevents from System.exit()
SecurityManager oldsm;
oldsm = System.getSecurityManager();
// SecurityManager can not be installed here for backwards
// compatibility reasons (PD). Needs to be loaded prior to
// ant class if we are going to implement it.
// System.setSecurityManager(new NoExitSecurityManager());
try {
if (configuration.isAllowInput()) {
project.setDefaultInputStream(System.in);
}
System.setIn(new DemuxInputStream(project));
System.setOut(new PrintStream(new DemuxOutputStream(project, false)));
System.setErr(new PrintStream(new DemuxOutputStream(project, true)));
// make sure that we have a target to execute
if (configuration.getTargets().isEmpty() && project.getDefaultTarget() != null) {
configuration.getTargets().add(project.getDefaultTarget());
}
project.executeTargets(new Vector<String>(configuration.getTargets()));
} finally {
// put back the original security manager
// The following will never eval to true. (PD)
if (oldsm != null) {
System.setSecurityManager(oldsm);
}
System.setOut(savedOut);
System.setErr(savedErr);
System.setIn(savedIn);
}
} catch (RuntimeException exc) {
error = exc;
throw exc;
} catch (Error e) {
error = e;
throw e;
} finally {
fireBuildFinished(project, error);
}
if (configuration.isShowMemoryDetails() || configuration.getMsgOutputLevel() >= Project.MSG_VERBOSE) {
ProjectUtils.printMemoryDetails(project);
}
}