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