source: trunk/docx4j/build.xml @ 1700

Revision 1700, 11.9 KB checked in by jharrop, 3 months ago (diff)

Basic XHTML import proof of concept, using modified flying saucer library. No support for images or tables yet.
WARNING: Until the modified flying saucer jar is in Maven Central, you'll need to satisfy this dependency yourself,
by building the jar from the source code which is available from  https://github.com/plutext/flyingsaucer

Line 
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<project basedir="." default="build" name="docx4j">
3    <property environment="env"/>
4    <property name="junit.output.dir" value="junit"/>
5    <property name="debuglevel" value="source,lines,vars"/>
6    <property name="target" value="1.5"/>
7    <property name="source" value="1.5"/>
8        <property name="dist" value="./dist"/>
9       
10        <property name="version" value="2.7.1-SNAPSHOT"/>
11
12    <property name="src.main.java.dir" value="src/main/java"/>
13       
14        <property name="m2Repository" value="../../.m2/repository"/>   
15    <path id="Maven Dependencies.libraryclasspath">
16   
17        <pathelement location="${m2Repository}/log4j/log4j/1.2.15/log4j-1.2.15.jar"/>
18        <pathelement location="${m2Repository}/commons-lang/commons-lang/2.4/commons-lang-2.4.jar"/>
19        <pathelement location="${m2Repository}/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar"/>
20        <pathelement location="${m2Repository}/commons-codec/commons-codec/1.3/commons-codec-1.3.jar"/>
21        <pathelement location="${m2Repository}/org/apache/xmlgraphics/xmlgraphics-commons/1.4/xmlgraphics-commons-1.4.jar"/>
22        <pathelement location="${m2Repository}/commons-io/commons-io/1.3.1/commons-io-1.3.1.jar"/>
23        <pathelement location="${m2Repository}/org/apache/xmlgraphics/fop/1.0/fop-1.0.jar"/>
24        <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-api/4.3.1/avalon-framework-api-4.3.1.jar"/>
25        <pathelement location="${m2Repository}/org/apache/avalon/framework/avalon-framework-impl/4.3.1/avalon-framework-impl-4.3.1.jar"/>
26        <!-- Xalan 2.7.1 and dependencies: see further below -->
27        <pathelement location="${m2Repository}/net/arnx/wmf2svg/0.9.0/wmf2svg-0.9.0.jar"/>
28        <pathelement location="${m2Repository}/org/apache/poi/poi-scratchpad/3.8-beta4/poi-scratchpad-3.8-beta4.jar"/>
29        <pathelement location="${m2Repository}/org/apache/poi/poi/3.8-beta4/poi-3.8-beta4.jar"/>
30        <pathelement location="${m2Repository}/com/googlecode/jaxb-namespaceprefixmapper-interfaces/JAXBNamespacePrefixMapper/2.2.4/JAXBNamespacePrefixMapper-2.2.4.jar"/>   
31
32        <pathelement location="${m2Repository}/org/antlr/antlr-runtime/3.3/antlr-runtime-3.3.jar"/>   
33        <pathelement location="${m2Repository}/antlr/antlr/2.7.7/antlr-2.7.7.jar"/>   
34        <pathelement location="${m2Repository}/org/antlr/stringtemplate/3.2.1/stringtemplate-3.2.1.jar"/>
35       
36        <pathelement location="${m2Repository}/org/docx4j/xhtmlrenderer/1.0.0-SNAPSHOT/xhtmlrenderer-1.0.0-SNAPSHOT.jar"/>   
37       
38
39        <!--<pathelement location="${m2Repository}/junit/junit/4.8/junit-4.8.jar"/>-->
40       
41<!-- Uncomment to use the vfs stuff in docx4j-extras
42
43        <pathelement location="${m2Repository}/jdom/jdom/1.0/jdom-1.0.jar"/>
44        <pathelement location="${m2Repository}/org/apache/commons/commons-vfs-patched/1.9.1/commons-vfs-patched-1.9.1.jar"/>
45-->
46
47<!-- Uncomment for load/save via JCR, which
48                may be found in docx4j-extras.         
49        <pathelement location="${m2Repository}/javax/jcr/jcr/1.0/jcr-1.0.jar"/>
50                -->
51 
52<!--    Uncomment for the PDF conversion via HTML or iText, which
53                may be found in docx4j-extras.
54               
55                If you are planning to use that, you'll also want to uncomment
56                the BaseFont stuff in PhysicalFonts.   
57               
58        <pathelement location="${m2Repository}/com/lowagie/itext-unsigned/2.0.8/itext-unsigned-2.0.8.jar"/>     
59            -->     
60<!--    Uncomment for the PDF conversion via HTML, which
61                may be found in docx4j-extras. Note that core-renderer R8pre2 incompatible with iText SVN       
62        <pathelement location="${m2Repository}/pdf-renderer/pdf-renderer/0.2009.0324/pdf-renderer-0.2009.0324.jar"/>
63        <pathelement location="${m2Repository}/xhtmlrenderer/minium/0.1/minium-0.1.jar"/>
64        <pathelement location="${m2Repository}/xhtmlrenderer/core-renderer/R8pre2/core-renderer-R8pre2.jar"/>
65-->
66
67<!-- As from 2010 09 17 source is included (see src/main/java/org/jvnet..)
68         so this is no longer required.
69        <pathelement location="${m2Repository}/org/jvnet/jaxb2_commons/ppp/parent-pointer-plugin/1.0/parent-pointer-plugin-1.0.jar"/>
70 -->
71    </path>
72    <path id="docx4j.classpath">
73        <pathelement location="bin"/>
74        <path refid="Maven Dependencies.libraryclasspath"/>
75    </path>
76
77    <path id="dist.classpath">
78        <pathelement location="${m2Repository}/xalan/xalan/2.7.1/xalan-2.7.1.jar"/>
79        <pathelement location="${m2Repository}/xalan/serializer/2.7.1/serializer-2.7.1.jar"/>
80        <pathelement location="${m2Repository}/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
81        <path refid="docx4j.classpath"/>
82    </path>
83
84    <path id="junit.classpath">
85        <path refid="docx4j.classpath"/>
86        <pathelement location="${m2Repository}/junit/junit/4.8/junit-4.8.jar"/>
87    </path>
88       
89        <path id="jre.libs" description="Java runtime libraries">
90          <pathelement location="${java.home}\lib" />
91         </path>       
92       
93    <target name="init">
94        <mkdir dir="bin"/>
95        <copy includeemptydirs="false" todir="bin">
96            <fileset dir="${src.main.java.dir}" excludes="**/*.launch, **/*.java"/>
97            <fileset dir="src/pptx4j/java" excludes="**/*.launch, **/*.java"/>
98        </copy>
99    </target>
100       
101    <target name="clean">
102        <delete dir="bin"/>
103        <delete dir="dist"/>
104    </target>
105    <target depends="build-project" name="build"/>
106   
107    <target name="build-project" depends="init" >
108        <echo message="${ant.project.name}: ${ant.file}"/>
109        <echo message="${ant.java.version}"/>
110       
111        <javac  bootclasspathref="jre.libs" includeJavaRuntime="yes"
112                debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}"
113                target="${target}">
114            <src path="${src.main.java.dir}"/>
115            <src path="src/diffx"/>
116            <src path="src/glox4j/java"/>
117            <src path="src/pptx4j/java"/>
118            <src path="src/xlsx4j/java"/>
119            <src path="src/svg"/>
120            <src path="src/xslfo"/>
121            <!-- <classpath refid="docx4j.classpath"/> -->
122            <!--  build with earlier than
123
124                                        java version "1.6.0_19" (and possibly later)
125                                        Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
126                                        Java HotSpot(TM) 64-Bit Server VM (build 16.2-b04, mixed mode)
127
128                                 requires  Xalan 2.7.1, so -->
129                        <classpath refid="dist.classpath"/>                             
130        </javac>
131       
132        <!--  Force ant to compile package-info.java.
133              Without these, you'll get JAXB "unexpected element" errors.
134                  This is necessary because of a dubious change in ant behaviour,
135              starting with 1.7.1 (see javac task doc, and ant bug 43114). 
136             
137                          "In Ant 1.7.1 the package-info.java will only be compiled if:
138                               
139                                   1. If a package-info.class file exists and is older than the package-info.java file.
140                                   2. If the directory for the package-info.class file does not exist.
141                                   3. If the directory for the package-info.class file exists, and has an older modification
142                                   time than the the package-info.java file. In this case <javac> will touch the corresponding
143                                   .class directory on successful compilation."             
144              -->
145        <sleep seconds="2"/> <!--  wait a little, so our modifications times are newer -->
146        <touch><fileset dir="${src.main.java.dir}" includes="**/package-info.java" /></touch>       
147        <touch><fileset dir="src/pptx4j/java" includes="**/package-info.java" /></touch>       
148        <javac  bootclasspathref="jre.libs" includeJavaRuntime="yes"
149                debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
150            <src path="${src.main.java.dir}"/>
151            <src path="src/pptx4j/java"/>
152            <src path="src/xlsx4j/java"/>
153            <src path="src/svg"/>
154            <src path="src/xslfo"/>
155                <include name="**/package-info.java"/>
156            <classpath refid="docx4j.classpath"/>
157        </javac>
158
159       
160    </target>
161 
162 
163 <!-- ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist -->
164    <target name="dist"  depends="clean, build-project" >
165                               
166        <mkdir dir="${dist}"/>
167                               
168                <jar destfile="${dist}/docx4j-${version}.jar" basedir="./bin"/>         
169               
170                <!-- copy all the jar files! -->
171                <copy todir="${dist}" flatten="true">
172                        <!-- requires Ant 1.7.0 -->
173                        <path>
174                            <path refid="dist.classpath"/>
175                        </path>
176                </copy>         
177         <delete file="${dist}/JAXBNamespacePrefixMapper-2.2.4.jar" />                 
178    </target>   
179
180
181        <!--  build just diffx; the usual targets build diffx as part of docx4j -->
182    <target name="build-diffx" depends="init" >
183        <echo message="${ant.project.name}: ${ant.file}"/>
184        <javac  bootclasspathref="jre.libs" includeJavaRuntime="yes"
185                debug="true" debuglevel="${debuglevel}" destdir="bin" source="${source}" target="${target}">
186            <src path="src/diffx"/>
187            <classpath refid="docx4j.classpath"/>
188        </javac>
189    </target>
190
191    <target name="diffxjar"  depends="clean, build-diffx" >                                                     
192                <jar destfile="diffx.jar" basedir="./bin"/>                                                                     
193    </target>   
194
195       
196        <target name="javadoc">
197       
198        <delete dir="javadoc"/>
199        <mkdir dir="javadoc"/>
200       
201               
202        <javadoc access="public" author="false"
203         destdir="javadoc"
204         doctitle="docx4j 2.7.0"
205         nodeprecated="false"
206         nodeprecatedlist="false"
207         noindex="false"
208         nonavbar="false"
209         notree="false"
210         source="1.6"
211        sourcepath="src/main/java:src/pptx4j/java:src/xlsx4j/java:src/glox4j/java:src/diffx"
212        splitindex="true" use="true" version="false"
213        maxmemory="512m">
214                    <classpath refid="docx4j.classpath"/>
215        </javadoc>
216               
217<!--           
218      <Doctitle><![CDATA[<h1>docx4j API Documentation</h1>]]></Doctitle>
219      <bottom>
220        <![CDATA[<i>Copyright 2007-2008 Plutext Pty Ltd.</i>]]>
221      </bottom>
222      <group>
223        <title>dml - DrawingML</title>
224        <package name="org.docx4j.dml*"/>
225      </group>
226      <group>
227        <title>wml - WordprocessingML</title>
228        <package name="org.docx4j.wml*"/>
229      </group>
230       -->             
231       
232        </target>
233       
234    <target name="test" depends="dist">
235
236            <path id="tests.classpath">
237                <pathelement location="${dist}/docx4j.jar" />
238                <path refid="Maven Dependencies.libraryclasspath"/>
239                <pathelement location="${m2Repository}/xalan/xalan/2.7.1/xalan-2.7.1.jar"/>
240                <pathelement location="${m2Repository}/xalan/serializer/2.7.1/serializer-2.7.1.jar"/>
241                <pathelement location="${m2Repository}/xml-apis/xml-apis/1.3.04/xml-apis-1.3.04.jar"/>
242                <pathelement location="${m2Repository}/junit/junit/4.8/junit-4.8.jar"/>         
243            </path>     
244       
245        <!--  Make jar containing tests only  -->
246        <delete file="docx4j-tests-only.jar"/>
247        <delete dir="testing"/>
248        <mkdir dir="testing"/>
249        <javac debug="off" destdir="testing" source="${source}" target="${target}">
250            <src path="src/test/java"/>
251            <classpath refid="tests.classpath"/>
252        </javac>
253        <copy includeemptydirs="false" todir="testing">
254            <fileset dir="src/test/resources">
255                <include name="**/*"/>
256            </fileset>
257        </copy>
258                 <jar destfile="docx4j-tests-only.jar">
259                    <fileset dir="./testing" />
260                  </jar>       
261
262            <path id="testsplus.classpath">
263                <pathelement location="docx4j-tests-only.jar" />
264                <path refid="tests.classpath"/>
265            </path>
266       
267        <delete dir="${junit.output.dir}"/>
268        <mkdir dir="${junit.output.dir}"/>
269        <junit fork="yes" printsummary="on" haltonfailure="on">
270            <formatter type="xml"/>
271                  <batchtest fork="yes" todir="${junit.output.dir}">
272                        <resources>
273                                <zipfileset src="docx4j-tests-only.jar" includes="**/*Test.class"/>
274                        </resources>
275                 </batchtest>
276               
277            <classpath refid="testsplus.classpath"/>
278        </junit>
279        <delete dir="testing"/>
280               
281    </target>
282       
283   
284</project>
Note: See TracBrowser for help on using the repository browser.