コード例 #1
0
ファイル: ANTLR.java プロジェクト: saeg/experiments
  public void execute() throws BuildException {
    validateAttributes();

    // TODO: use ANTLR to parse the grammer file to do this.
    if (target.lastModified() > getGeneratedFile().lastModified()) {
      commandline.createArgument().setValue("-o");
      commandline.createArgument().setValue(outputDirectory.toString());
      commandline.createArgument().setValue(target.toString());

      if (fork) {
        log("Forking " + commandline.toString(), Project.MSG_VERBOSE);
        int err = run(commandline.getCommandline());
        if (err == 1) {
          throw new BuildException("ANTLR returned: " + err, location);
        }
      } else {
        Execute.runCommand(this, commandline.getCommandline());
      }
    }
  }
コード例 #2
0
ファイル: ANTLR.java プロジェクト: saeg/experiments
  private void validateAttributes() throws BuildException {
    if (target == null || !target.isFile()) {
      throw new BuildException("Invalid target: " + target);
    }

    // if no output directory is specified, used the target's directory
    if (outputDirectory == null) {
      String fileName = target.toString();
      setOutputdirectory(new File(target.getParent()));
    }
    if (!outputDirectory.isDirectory()) {
      throw new BuildException("Invalid output directory: " + outputDirectory);
    }
    if (fork && (dir == null || !dir.isDirectory())) {
      throw new BuildException("Invalid working directory: " + dir);
    }
  }
コード例 #3
0
ファイル: ANTLR.java プロジェクト: saeg/experiments
 public void setOutputdirectory(File outputDirectory) {
   log("Setting output directory to: " + outputDirectory.toString(), Project.MSG_VERBOSE);
   this.outputDirectory = outputDirectory;
 }
コード例 #4
0
ファイル: ANTLR.java プロジェクト: saeg/experiments
 public void setTarget(File target) {
   log("Setting target to: " + target.toString(), Project.MSG_VERBOSE);
   this.target = target;
 }