To generate javadoc when sourceModifications are used, we copy in a temporary directory all the needed source files.

Fix MPJAVADOC-32


git-svn-id: https://svn.apache.org/repos/asf/maven/maven-1/plugins/trunk@115749 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
aheritier 2004-07-09 18:54:01 +00:00
parent 81568e17eb
commit fa3b0a0c94
2 changed files with 80 additions and 39 deletions

View File

@ -29,24 +29,27 @@
>
<!-- ================================================================== -->
<!-- Initialize plugin -->
<!-- Test if we need to call javadoc -->
<!-- ================================================================== -->
<goal name="javadoc:init" prereqs="xdoc:init">
<define:taglib uri="javadoc">
<define:tag name="init">
<j:if test="${maven.javadoc.debug}"><ant:echo>javadoc init</ant:echo></j:if>
<!-- internal variables -->
<j:set var="internal.javadoc.jar" value="${maven.build.dir}/${maven.final.name}_javadoc.jar"/>
<j:set var="internal.javadoc.needed" value="null"/>
<j:set var="internal.javadoc.src.set" value="${context.getAntProject().getReferences().get('maven.compile.src.set')}"/>
<j:set var="internal.javadoc.working.dir" value="${maven.build.dir}/javadoc"/>
<!-- internal variables -->
<j:set scope="parent" var="internal.javadoc.jar" value="${maven.build.dir}/${maven.final.name}_javadoc.jar"/>
<j:set scope="parent" var="internal.javadoc.needed" value="null"/>
<j:set scope="parent" var="internal.javadoc.working.dir" value="${maven.build.dir}/javadoc"/>
<j:set scope="parent" var="internal.javadoc.src.tmp" value="${internal.javadoc.working.dir}/src"/>
<j:if test="${maven.javadoc.debug}">
<ant:echo>
<j:if test="${maven.javadoc.debug}">
<ant:echo>
### Debug mode is on ###
==================================
=== java plugin properties ===
==================================
maven.compile.encoding = [${maven.compile.encoding}]
maven.compile.src.set = [${context.getAntProject().getReferences().get('maven.compile.src.set')}]
==================================
=== javadoc plugin properties ===
==================================
@ -80,25 +83,18 @@ maven.javadoc.windowtitle = [${maven.javadoc.windowtitle}]
==================================
internal.javadoc.jar = [${internal.javadoc.jar}]
internal.javadoc.needed = [${internal.javadoc.needed}]
internal.javadoc.src.set = [${internal.javadoc.src.set}]
internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
</ant:echo>
</j:if>
<j:if test="not ${maven.javadoc.debug}">
<ant:echo>
</ant:echo>
</j:if>
<j:if test="not ${maven.javadoc.debug}">
<ant:echo>
### Debug mode is off ###
</ant:echo>
</j:if>
</ant:echo>
</j:if>
</goal>
<ant:mkdir dir="${internal.javadoc.working.dir}"/>
<ant:mkdir dir="${internal.javadoc.src.tmp}"/>
<!-- ================================================================== -->
<!-- Test if we need to call javadoc -->
<!-- ================================================================== -->
<define:taglib uri="javadoc">
<define:tag name="check-needed">
<j:if test="${maven.javadoc.debug}"><ant:echo>check-needed</ant:echo></j:if>
<j:choose>
<j:when test="${internal.javadoc.needed != null}">
@ -108,8 +104,44 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
<j:otherwise>
<!-- test if sourceModifications are defined -->
<j:if test="${pom.build.sourceModifications!=null &amp;&amp; !pom.build.sourceModifications.isEmpty()}">
<j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications used.</ant:echo></j:if>
<util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('maven.compile.src.set')}</util:tokenize>
<ant:copy todir="${internal.javadoc.src.tmp}">
<j:forEach var="dir" items="${sources.dirs}">
<ant:fileset dir="${dir}">
<ant:include name="**/*.java"/>
<ant:include name="**/doc-files/**/*"/>
<!-- 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>
</j:forEach>
</ant:copy>
<ant:path id="internal.javadoc.sources">
<ant:pathelement location="${internal.javadoc.src.tmp}"/>
</ant:path>
</j:if>
<!-- test if sourceModifications aren't defined -->
<j:if test="${pom.build.sourceModifications==null || pom.build.sourceModifications.isEmpty()}">
<j:if test="${maven.javadoc.debug}"><ant:echo>sourceModifications not used.</ant:echo></j:if>
<ant:path id="internal.javadoc.sources">
<ant:pathelement path="${context.getAntProject().getReferences().get('maven.compile.src.set')}"/>
</ant:path>
</j:if>
<!-- Tokenize the set of directories -->
<util:tokenize var="sources.dirs" delim="${path.separator}">${internal.javadoc.src.set}</util:tokenize>
<util:tokenize var="sources.dirs" delim="${path.separator}">${context.getAntProject().getReferences().get('internal.javadoc.sources')}</util:tokenize>
<!-- For each directory -->
<j:forEach var="dir" items="${sources.dirs}">
@ -142,9 +174,9 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
<!-- J A V A D O C S R E P O R T S -->
<!-- ================================================================== -->
<goal name="maven-javadoc-plugin:register">
<goal name="maven-javadoc-plugin:register" prereqs="xdoc:init">
<javadoc:check-needed/>
<javadoc:init/>
<j:if test="${internal.javadoc.needed}">
<doc:registerReport
@ -164,8 +196,15 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
</goal>
<goal name="maven-javadoc-plugin:deregister">
<doc:deregisterReport name="JavaDocs"/>
<doc:deregisterReport name="JavaDoc Report"/>
<javadoc:init/>
<j:if test="${internal.javadoc.needed}">
<doc:deregisterReport name="JavaDocs"/>
<doc:deregisterReport name="JavaDoc Report"/>
</j:if>
</goal>
<!-- ================================================================== -->
@ -173,10 +212,9 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
<!-- ================================================================== -->
<goal name="maven-javadoc-plugin:report"
prereqs="javadoc:init"
description="Generate API documentation">
description="Generate API documentation" prereqs="xdoc:init">
<javadoc:check-needed/>
<javadoc:init/>
<j:if test="${internal.javadoc.needed}">
@ -245,7 +283,7 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
>
<ant:sourcepath>
<ant:path refid="maven.compile.src.set"/>
<ant:path refid="internal.javadoc.sources"/>
</ant:sourcepath>
<j:if test="${context.getVariable('maven.javadoc.source') != null}">
@ -379,6 +417,8 @@ internal.javadoc.working.dir = [${internal.javadoc.working.dir}]
inputText="${inputText}"
output="${genDocs}/javadoc.xml"/>
<ant:delete dir="${internal.javadoc.src.tmp}"/>
</j:if>
<j:if test="not ${internal.javadoc.needed}">

