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