Пример #1
0
 private void aggregateLinks(Javadoc task, Resource resource) {
   String path = resource.getResourcePath();
   ArrayList list = new ArrayList();
   Resource[] providers = resource.getAggregatedProviders(Scope.RUNTIME, true, false);
   for (int i = 0; i < providers.length; i++) {
     Resource provider = providers[i];
     if (!provider.getResourcePath().startsWith(path)) {
       String source = provider.getProperty("project.api.root");
       if (null != source) {
         log("Adding provider link: " + source + " from " + provider);
         Javadoc.LinkArgument arg = task.createLink();
         arg.setHref(source);
       }
     }
   }
 }
Пример #2
0
  private void process(final Resource resource, final Path classpath, final File root) {
    log("Preparing javadoc for output to: " + root);

    final Javadoc javadoc = (Javadoc) getProject().createTask(JAVADOC_TASK_NAME);
    javadoc.setTaskName(getTaskName());
    javadoc.init();
    javadoc.setDestdir(root);
    javadoc.setUse(true);
    javadoc.createClasspath().add(classpath);

    String excludes = getPackageExcludes();
    if (null != excludes) {
      javadoc.setExcludePackageNames(excludes);
    }

    Javadoc.PackageName[] excludesList = m_excludes.toArray(new Javadoc.PackageName[0]);
    for (Javadoc.PackageName exclude : excludesList) {
      javadoc.addExcludePackage(exclude);
    }

    final Path source = javadoc.createSourcepath();
    addSourcePath(resource, javadoc, source);

    if (null == m_access) {
      String access = getContext().getProperty(JAVADOC_ACCESS_KEY, "protected");
      AccessType type = new AccessType();
      type.setValue(access);
      javadoc.setAccess(type);
    } else {
      javadoc.setAccess(m_access);
    }

    if ("true".equals(getContext().getProperty(JAVADOC_LINK_SOURCE_KEY, "false"))) {
      javadoc.setLinksource(true);
    }

    aggregateLinks(javadoc, resource);
    Link[] links = m_links.toArray(new Link[0]);
    for (int i = 0; i < links.length; i++) {
      Link link = links[i];
      Javadoc.LinkArgument arg = javadoc.createLink();
      String href = link.getHref();
      log("Adding link: " + href);
      arg.setHref(href);
    }

    final String title = resource.getName() + " API";
    if (null != m_windowTitle) {
      javadoc.setWindowtitle(m_windowTitle);
    } else {
      javadoc.setWindowtitle(title);
    }

    if (null == m_title) {
      javadoc.setDoctitle(title);
    } else {
      javadoc.setDoctitle(m_title);
    }

    if (null != m_overview) {
      javadoc.setOverview(m_overview);
    }

    Group[] groups = getGroups();
    for (int i = 0; i < groups.length; i++) {
      Group group = groups[i];
      Javadoc.GroupArgument jgroup = javadoc.createGroup();
      jgroup.setTitle(group.getTitle());
      Group.Package[] packages = group.getPackages();
      for (int j = 0; j < packages.length; j++) {
        Javadoc.PackageName name = new Javadoc.PackageName();
        name.setName(packages[j].getName());
        jgroup.addPackage(name);
      }
    }

    log("Generating: " + resource.getName() + " API");
    javadoc.execute();
  }