Package org.apache.tools.ant.taskdefs

Examples of org.apache.tools.ant.taskdefs.Javadoc


    buildLogger.setMessageOutputLevel(debug ? Project.MSG_DEBUG : Project.MSG_INFO);
    buildLogger.setOutputPrintStream(getContext().out);
    buildLogger.setErrorPrintStream(getContext().err);
    antProject.addBuildListener(buildLogger);
    antProject.setBasedir(ProjectUtils.getPath(project));
    Javadoc javadoc = new Javadoc();
    javadoc.setTaskName("javadoc");
    javadoc.setProject(antProject);
    javadoc.setDestdir(new File(ProjectUtils.getFilePath(project, dest)));
    if (packageNames != null && !packageNames.trim().equals(StringUtils.EMPTY)){
      javadoc.setPackagenames(packageNames);
    }

    // construct classpath
    Path classpath = new Path(antProject);
    String[] paths = ClasspathUtils.getClasspath(javaProject);
    for (String path : paths){
      Path.PathElement pe = classpath.createPathElement();
      pe.setPath(path);
    }
    javadoc.setClasspath(classpath);

    if (files == null){
      // construct sourcepath
      String sourcepath =
        getPreferences().getValue(project, "org.eclim.java.doc.sourcepath");
      if (sourcepath != null && !sourcepath.trim().equals(StringUtils.EMPTY)){
        paths = StringUtils.split(sourcepath, " ");
      }else{
        paths = ClasspathUtils.getSrcPaths(javaProject);
      }
      for (String path : paths){
        FileSet fileset = new FileSet();
        fileset.setProject(antProject);
        fileset.setDir(new File(ProjectUtils.getFilePath(project, path)));
        fileset.setIncludes("**/*.java");
        javadoc.addFileset(fileset);
      }
    }else{
      paths = StringUtils.split(files);
      for (String path : paths){
        javadoc.addSource(
            new Javadoc.SourceFile(
              new File(ProjectUtils.getFilePath(project, path))));
      }
    }

    javadoc.execute();

    return null;
  }
View Full Code Here


     *
     * @param proj The current Project
     */
    protected void generateXML(ProjectInfo proj) {
  String apiname = proj.getName();
  Javadoc jd = initJavadoc("Analyzing " + apiname);
  jd.setDestdir(getDestdir());
  addSourcePaths(jd, proj);

  // Tell Javadoc which packages we want to scan.
  // JDiff works with packagenames, not sourcefiles.
  jd.setPackagenames(getPackageList(proj));
 
  // Create the DocletInfo first so we have a way to use it to add params
  DocletInfo dInfo = jd.createDoclet();
  jd.setDoclet("jdiff.JDiff");
  jd.setDocletPath(new Path(project, jdiffClassPath));
 
  // Now set up some parameters for the JDiff doclet.
  DocletParam dp1 = dInfo.createParam();
  dp1.setName("-apiname");
  dp1.setValue(apiname);
  DocletParam dp2 = dInfo.createParam();
  dp2.setName("-baseURI");
  dp2.setValue("http://www.w3.org");
  // Put the generated file in the same directory as the report
  DocletParam dp3 = dInfo.createParam();
  dp3.setName("-apidir");
  dp3.setValue(getDestdir().toString());
 
  // Execute the Javadoc command to generate the XML file.
  jd.perform();
    }
View Full Code Here

     *
     * @param oldapiname The name of the older version of the project
     * @param newapiname The name of the newer version of the project
     */
    protected void compareXML(String oldapiname, String newapiname) {
  Javadoc jd = initJavadoc("Comparing versions");
  jd.setDestdir(getDestdir());
  jd.setPrivate(true);

  // Tell Javadoc which files we want to scan - a dummy file in this case
  jd.setSourcefiles(jdiffHome + DIR_SEP + "Null.java");
 
  // Create the DocletInfo first so we have a way to use it to add params
  DocletInfo dInfo = jd.createDoclet();
  jd.setDoclet("jdiff.JDiff");
  jd.setDocletPath(new Path(project, jdiffClassPath));
 
  // Now set up some parameters for the JDiff doclet.
  DocletParam dp1 = dInfo.createParam();
  dp1.setName("-oldapi");
  dp1.setValue(oldapiname);
  DocletParam dp2 = dInfo.createParam();
  dp2.setName("-newapi");
  dp2.setValue(newapiname);
  // Get the generated XML files from the same directory as the report
  DocletParam dp3 = dInfo.createParam();
  dp3.setName("-oldapidir");
  dp3.setValue(getDestdir().toString());
  DocletParam dp4 = dInfo.createParam();
  dp4.setName("-newapidir");
  dp4.setValue(getDestdir().toString());

  // Assume that Javadoc reports already exist in ../"apiname"
  DocletParam dp5 = dInfo.createParam();
  dp5.setName("-javadocold");
  dp5.setValue(".." + DIR_SEP + oldapiname + DIR_SEP);
  DocletParam dp6 = dInfo.createParam();
  dp6.setName("-javadocnew");
  dp6.setValue(".." + DIR_SEP + newapiname + DIR_SEP);
 
  if (getStats()) {
      // There are no arguments to this argument
      dInfo.createParam().setName("-stats");
      // We also have to copy two image files for the stats pages
      copyFile(jdiffHome + DIR_SEP + "black.gif",
         getDestdir().toString() + DIR_SEP + "black.gif");
      copyFile(jdiffHome + DIR_SEP + "background.gif",
         getDestdir().toString() + DIR_SEP + "background.gif");
  }
 
  if (getDocchanges()) {
      // There are no arguments to this argument
      dInfo.createParam().setName("-docchanges");
  }
 
  if (getIncompatible()) {
      // There are no arguments to this argument
      dInfo.createParam().setName("-incompatible");
  }

        if(getScript()) {
            dInfo.createParam().setName("-script");
        }

  // Execute the Javadoc command to compare the two XML files
  jd.perform();
    }
View Full Code Here

      javadoc, Project.MSG_INFO);
      return;
  }

  String apiname = proj.getName();
  Javadoc jd = initJavadoc("Javadoc for " + apiname);
  jd.setDestdir(new File(getDestdir().toString() + DIR_SEP + apiname));
  addSourcePaths(jd, proj);

  jd.setPrivate(true);
  jd.setPackagenames(getPackageList(proj));

  // Execute the Javadoc command to generate a regular Javadoc report
  jd.perform();
    }
View Full Code Here

     *
     * @param logMsg String which appears as a prefix in the Ant log
     * @return The new task.Javadoc object
     */
    protected Javadoc initJavadoc(String logMsg) {
  Javadoc jd = new Javadoc();
  jd.setProject(project); // Vital, otherwise Ant crashes
  jd.setTaskName(logMsg);
  jd.setSource(getSource()); // So we can set the language version
  jd.init();

  // Set up some common parameters for the Javadoc task
  if (verboseAnt) {
      jd.setVerbose(true);
  }
  return jd;
    }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.taskdefs.Javadoc

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.