DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21144>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=21144

Please add make's keep-going feature into ANT.

           Summary: Please add make's keep-going feature into ANT.
           Product: Ant
           Version: 1.6Alpha (nightly)
          Platform: Other
        OS/Version: Other
            Status: NEW
          Severity: Enhancement
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


It is possible to instruct make to run all the targets that directly or 
indirectly do not depend on failed targets. This feature is very useful in 
automatic builds and testing, because it allows detecting as many problems as 
possible instead of stopping on the first problem. 

This is a sample code that I used in Project.executeTarget() to achieve this 
functionality. In the real code a command line option needs to be added and 
BuildException has to be extended to report several build errors.

==========================
Project.executeTarget()
==========================

    public void executeTarget(String targetName) throws BuildException {

        // sanity check ourselves, if we've been asked to build nothing
        // then we should complain

        if (targetName == null) {
            String msg = "No target specified";
            throw new BuildException(msg);
        }

        // Sort the dependency tree, and run everything from the
        // beginning until we hit our targetName.
        // Sorting checks if all the targets (and dependencies)
        // exist, and if there is any cycle in the dependency
        // graph.
        Vector sortedTargets = topoSort(targetName, targets);
        Set executed=new HashSet();
        BuildException buildException=null;

        for (Enumeration iter=sortedTargets.elements(); 
iter.hasMoreElements();) {
            Target curtarget = (Target) iter.nextElement();
            boolean canExecute=true;
            for (Enumeration dep_iter=curtarget.getDependencies(); 
dep_iter.hasMoreElements();) {
              String dependencyName=((String)dep_iter.nextElement());
              if (!executed.contains(dependencyName)) {
                canExecute=false;
                log(curtarget, "Cannot execute '"+curtarget.getName()+"' - 
'"+dependencyName+"' was not executed.", MSG_ERR);
              }
            }
            if (canExecute) {
              try {
                curtarget.performTasks();
                executed.add(curtarget.getName());
              }
              catch (BuildException ex) {
                log(curtarget, "Target '"+curtarget.getName()+"' failed.", 
MSG_ERR);
                if (buildException==null) {
                  buildException=ex;
                }
                else {
                  log(curtarget, "Extra error: "+ex.getMessage(), MSG_ERR);
                }
              }
            }
            if (curtarget.getName().equals(targetName)) // very strange exit 
condition
              break;
        }
        if (buildException!=null)
          throw buildException;
    }

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to