示例#1
0
  /**
   * Executes the task.
   *
   * <p>Builds a command line to execute cleartool and then calls Exec's run method to execute the
   * command line.
   *
   * @throws BuildException if the command fails and failonerr is set to true
   */
  public void execute() throws BuildException {
    Commandline commandLine = new Commandline();
    Project aProj = getProject();
    int result = 0;

    // Default the viewpath to basedir if it is not specified
    if (getViewPath() == null) {
      setViewPath(aProj.getBaseDir().getPath());
    }

    // build the command line from what we got the format is
    // cleartool uncheckout [options...] [viewpath ...]
    // as specified in the CLEARTOOL.EXE help
    commandLine.setExecutable(getClearToolCommand());
    commandLine.createArgument().setValue(COMMAND_UNCHECKOUT);

    checkOptions(commandLine);

    if (!getFailOnErr()) {
      getProject()
          .log("Ignoring any errors that occur for: " + getViewPathBasename(), Project.MSG_VERBOSE);
    }
    result = run(commandLine);
    if (Execute.isFailure(result) && getFailOnErr()) {
      String msg = "Failed executing: " + commandLine.toString();
      throw new BuildException(msg, getLocation());
    }
  }
 /** Close the PropertyOutputStream, storing the property. */
 public void close() {
   if (project != null && property != null) {
     String s = new String(toByteArray());
     project.setNewProperty(property, trim ? s.trim() : s);
   }
 }