xref: /aoo41x/main/swext/mediawiki/build.xml (revision cdf0e10c)
1<?xml version="1.0" encoding="UTF-8"?>
2<!--***********************************************************************
3 *
4  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5
6  Copyright 2000, 2010 Oracle and/or its affiliates.
7
8  OpenOffice.org - a multi-platform office productivity suite
9
10  This file is part of OpenOffice.org.
11
12  OpenOffice.org is free software: you can redistribute it and/or modify
13  it under the terms of the GNU Lesser General Public License version 3
14  only, as published by the Free Software Foundation.
15
16  OpenOffice.org is distributed in the hope that it will be useful,
17  but WITHOUT ANY WARRANTY; without even the implied warranty of
18  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19  GNU Lesser General Public License version 3 for more details
20  (a copy is included in the LICENSE file that accompanied this code).
21
22  You should have received a copy of the GNU Lesser General Public License
23  version 3 along with OpenOffice.org.  If not, see
24  <http://www.openoffice.org/license.html>
25  for a copy of the LGPLv3 License.
26
27 ************************************************************************ -->
28<project default="all">
29    <target name="init">
30        <property environment="env"/>
31        <property name="ext" value="oxt"/>
32        <property name="officeroot" value="/export/home/mav/OFFICES/OOG680/m5_netbeans_pro"/>
33        <property name="office.home" value="${officeroot}"/>
34
35        <!-- fallbacks for locations, when solenv is not used -->
36        <condition property="target" value="wikiaddon">
37            <not><isset property="target"/></not>
38        </condition>
39        <condition property="out" value="./build">
40            <not><isset property="out"/></not>
41        </condition>
42        <condition property="solar.jar" value="${officeroot}/program/classes">
43            <not><isset property="solar.jar"/></not>
44        </condition>
45
46        <!-- locations used throughout the build -->
47        <property name="name" value="wiki-publisher"/>
48        <property name="dist" value="${out}/bin"/>
49        <property name="classes" value="${out}/class"/>
50        <property name="classes.test" value="${out}/class-test"/>
51        <property name="officeclasses" value="${solar.jar}"/>
52
53        <!-- build options -->
54        <property name="sourcelevel" value="1.4"/>
55        <property name="verbose" value="false"/>
56        <property name="debug" value="${antdebug}"/>
57
58        <!-- build classpath -->
59        <path id="classpath">
60            <pathelement location="${officeclasses}/juh.jar"/>
61            <pathelement location="${officeclasses}/jurt.jar"/>
62            <pathelement location="${officeclasses}/ridl.jar"/>
63            <pathelement location="${officeclasses}/unoil.jar"/>
64            <!-- 3rd party libs -->
65            <pathelement location="${commons-codec-jar}"/>
66            <pathelement location="${commons-httpclient-jar}"/>
67            <pathelement location="${commons-lang-jar}"/>
68            <pathelement location="${commons-logging-jar}"/>
69        </path>
70
71        <!-- create output directories -->
72        <mkdir dir="${classes}"/>
73        <mkdir dir="${classes.test}"/>
74        <mkdir dir="${dist}"/>
75    </target>
76
77    <target name="compile" depends="init">
78        <javac debug="${debug}" debuglevel="lines,vars,source" destdir="${classes}" classpathref="classpath"
79               source="${sourcelevel}" verbose="${verbose}">
80            <src path="src"/>
81        </javac>
82    </target>
83
84    <target name="xcucheck" depends="init">
85        <condition property="no.merge.present">
86            <not>
87                <available file="${out}/misc/${target}/merge/org/openoffice/Office/Custom/WikiExtension.xcu" type="file"/>
88            </not>
89        </condition>
90    </target>
91
92    <target name="xcumerge" depends="xcucheck, init" if="no.merge.present">
93        <copy todir="${out}/misc/${target}/merge">
94            <fileset dir="${out}/misc/${target}/registry/data" includes="**/*.xcu" casesensitive="yes"/>
95        </copy>
96    </target>
97
98    <target name="jar" depends="compile, init">
99        <jar basedir="${classes}" compress="true" jarfile="${dist}/${target}.jar">
100            <manifest>
101		<!-- FIXME: Set Class-Path correctly for the system case !-->
102                <attribute name="Class-Path" value="commons-codec-1.3.jar commons-lang-2.3.jar commons-httpclient-3.1.jar commons-logging-1.1.1.jar"/>
103                <attribute name="RegistrationClassName" value="com.sun.star.wiki.WikiEditorImpl"/>
104            </manifest>
105        </jar>
106    </target>
107
108    <target name="tmpdir" depends="xcumerge, jar, init">
109        <copy todir="${out}/misc/${target}/package_tmp" overwrite="true" encoding="UTF-8">
110            <fileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes"/>
111            <fileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes"/>
112            <fileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes"/>
113            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes"/>
114            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" casesensitive="yes"/>
115		<!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378
116            <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/>
117         -->
118            <fileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes"/>
119            <fileset dir="${out}/misc/${target}" includes="help/component.txt" casesensitive="yes"/>
120            <filterset>
121                <filter token="WIKIEXTENSIONPRODUCTNAME" value="Wiki Publisher"/>
122                <filter token="WIKIEXTENSIONID" value="com.sun.wiki-publisher"/>
123                <filter token="WIKIEXTENSIONFILENAME" value="${name}"/>
124            </filterset>
125        </copy>
126    </target>
127
128    <target name="uno-package" depends="tmpdir, xcumerge, jar, init">
129        <delete file="${dist}/${name}.${ext}"/>
130        <zip  destfile="${dist}/${name}.${ext}">
131            <fileset dir="${out}/misc/${target}/package_tmp" casesensitive="yes"/>
132            <fileset dir="${dist}" includes="${target}.jar" casesensitive="yes"/>
133            <file file="${commons-codec-jar}"/>
134            <file file="${commons-httpclient-jar}"/>
135            <file file="${commons-lang-jar}"/>
136            <file file="${commons-logging-jar}"/>
137            <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl"/>
138            <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott"/>
139            <zipfileset dir="${solar.bin}/xslt/export/xsltml" casesensitive="yes" prefix="filter/math"/>
140            <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml"/>
141            <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor"/>
142            <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license"/>
143            <zipfileset dir="${out}/misc/${target}/help" includes="**/*.idxl/*,**/*.*_,**/*.jar" casesensitive="yes" prefix="help"/>
144            <zipfileset dir="${out}/misc/${target}/help" includes="**/*.xhp" casesensitive="yes" prefix="help"/>
145            <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license"/>
146        </zip>
147    </target>
148
149    <target name="development-package" depends="jar, init">
150        <delete file="${dist}/${target}_develop.zip"/>
151        <zip  destfile="${dist}/${target}_develop.zip">
152            <zipfileset dir="${dist}" includes="${target}.jar" casesensitive="yes" filemode="664" dirmode="775"/>
153            <zipfileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes" filemode="664" dirmode="775"/>
154            <zipfileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes" filemode="664" dirmode="775"/>
155            <zipfileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu,Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
156            <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
157            <zipfileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu"  excludes="**/ProtocolHandler.xcu,**/Paths.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
158		<!-- FIXME: currently the build xcu files can not be used since the tag containing x-default attribute is thrown away, issue 99378
159            <fileset dir="${out}/misc/${target}/merge/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
160         -->
161            <zipfileset dir="src/registry/data/org/openoffice/TypeDetection" includes="*.xcu" casesensitive="yes" filemode="664" dirmode="775"/>
162            <zipfileset file="src/filter/odt2mediawiki.xsl" casesensitive="yes" fullpath="filter/odt2mediawiki.xsl" filemode="664" dirmode="775"/>
163            <zipfileset file="src/filter/mediawiki.ott" casesensitive="yes" fullpath="templates/MediaWiki/mediawiki.ott" filemode="664" dirmode="775"/>
164            <zipfileset dir="${out}/misc/${target}/help" includes="component.txt" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/>
165            <zipfileset dir="${out}/misc/${target}_merge/help" includes="**/*.xhp" casesensitive="yes" prefix="help" filemode="664" dirmode="775"/>
166            <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor" filemode="664" dirmode="775"/>
167            <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml" filemode="664" dirmode="775"/>
168            <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license" filemode="664" dirmode="775"/>
169            <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license" filemode="664" dirmode="775"/>
170        </zip>
171    </target>
172
173    <target depends="init, jar, uno-package, development-package" description="Build everything." name="all">
174        <echo message="${name} built."/>
175    </target>
176
177    <target depends="init" description="Clean all build products." name="clean">
178        <delete dir="${classes}/com/sun/star/wiki"/>
179        <delete dir="${out}/misc/${target}"/>
180        <delete dir="${dist}/${target}.jar"/>
181        <delete dir="${dist}/${name}.${ext}"/>
182        <delete dir="${dist}/${target}_develop.zip"/>
183    </target>
184
185    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
186
187    <target name="uno-deploy" description="Deploys UNO extension package" depends="uno-package">
188        <echo message="deploying UNO extension package ..."/>
189        <echo message="${office.unopkg} add -f ${uno.package.name}"/>
190        <exec executable="${office.unopkg}" dir="${office.program.dir}" failonerror="true">
191            <arg value="add"/>
192            <arg value="-f"/>
193            <arg file="${uno.package.name}"/>
194        </exec>
195    </target>
196
197    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
198
199    <target name="uno-debug" description="Debugss UNO extension package in Target Office" depends="uno-package">
200		<!-- security fail for executing this without netbeans -->
201        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
202		<!-- start debugger and get connection address jpda.address -->
203        <nbjpdastart name="Debug Office" addressproperty="jpda.address" transport="dt_socket">
204            <classpath path="${build.classes.dir}"/>
205            <sourcepath path="${src.dir}"/>
206        </nbjpdastart>
207		<!-- register component in temporaary user installation -->
208        <echo message="debugging UNO extension package ..."/>
209        <echo message="wait until preparation is finished."/>
210        <echo message="  deploying UNO extension package for debugging ..."/>
211        <echo message="  ${office.unopkg} add -f ${uno.package.name}"/>
212        <exec executable="${office.unopkg}" dir="${office.program.dir}">
213            <arg value="add"/>
214            <arg value="-f"/>
215            <arg file="${uno.package.name}"/>
216            <env key="UserInstallation" value="${office.debug.user.directory}"/>
217        </exec>
218		<!-- start Office with debug Java and user installation -->
219        <echo message="  starting the Office with ..."/>
220        <echo message="  user installation: ${office.debug.user.directory}"/>
221        <echo message="  debug options:     &quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
222        <echo message="  ${office.soffice}"/>
223        <echo message="preparation finished."/>
224        <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
225            <env key="UserInstallation" value="${office.debug.user.directory}"/>
226            <env key="JAVA_TOOL_OPTIONS" value="&quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
227        </exec>
228   </target>
229</project>
230