コード例 #1
0
  @Override
  public void processFiles(HashSet<OutputFile> output_files, File output_dir) {

    log("Generating dominoes rules...");

    this.output_files = output_files;

    // NOT COMPILED
    rules = new OutputFile(output_dir, rules_file);
    for (OutputFile of : this.output_files) {
      if (of.hasFlag(OutputFile.FLAG_COMPILED)) continue;
      processFile(of, rules);
    }

    // COMPILED
    rules_min = new OutputFile(output_dir, rules_file.replace(".js", ".min.js"));
    for (OutputFile of : this.output_files) {
      if (!of.hasFlag(OutputFile.FLAG_COMPILED)) continue;
      processFile(of, rules_min);
    }

    if (rules.getContents().length() > 0) {
      output_files.add(rules);
    }
    if (rules_min.getContents().length() > 0) {
      output_files.add(rules_min);
    }
  }
コード例 #2
0
  private String generateRule(Module module, OutputFile file) {

    String deps = "";
    if (module.totalDeps() > 0) {
      for (Module dep : module.getDeps()) {
        deps = deps + " " + dep.getPackage().getName() + "." + dep.getName();
      }
      deps = "( " + deps + " ) > ";
    }

    String modname = module.getPackage().getName() + "." + module.getName();

    String modpath = js_root + file.getName();

    return String.format("dominoes.rule('%s','( %s%s )');\n", modname, deps, modpath);
  }
コード例 #3
0
 private void processFile(OutputFile file, OutputFile rules_file) {
   for (Module module : file.getModules()) {
     log("Processing " + module);
     rules_file.appendContents(generateRule(module, file));
   }
 }