void build(List<File> inputs,List<File> dependees,long youngest,BuildService buildService,PrintWriter logger) throws BuildException {
  File outputTimeFile;
  if (output.isDirectory()) {
    outputTimeFile=new File(output,".tstamp");
  }
 else {
    outputTimeFile=output;
  }
  long outputModified=outputTimeFile.lastModified();
  boolean modified=(outputModified == 0L || outputModified < youngest);
  if (modified) {
    File outputDir=output.getParentFile();
    if (!outputDir.exists()) {
      logger.println("mkdir " + outputDir);
      outputDir.mkdirs();
    }
    logger.println("building " + inputs.size() + " files to "+ output);
    Map<String,Object> options=getOptions();
    boolean success=false;
    try {
      success=run(buildService,logger,dependees,inputs,output,options);
      if (!success) {
        throw new BuildException("Failed to build " + output);
      }
    }
  finally {
      if (!success) {
        if (outputTimeFile.exists()) {
          outputTimeFile.delete();
        }
      }
    }
  }
}

void build ( List < File > inputs , List < File > dependees , long youngest , BuildService buildService , PrintWriter logger ) throws BuildException { File outputTimeFile ; if ( output . isDirectory ( ) ) { outputTimeFile = new File ( output , ".tstamp" ) ; } else { outputTimeFile = output ; } long outputModified = outputTimeFile . lastModified ( ) ; boolean modified = ( outputModified == 0L || outputModified < youngest ) ; if ( modified ) { File outputDir = output . getParentFile ( ) ; if ( ! outputDir . exists ( ) ) { logger . println ( "mkdir " + outputDir ) ; outputDir . mkdirs ( ) ; } logger . println ( "building " + inputs . size ( ) + " files to " + output ) ; Map < String , Object > options = getOptions ( ) ; boolean success = false ; try { success = run ( buildService , logger , dependees , inputs , output , options ) ; if ( ! success ) { throw new BuildException ( "Failed to build " + output ) ; } } finally { if ( ! success ) { if ( outputTimeFile . exists ( ) ) { outputTimeFile . delete ( ) ; } } } } }
builds output , throwing a buildexception if build fails .
