dion 2003/10/01 05:42:15
Modified: html2xdoc/xdocs changes.xml
html2xdoc plugin.jelly
Log:
Only process html files if the source directory exists
Revision Changes Path
1.6 +3 -0 maven-plugins/html2xdoc/xdocs/changes.xml
Index: changes.xml
===================================================================
RCS file: /home/cvs/maven-plugins/html2xdoc/xdocs/changes.xml,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- changes.xml 1 Oct 2003 11:32:35 -0000 1.5
+++ changes.xml 1 Oct 2003 12:42:15 -0000 1.6
@@ -8,6 +8,9 @@
<body>
<release version="1.2" date="in CVS">
+ <action dev="dion" type="update">
+ Only try to find files if the source directory exists
+ </action>
<!-- JAMES PUT STUFF HERE -->
</release>
1.10 +41 -38 maven-plugins/html2xdoc/plugin.jelly
Index: plugin.jelly
===================================================================
RCS file: /home/cvs/maven-plugins/html2xdoc/plugin.jelly,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- plugin.jelly 1 Oct 2003 10:43:03 -0000 1.9
+++ plugin.jelly 1 Oct 2003 12:42:15 -0000 1.10
@@ -19,6 +19,7 @@
<j:set var="srcdir" value="${maven.html2xdoc.dir}"/>
<j:if test="${empty(srcdir)}">
+ <!-- FIXME? Should be maven.docs.src -->
<j:set var="srcdir" value="${basedir}/xdocs"/>
</j:if>
@@ -29,53 +30,55 @@
<util:file var="srcdirFile" name="${srcdir}"/>
<j:set var="srcdir" value="${srcdirFile.getCanonicalPath()}"/>
- <util:file var="destdirFile" name="${destdir}"/>
- <j:set var="destdir" value="${destdirFile.getCanonicalPath()}"/>
+ <util:available file="${srcdir}">
+ <util:file var="destdirFile" name="${destdir}"/>
+ <j:set var="destdir" value="${destdirFile.getCanonicalPath()}"/>
- <util:replace var="fromPattern" oldChar="\" newChar="/"
value="${srcdir}/*.html"/>
- <util:replace var="toPattern" oldChar="\" newChar="/" value="${destdir}/*.xml"/>
- <j:setProperties object="${mapper}" from="${fromPattern}" to="${toPattern}"/>
+ <util:replace var="fromPattern" oldChar="\" newChar="/"
value="${srcdir}/*.html"/>
+ <util:replace var="toPattern" oldChar="\" newChar="/"
value="${destdir}/*.xml"/>
+ <j:setProperties object="${mapper}" from="${fromPattern}" to="${toPattern}"/>
- <util:replace var="fromDirPattern" oldChar="\" newChar="/" value="${srcdir}*"/>
- <util:replace var="toDirPattern" oldChar="\" newChar="/" value="${destdir}*"/>
+ <util:replace var="fromDirPattern" oldChar="\" newChar="/"
value="${srcdir}*"/>
+ <util:replace var="toDirPattern" oldChar="\" newChar="/" value="${destdir}*"/>
- <j:new var="dirMapper"
className="org.apache.maven.util.CaseInsensitiveGlobPatternMapper"/>
- <j:setProperties object="${dirMapper}" from="${fromDirPattern}"
to="${toDirPattern}"/>
+ <j:new var="dirMapper"
className="org.apache.maven.util.CaseInsensitiveGlobPatternMapper"/>
+ <j:setProperties object="${dirMapper}" from="${fromDirPattern}"
to="${toDirPattern}"/>
- <ant:fileScanner var="docFiles">
- <ant:fileset dir="${srcdir}">
- <ant:patternset>
- <ant:include name="**/*.html"/>
- </ant:patternset>
- </ant:fileset>
- </ant:fileScanner>
-
- <j:forEach var="file" items="${docFiles.iterator()}">
-
- <!-- tool for converting HTML into XDoc -->
- <j:useBean class="org.apache.maven.html2xdoc.Html2XdocBean" var="htmlTool"/>
-
- <util:replace var="inDirForward" oldChar="\" newChar="/"
value="${file.parent}"/>
- <j:set var="outDir" value="${dirMapper.mapFileName(inDirForward).0}"/>
- <ant:mkdir dir="${outDir}"/>
-
- <!-- generate output file name -->
- <util:replace var="outFileForward" oldChar="\" newChar="/"
value="${file.toString()}"/>
- <j:set var="outFile" value="${mapper.mapFileName(outFileForward).0}"/>
+ <ant:fileScanner var="docFiles">
+ <ant:fileset dir="${srcdir}">
+ <ant:patternset>
+ <ant:include name="**/*.html"/>
+ </ant:patternset>
+ </ant:fileset>
+ </ant:fileScanner>
+
+ <j:forEach var="file" items="${docFiles.iterator()}">
+
+ <!-- tool for converting HTML into XDoc -->
+ <j:useBean class="org.apache.maven.html2xdoc.Html2XdocBean" var="htmlTool"/>
+
+ <util:replace var="inDirForward" oldChar="\" newChar="/"
value="${file.parent}"/>
+ <j:set var="outDir" value="${dirMapper.mapFileName(inDirForward).0}"/>
+ <ant:mkdir dir="${outDir}"/>
+
+ <!-- generate output file name -->
+ <util:replace var="outFileForward" oldChar="\" newChar="/"
value="${file.toString()}"/>
+ <j:set var="outFile" value="${mapper.mapFileName(outFileForward).0}"/>
- <ant:echo>Generating ${outFile} from ${file}</ant:echo>
+ <ant:echo>Generating ${outFile} from ${file}</ant:echo>
- <!-- parse the HTML doc and pass it to the stylesheet -->
- <html:parse var="htmlDoc" html="${file}" element="lower" attribute="lower"/>
+ <!-- parse the HTML doc and pass it to the stylesheet -->
+ <html:parse var="htmlDoc" html="${file}" element="lower" attribute="lower"/>
- <!-- now lets convert the document into XML -->
- <j:set var="xmlDoc" value="${htmlTool.convert(htmlDoc)}"/>
+ <!-- now lets convert the document into XML -->
+ <j:set var="xmlDoc" value="${htmlTool.convert(htmlDoc)}"/>
- <j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml">
- <x:copyOf select="$xmlDoc"/>
- </j:file>
- </j:forEach>
+ <j:file name="${outFile}" encoding="${outputencoding}" outputMode="xml">
+ <x:copyOf select="$xmlDoc"/>
+ </j:file>
+ </j:forEach>
+ </util:available>
</goal>
<preGoal name="xdoc:jelly-transform">
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]