ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 21144] New: - Please add make's keep-going feature into ANT.
Date Fri, 27 Jun 2003 15:17:02 GMT
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: dev@ant.apache.org
        ReportedBy: alexeys@inventigo.com


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: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message