View File

@ -24,6 +24,7 @@
</properties>
<body>
<release version="1.5.1-SNAPSHOT" date="In CVS">
<action dev="aheritier" type="fix" issue="MPJAVADOC-32" due-to="Guillaume Nodet">The maven-javadoc-plugin:register failed in javadoc plugin 1.5.1-SNAPSHOT.</action>
<action dev="aheritier" type="fix" issue="MPJAVADOC-31" due-to="Takayoshi Kimura">Use the property 'maven.compile.encoding' to set the encoding used when reading sources in javadoc task.</action>
<action dev="aheritier" type="add" issue="MPJAVADOC-30" due-to="Maarten Coene">Use the property 'maven.javadoc.excludepackagenames' to exclude packages from javadoc generation.</action>
<action dev="aheritier" type="fix" issue="MPJAVADOC-29">Packages list broken on jdk 1.3 for multiple packages.</action>
@ -32,7 +33,7 @@
<action dev="aheritier" type="fix" issue="MPJAVADOC-26" due-to="Denis McLaughlin">Fix the needed flag when there's an empty sources directory.</action>
<action dev="aheritier" type="fix" issue="MPJAVADOC-24">doc-files directories contents are correctly copied.</action>
<action dev="aheritier" type="fix" issue="MPJAVADOC-16">Failure to generate relative cross-references to local classes.</action>
<action dev="brett" type="fix" issue="MPJAVADOC-5">Add support for multiple source directories. SourceModifications aren't supported !!!</action>
<action dev="brett" type="fix" issue="MPJAVADOC-5">Add support for multiple source directories.</action>
</release>
<release version="1.5" date="2004-05-15">
<action dev="dion" type="fix">javadoc:jar changed to place the jar in maven.build.dir</action>