2 ############################################################################
3 # This is the Ant build file for writer2latex
4 # Original: Sep 2004 (mgn)
5 # version 1.0.2 (2010-04-26)
6 ############################################################################
8 <project name="w2l" default="help" basedir=".">
10 <!-- set this property to the location of your SO/OOo installation -->
11 <property name="OFFICE_CLASSES" location="/usr/lib/libreoffice/basis-link/program/classes" />
12 <property name="URE_CLASSES" location="/usr/lib/libreoffice/ure/share/java" />
14 <description>writer2latex - build file</description>
16 <target name="help" description="Displays usage information">
17 <echo>Usage: ant <target>
18 The following targets are supported:
20 Build nearly everything
22 Compile all file except the tests.
24 Create the standalone jar file.
26 Create extension packages for OOo
28 Create the distribution packages
30 Create the javadoc documentation in target/javadoc.
35 <!-- configure the directories -->
36 <property name="jarfile" value="writer2latex"/>
37 <property name="basename" value="writer2latex10"/>
38 <property name="distrofile" value="${basename}2.zip" />
39 <!--<property name="sourcedistrofile" value="${basename}source.zip" />-->
40 <property name="src" location="source/java"/>
41 <property name="source.distro" location="source/distro" />
42 <property name="classes" location="target/classes"/>
43 <property name="javadoc" location="target/javadoc"/>
44 <property name="tmp" location="target/tmp"/>
45 <property name="target" location="target"/>
46 <property name="target.lib" location="target/lib"/>
47 <property name="source.idl" location="source/idl"/>
48 <!-- classpath for the application; needs java-uno classes -->
49 <path id="main.class.path">
50 <!-- java uno classes -->
51 <filelist dir="${URE_CLASSES}"
52 files="jurt.jar,juh.jar,ridl.jar"/>
53 <filelist dir="${OFFICE_CLASSES}"
55 <!-- additional uno interfaces generated from idl -->
56 <pathelement path="${source.idl}/writer2latex"/>
57 <pathelement path="${source.idl}/writer2xhtml"/>
61 description="Build nearly everything"
62 depends="javadoc,jar,oxt,distro" />
64 <target name="compile"
65 description="Compile the Java files (without tests)">
66 <!-- create empty output directory for classes if not present -->
67 <mkdir dir="${classes}"/>
68 <!-- compile the application code -->
69 <javac srcdir="${src}"
74 <classpath refid="main.class.path"/>
76 <copy todir="${classes}">
77 <fileset dir="${src}">
78 <include name="**/*.xml"/>
85 description="Create writer2latex jar file containing all compiled classes except OOo components and test cases.">
86 <!-- make a jar from the classes not matching magic testcase identifiers-->
87 <mkdir dir="${target.lib}"/>
88 <jar jarfile="${target.lib}/${jarfile}.jar">
89 <fileset dir="${classes}">
91 <exclude name="**/*Test.class"/>
92 <exclude name="**/AllTests.class"/>
93 <include name="**/*.xml"/>
94 <include name="**/*.class"/>
95 <!-- do not include OOo components in standalone library -->
96 <exclude name="org/**/*"/>
100 <attribute name="Built-By" value="${user.name}"/>
101 <attribute name="Main-Class" value="writer2latex.Application"/>
102 <attribute name="Class-Path" value="jaxp.jar parser.jar"/>
107 <!-- Create extension package for OOo 2.0.4+ -->
110 description="Create extension package for installation with OOo 2.0.4+">
111 <mkdir dir="${target.lib}"/>
112 <mkdir dir="${tmp}"/>
114 <!-- First extension: writer2latex.oxt -->
116 <!-- Create jar with relevant files -->
117 <jar jarfile="${tmp}/writer2latex-filter.jar">
118 <fileset dir="${classes}">
120 <exclude name="**/*Test.class"/>
121 <exclude name="**/AllTests.class"/>
122 <include name="**/*.xml"/>
123 <include name="**/*.class"/>
124 <exclude name="writer2latex/Application.class"/>
125 <exclude name="writer2latex/xhtml/**/*"/>
126 <exclude name="org/openoffice/da/comp/writer2xhtml/**/*"/>
129 <!-- also include uno interface as generated from idl -->
130 <fileset dir="${source.idl}/writer2latex">
131 <include name="org/**/*"/>
134 <attribute name="Built-By" value="${user.name}"/>
135 <!-- OOo needs this to register the filter: -->
136 <attribute name="RegistrationClassName" value="org.openoffice.da.comp.writer2latex.W2LRegistration" />
137 <attribute name="Class-Path" value="jaxp.jar parser.jar"/>
141 <!-- Pack extension -->
142 <zip destfile="${target.lib}/writer2latex.oxt">
143 <zipfileset dir="source/oxt/writer2latex" prefix="" />
144 <zipfileset dir="${tmp}" includes="writer2latex-filter.jar" />
145 <zipfileset dir="${source.idl}/writer2latex" includes="writer2latex.rdb"/>
148 <!-- delete the jar for this extension -->
149 <delete file="${tmp}/writer2latex-filter.jar" />
152 <!-- Second extension: writer2xhtml.oxt -->
154 <!-- Create jar with relevant files -->
155 <jar jarfile="${tmp}/writer2xhtml-filter.jar">
156 <fileset dir="${classes}">
158 <exclude name="**/*Test.class"/>
159 <exclude name="**/AllTests.class"/>
160 <include name="**/*.xml"/>
161 <include name="**/*.class"/>
162 <exclude name="writer2latex/Application.class"/>
163 <exclude name="writer2latex/latex/**/*"/>
164 <exclude name="writer2latex/bibtex/**/*"/>
165 <exclude name="org/openoffice/da/comp/writer2latex/**/*"/>
168 <!-- also include uno interface as generated from idl -->
169 <fileset dir="${source.idl}/writer2xhtml">
170 <include name="org/**/*"/>
173 <attribute name="Built-By" value="${user.name}"/>
174 <!-- OOo needs this to register the filter: -->
175 <attribute name="RegistrationClassName" value="org.openoffice.da.comp.writer2xhtml.W2XRegistration" />
176 <attribute name="Class-Path" value="jaxp.jar parser.jar"/>
180 <!-- Pack extension -->
181 <zip destfile="${target.lib}/writer2xhtml.oxt">
182 <zipfileset dir="source/oxt/writer2xhtml" prefix="" />
183 <zipfileset dir="${tmp}" includes="writer2xhtml-filter.jar" />
184 <zipfileset dir="${source.idl}/writer2xhtml" includes="writer2xhtml.rdb"/>
187 <!-- delete the jar for this extension -->
188 <delete file="${tmp}/writer2xhtml-filter.jar" />
191 <!-- Third extension: xhtml-config-package.oxt (xhtml sample configuration package) -->
193 <zip destfile="${target.lib}/xhtml-config-sample.oxt" basedir="source/oxt/xhtml-config-sample"/>
198 <!-- Create distribution packages -->
199 <target name="distro" depends="jar,oxt"
200 description="Create Writer2LaTeX distribution">
202 <zip destfile="${target.lib}/${distrofile}">
204 <!-- Add misc files (documentation, readmes, scripts etc.) -->
205 <zipfileset dir="${source.distro}" prefix="${basename}"/>
207 <!-- Add default configurations (copied from source tree) -->
208 <zipfileset dir="${src}/writer2latex/latex/config" prefix="${basename}/config" />
209 <zipfileset dir="${src}/writer2latex/xhtml/config" prefix="${basename}/config" />
211 <!-- Add jar and oxt's -->
212 <zipfileset dir="${target.lib}" prefix="${basename}"
213 includes="${jarfile}.jar,writer2latex.oxt,writer2xhtml.oxt,xhtml-config-sample.oxt"/>
216 <!-- Pack the source distribution -->
217 <!--<zip destfile="${target.lib}/${sourcedistrofile}">
218 <zipfileset dir="." includes="source/**/*,build.xml" prefix="${basename}" />
224 description="Remove unneccesary files and directories.">
225 <delete dir="${classes}"/>
226 <delete dir="${javadoc}"/>
227 <delete dir="${target.lib}" />
228 <delete dir="${tmp}" />
231 <target name="javadoc"
232 description="Create JavaDoc HTML pages.">
233 <mkdir dir="${javadoc}" />
245 nodeprecatedlist="false"
246 nodeprecated="false">
247 <classpath refid="main.class.path"/>
248 <packageset dir="${src}" defaultexcludes="yes" />
250 <copy todir="${javadoc}">
251 <fileset dir="${src}">
252 <include name="**/*.gif"/>
253 <include name="**/*.png"/>