aheritier 2004/05/23 15:02:54 Modified: javadoc plugin.jelly Log: re-ident + code optimization Revision Changes Path 1.39 +77 -68 maven-plugins/javadoc/plugin.jelly Index: plugin.jelly =================================================================== RCS file: /home/cvs/maven-plugins/javadoc/plugin.jelly,v retrieving revision 1.38 retrieving revision 1.39 diff -u -r1.38 -r1.39 --- plugin.jelly 21 May 2004 23:44:08 -0000 1.38 +++ plugin.jelly 23 May 2004 22:02:54 -0000 1.39 @@ -17,7 +17,6 @@ */ --> - <project xmlns:ant="jelly:ant" xmlns:define="jelly:define" @@ -26,9 +25,10 @@ xmlns:util="jelly:util" xmlns:artifact="artifact" xmlns:javadoc="javadoc" + xmlns:maven="jelly:maven" > - <goal name="maven-javadoc-plugin:register"> + <goal name="maven-javadoc-plugin:register"> <javadoc:check-needed/> @@ -38,12 +38,14 @@ pluginName="maven-javadoc-plugin" link="apidocs/index" target="_blank" - description="JavaDoc API documentation."/> + description="JavaDoc API documentation." + /> <doc:registerReport name="JavaDoc Report" pluginName="" link="javadoc" - description="Report on the generation of JavaDoc."/> + description="Report on the generation of JavaDoc." + /> </j:if> </goal> @@ -58,61 +60,77 @@ <define:taglib uri="javadoc"> <define:tag name="check-needed"> - + <j:choose> + <j:when test="${needed != null}"> <!-- We have already decided if javadoc is needed --> </j:when> + <j:when test="${sourcesPresent != 'true'}"> <j:set var="needed" value="false" /> </j:when> + <j:otherwise> - <!-- 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}"> + + <maven:get + var="maven.compile.src.set" + plugin="maven-java-plugin" + property="maven.compile.src.set" + /> + + <!-- Retreive the value of the property ${maven.compile.src.set} --> + <j:if test="${maven.compile.src.set != null}"> + <j:set scope="parent" var="maven.compile.src.set" value="${maven.compile.src.set}"/> + </j:if> + + <!-- If the property ${maven.compile.src.set} isn't defined we use ${pom.build.sourceDirectory} --> + <j:if test="${maven.compile.src.set == null}"> + <j:set scope="parent" var="maven.compile.src.set" value="${pom.build.sourceDirectory}"/> + </j:if> +<ant:echo>COUCOU</ant:echo> + <!-- Create a patternset for source modifications --> + <patternset id="source.modifications"> + <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 --> + </patternset> + + <!-- Tokenize the set of directories --> + <util:tokenize var="sources.dirs" delim="${path.separator}">${maven.compile.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 --> + <patternset refid="source.modifications"/> </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> <!-- dir in maven.javadoc.src.set --> + </j:if> + </j:forEach> <!-- dir in maven.compile.src.set --> </j:otherwise> </j:choose> @@ -183,6 +201,7 @@ <ant:record name="${maven.build.dir}/javadoc/report.txt" action="start" /> <ant:javadoc + packagenames="${pom.package}.*" destdir="${maven.javadoc.destdir}" author="${maven.javadoc.author}" public="${maven.javadoc.public}" @@ -195,33 +214,20 @@ bottom="${copyright}" stylesheetfile="${maven.javadoc.stylesheet}" additionalparam="${maven.javadoc.additionalparam}" - useexternalfile="${maven.javadoc.useexternalfile}"> + useexternalfile="${maven.javadoc.useexternalfile}" + > + + <!-- Tokenize the set of directories --> + <util:tokenize var="sources.dirs" delim="${path.separator}">${maven.compile.src.set}</util:tokenize> - <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 var="dir" items="${sources.dirs}"> + + <echo>[${dir}] added to javadoc sources</echo> + <ant:fileset dir="${dir}"> + <patternset refid="source.modifications"/> + </ant:fileset> - </j:forEach>--> <!-- dir in maven.javadoc.src.set --> + </j:forEach>--> <!-- dir in maven.compile.src.set --> <j:if test="${context.getVariable('maven.javadoc.source') != null}"> <ant:setProperty name="source" value="${maven.javadoc.source}" /> @@ -355,7 +361,7 @@ <ant:copy todir="${maven.javadoc.destdir}"> <util:tokenize var="sources.dirs" delim="${path.separator}"> - ${maven.javadoc.src.set} + ${maven.compile.src.set} </util:tokenize> <j:forEach var="dir" items="${sources.dirs}"> @@ -366,6 +372,9 @@ </ant:copy> </j:if> + <j:if test="${!needed}"> + <ant:echo>No sources found. Javadoc not created !</ant:echo> + </j:if> </goal> <!--==================================================================--> @@ -436,4 +445,4 @@ project="${pom}"/> </goal> -</project> +</project> \ No newline at end of file
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]