MPJAVADOC-5 : enabling javadoc for maven.compile.src.set

git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115394 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier committed 2004-05-21 23:44:09 +00:00
1 parent 6bfe74e607
commit 11b17f8c5e
6 files changed
+141 -38

No files matched your search

+88 -33
View File
@@ -67,29 +67,53 @@
<j:set var="needed" value="false" />
</j:when>
<j:otherwise>
<ant:fileset id="sourceSet" dir="${pom.build.sourceDirectory}">
<ant:include name="**/*.java"/>
<!-- FIXME: This is a bad cut and paste -->
<!-- handle source modifications -->
<j:forEach var="sm" items="${pom.build.sourceModifications}">
<ant:available property="classPresent" classname="${sm.className}"/>
<j:if test="${classPresent != 'true'}">
<j:forEach var="exclude" items="${sm.excludes}">
<ant:exclude name="${exclude}"/>
</j:forEach>
<j:forEach var="include" items="${sm.includes}">
<ant:include name="${include}"/>
</j:forEach>
<!-- Retreive the value of the property ${maven.compile.src.set} -->
<j:if test="${context.getVariable('maven.compile.src.set') != null}">
<j:set scope="parent" var="maven.javadoc.src.set" value="${context.getVariable('maven.compile.src.set')}"/>
</j:if>
<!-- If the property ${maven.compile.src.set} isn't defined we use ${pom.build.sourceDirectory} -->
<j:if test="${context.getVariable('maven.compile.src.set') == null}">
<j:set scope="parent" var="maven.javadoc.src.set" value="${pom.build.sourceDirectory}"/>
</j:if>
<!-- Tokenize the set of directories -->
<util:tokenize var="sources.dirs" delim="${path.separator}">${maven.javadoc.src.set}</util:tokenize>
<!-- Counter used to name filesets -->
<j:set var="src.set.counter" value="0"/>
<!-- For each directory -->
<j:forEach var="dir" items="${sources.dirs}">
<!-- If we have not already find sources -->
<j:if test="${needed == null}">
<!-- We construct the fileset -->
<ant:fileset id="${src.set.counter}" dir="${dir}">
<ant:include name="**/*.java"/>
<!-- handle source modifications -->
<j:forEach var="sm" items="${pom.build.sourceModifications}">
<ant:available property="classPresent" classname="${sm.className}"/>
<j:if test="${classPresent != 'true'}">
<j:forEach var="exclude" items="${sm.excludes}">
<ant:exclude name="${exclude}"/>
</j:forEach> <!-- end sourceModification exclude -->
<j:forEach var="include" items="${sm.includes}">
<ant:include name="${include}"/>
</j:forEach> <!-- end sourceModification include -->
</j:if>
</j:forEach> <!-- end sourceModification -->
</ant:fileset>
<ant:fileScanner var="sources">
<ant:fileset refid="${src.set.counter}" />
</ant:fileScanner>
<j:set var="needed" scope="parent"
value="${sources.iterator().hasNext()}" />
<j:set var="src.set.counter" value="${src.set.counter + 1}"/>
</j:if>
</j:forEach>
</ant:fileset>
</j:forEach> <!-- dir in maven.javadoc.src.set -->
<ant:fileScanner var="sources">
<ant:fileset refid="sourceSet" />
</ant:fileScanner>
<j:set var="needed" scope="parent"
value="${sources.iterator().hasNext()}" />
</j:otherwise>
</j:choose>
@@ -109,7 +133,7 @@
description="Generate API documentation">
<javadoc:check-needed/>
<j:if test="${needed}">
<ant:mkdir dir="${maven.javadoc.destdir}"/>
@@ -137,7 +161,7 @@
<j:if test="${empty(online)}">
<j:set var="online" value="${maven.mode.online}"/>
</j:if>
<j:choose>
<j:when test="${online}">
<util:tokenize var="links" delim="," trim="true">${maven.javadoc.links}</util:tokenize>
@@ -157,7 +181,7 @@
<ant:mkdir dir="${maven.build.dir}/javadoc/" />
<ant:record name="${maven.build.dir}/javadoc/report.txt" action="start" />
<ant:javadoc
destdir="${maven.javadoc.destdir}"
author="${maven.javadoc.author}"
@@ -173,8 +197,31 @@
additionalparam="${maven.javadoc.additionalparam}"
useexternalfile="${maven.javadoc.useexternalfile}">
<!-- sourceSet is set by the javadoc:check-needed function -->
<ant:fileset refid="sourceSet" />
<util:tokenize var="sources.dirs" delim="${path.separator}">
${maven.javadoc.src.set}
</util:tokenize>
<j:forEach var="dir" items="${sources.dirs}">
<echo>[${dir}] added to javadoc sources</echo>
<ant:fileset dir="${dir}">
<ant:include name="**/*.java"/>
<!-- handle source modifications -->
<j:forEach var="sm" items="${pom.build.sourceModifications}">
<ant:available property="classPresent" classname="${sm.className}"/>
<j:if test="${classPresent != 'true'}">
<j:forEach var="exclude" items="${sm.excludes}">
<ant:exclude name="${exclude}"/>
</j:forEach> <!-- sourceModification exclude -->
<j:forEach var="include" items="${sm.includes}">
<ant:include name="${include}"/>
</j:forEach> <!-- sourceModification include -->
</j:if>
</j:forEach> <!-- sourceModification -->
</ant:fileset>
</j:forEach>--> <!-- dir in maven.javadoc.src.set -->
<j:if test="${context.getVariable('maven.javadoc.source') != null}">
<ant:setProperty name="source" value="${maven.javadoc.source}" />
@@ -189,12 +236,12 @@
<j:choose>
<!-- I am bad with jelly, the test is: "pos == -1" -->
<j:when test="${1+pos == 0}">
<j:set var="href" value="${link.trim()}" />
<j:set var="packagelistLoc" value="${href}"/>
<j:set var="href" value="${link.trim()}" />
<j:set var="packagelistLoc" value="${href}"/>
</j:when>
<j:otherwise>
<j:set var="href" value="${link.substring(0,pos).trim()}"/>
<j:set var="packagelistLoc" value="${link.substring(pos).substring(1).trim()}"/>
<j:set var="href" value="${link.substring(0,pos).trim()}"/>
<j:set var="packagelistLoc" value="${link.substring(pos).substring(1).trim()}"/>
</j:otherwise>
</j:choose>
@@ -261,6 +308,7 @@
</j:forEach>
</ant:javadoc>
<ant:record name="${maven.build.dir}/javadoc/report.txt" action="stop" />
<j:set var="genDocs" value="${maven.gen.docs}" />
@@ -305,9 +353,16 @@
We must do it manually.
-->
<ant:copy todir="${maven.javadoc.destdir}">
<ant:fileset dir="${pom.build.sourceDirectory}">
<ant:include name="**/doc-files/**/*"/>
</ant:fileset>
<util:tokenize var="sources.dirs" delim="${path.separator}">
${maven.javadoc.src.set}
</util:tokenize>
<j:forEach var="dir" items="${sources.dirs}">
<ant:fileset dir="${dir}">
<ant:include name="**/doc-files/**/*"/>
</ant:fileset>
</j:forEach>
</ant:copy>
</j:if>
+36 -5
View File
@@ -16,22 +16,53 @@
*/
-->
<project xmlns:util="jelly:util"
xmlns:maven="jelly:maven"
xmlns:j="jelly:core"
xmlns:assert="assert">
xmlns:assert="assert"
xmlns:ant="jelly:ant">
<goal name="testPlugin" prereqs="test-javadoc,test-javadoc-jar">
<goal name="testPlugin" prereqs="test-javadoc,test-javadoc-multi-src,test-javadoc-jar">
</goal>
<goal name="test-javadoc">
<delete dir="${maven.build.dir}" failonerror="false"/>
<attainGoal name="maven-javadoc-plugin:report"/>
<assert:assertFileExists file="${maven.build.dir}/docs/apidocs/index.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/index.html"/>
<!-- assert that doc-files are copied - Issue MPJAVADOC-24 -->
<assert:assertFileExists file="${maven.build.dir}/docs/apidocs/org/apache/maven/doc-files/example.txt"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/doc-files/example.txt"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven2/doc-files/example.txt"/>
<!-- assert that javadoc for classes Dummy, Dummy2, Dummy3, Dummy5, Dummy6 are generated -->
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/Dummy.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/Dummy2.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven2/Dummy3.html"/>
</goal>
<goal name="test-javadoc-multi-src">
<delete dir="${maven.build.dir}" failonerror="false"/>
<ant:path id="maven.javadoc.src.set">
<ant:fileset dir="${basedir}/src/main"/>
<ant:fileset dir="${basedir}/src/opt"/>
</ant:path>
<maven:addPath id="maven.compile.src.set" refid="maven.javadoc.src.set"/>
<attainGoal name="maven-javadoc-plugin:report"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/index.html"/>
<!-- assert that doc-files are copied - Issue MPJAVADOC-24 -->
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/doc-files/example.txt"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven2/doc-files/example.txt"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven3/doc-files/example.txt"/>
<!-- assert that javadoc for classes Dummy, Dummy2, Dummy3, Dummy5, Dummy6 are generated -->
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/Dummy.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven/Dummy2.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven2/Dummy3.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven3/Dummy5.html"/>
<assert:assertFileExists file="${maven.javadoc.destdir}/org/apache/maven3/Dummy6.html"/>
</goal>
<!-- maven.compile.src.set=${basedir}/src/main${path.separator}${basedir}/src/opt -->
<goal name="test-javadoc-jar">
<delete file="${maven.build.dir}/${maven.final.name}_javadoc.jar" failonerror="false"/>
<delete file="${maven.build.dir}/${maven.final.name}_javadoc.jar" failonerror="false"/>
<attainGoal name="javadoc:jar"/>
<assert:assertFileExists file="${maven.build.dir}/${maven.final.name}_javadoc.jar"/>
</goal>
@@ -0,0 +1,6 @@
package org.apache.maven3;
public class Dummy5
{
public String badChecky = "error";
}
@@ -0,0 +1,6 @@
package org.apache.maven3;
public class Dummy6
{
public String badChecky = "error";
}
@@ -0,0 +1 @@
This an example
@@ -0,0 +1,4 @@
<html>
<head></head>
<body>Package documentation.<br/> <a href="doc-files/example.txt">example.txt in doc-files directory.</a></body>
</html>