summaryrefslogtreecommitdiff
path: root/swext/mediawiki/build.xml
blob: 78df3a4281284613dc34a76cf756ffb494afde30 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<?xml version="1.0" encoding="UTF-8"?>
<!--***********************************************************************
 *
  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

  Copyright 2008 by Sun Microsystems, Inc.

  OpenOffice.org - a multi-platform office productivity suite

  $RCSfile: build.xml,v $

  $Revision: 1.19 $

  This file is part of OpenOffice.org.

  OpenOffice.org is free software: you can redistribute it and/or modify
  it under the terms of the GNU Lesser General Public License version 3
  only, as published by the Free Software Foundation.

  OpenOffice.org is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU Lesser General Public License version 3 for more details
  (a copy is included in the LICENSE file that accompanied this code).

  You should have received a copy of the GNU Lesser General Public License
  version 3 along with OpenOffice.org.  If not, see
  <http://www.openoffice.org/license.html>
  for a copy of the LGPLv3 License.

 ************************************************************************ -->
<project default="all">
    <target name="init">
        <property environment="env"/>
        <property name="ext" value="oxt"/>
        <property name="officeroot" value="/export/home/mav/OFFICES/OOG680/m5_netbeans_pro"/>
        <property name="office.home" value="${officeroot}"/>

        <!-- fallbacks for locations, when solenv is not used -->
        <condition property="target" value="wikiaddon">
            <not><isset property="target"/></not>
        </condition>
        <condition property="out" value="./build">
            <not><isset property="out"/></not>
        </condition>
        <condition property="solar.jar" value="${officeroot}/program/classes">
            <not><isset property="solar.jar"/></not>
        </condition>

        <!-- locations used throughout the build -->
        <property name="name" value="wiki-publisher"/>
        <property name="dist" value="${out}/bin"/>
        <property name="classes" value="${out}/class"/>
        <property name="classes.test" value="${out}/class-test"/>
        <property name="officeclasses" value="${solar.jar}"/>

        <!-- build options -->
        <property name="sourcelevel" value="1.4"/>
        <property name="verbose" value="false"/>
        <property name="debug" value="true"/>

        <!-- build classpath -->
        <path id="classpath">
            <pathelement location="${officeclasses}/juh.jar"/>
            <pathelement location="${officeclasses}/jurt.jar"/>
            <pathelement location="${officeclasses}/jut.jar"/>
            <pathelement location="${officeclasses}/ridl.jar"/>
            <pathelement location="${officeclasses}/unoil.jar"/>
            <!-- 3rd party libs -->
            <pathelement location="${commons-codec-jar}"/>
            <pathelement location="${commons-httpclient-jar}"/>
            <pathelement location="${commons-lang-jar}"/>
            <pathelement location="${commons-logging-jar}"/>
        </path>

        <!-- create output directories -->
        <mkdir dir="${classes}"/>
        <mkdir dir="${classes.test}"/>
        <mkdir dir="${dist}"/>
    </target>

    <target name="compile" depends="init">
        <javac debug="${debug}" destdir="${classes}" classpathref="classpath"
               source="${sourcelevel}" verbose="${verbose}">
            <src path="src"/>
        </javac>
    </target>

    <target name="xcucheck" depends="init">
        <condition property="no.merge.present">
            <not>
                <available file="${out}/misc/${target}/merge/org/openoffice/Office/Custom/WikiExtension.xcu" type="file"/>
            </not>
        </condition>
    </target>

    <target name="xcumerge" depends="xcucheck, init" if="no.merge.present">
        <copy todir="${out}/misc/${target}/merge">
            <fileset dir="${out}/misc/${target}/registry/data" includes="**/*.xcu" casesensitive="yes"/>
        </copy>
    </target>

    <target name="jar" depends="compile, init">
        <jar basedir="${classes}" compress="true" jarfile="${dist}/${target}.jar">
            <manifest>
        <!-- FIXME: Set Class-Path correctly for the system case !-->
                <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"/>
                <attribute name="RegistrationClassName" value="com.sun.star.wiki.WikiEditorImpl"/>
            </manifest>
        </jar>
    </target>

    <target name="tmpdir" depends="xcumerge, jar, init">
        <copy todir="${out}/misc/${target}/package_tmp" overwrite="true" encoding="UTF-8">
            <fileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" casesensitive="yes"/>
            <filterset>
                <filter token="WIKIEXTENSIONPRODUCTNAME" value="Wiki Publisher"/>
                <filter token="WIKIEXTENSIONID" value="com.sun.wiki-publisher"/>
                <filter token="WIKIEXTENSIONFILENAME" value="${name}"/>
            </filterset>
        </copy>
        <copy todir="${out}/misc/${target}/package_tmp/help" overwrite="true" encoding="UTF-8">
            <fileset dir="${out}/misc/${target}/help" includes="**/*.xhp" casesensitive="yes"/>
            <filterset>
                <filter token="WIKIEXTENSIONPRODUCTNAME" value="Wiki Publisher"/>
                <filter token="WIKIEXTENSIONID" value="com.sun.wiki-publisher"/>
                <filter token="WIKIEXTENSIONFILENAME" value="${name}"/>
            </filterset>
            <mapper type="regexp" from="^(.*[/\\])com.sun.sun-mediawiki([/\\].*)" to="\1com.sun.wiki-publisher\2"/>
        </copy>
    </target>

    <target name="uno-package" depends="tmpdir, xcumerge, jar, init">
        <delete file="${dist}/${name}.${ext}"/>
        <zip  destfile="${dist}/${name}.${ext}">
            <fileset dir="${out}/misc/${target}/package_tmp" casesensitive="yes"/>
            <fileset dir="${dist}" includes="${target}.jar" casesensitive="yes"/>
            <fileset dir="." includes="images/**,templates/**" casesensitive="yes"/>
            <file file="${commons-codec-jar}"/>
            <file file="${commons-httpclient-jar}"/>
            <file file="${commons-lang-jar}"/>
            <file file="${commons-logging-jar}"/>
            <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml"/>
            <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor"/>
            <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license"/>
            <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license"/>
            <zipfileset dir="help" includes="component.txt" casesensitive="yes" prefix="help"/>
        </zip>
    </target>

    <target name="development-package" depends="jar, init">
        <delete file="${dist}/${target}_develop.zip"/>
        <zip  destfile="${dist}/${target}_develop.zip">
            <fileset dir="${dist}" includes="${target}.jar" casesensitive="yes"/>
            <fileset dir="." includes="images/**,templates/**" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}" includes="description.xml" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/registry/schema/org/openoffice/Office/Custom" includes="*.xcs" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/registry/data/org/openoffice/Office" includes="ProtocolHandler.xcu" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office/Custom" includes="*.xcu" casesensitive="yes"/>
            <fileset dir="${out}/misc/${target}/merge/org/openoffice/Office" includes="*.xcu" casesensitive="yes"/>
            <zipfileset dir="${out}/misc/${target}/help" includes="**/*.xhp" casesensitive="yes" prefix="help"/>
            <zipfileset dir="dialogs" includes="**/*.xdl,**/*.xba,**/*.xlb" casesensitive="yes" prefix="WikiEditor"/>
            <zipfileset dir="src" includes="uno-extension-manifest.xml" casesensitive="yes" fullpath="META-INF/manifest.xml"/>
            <zipfileset dir="${out}/misc/${target}/license" includes="LICENSE*" casesensitive="yes" prefix="license"/>
            <zipfileset dir="src" includes="THIRDPARTYLICENSEREADME.html" casesensitive="yes" prefix="license"/>
            <zipfileset dir="help" includes="component.txt" casesensitive="yes" prefix="help"/>
        </zip>
    </target>

    <target depends="init, jar, uno-package, development-package" description="Build everything." name="all">
        <echo message="${name} built."/>
    </target>

    <target depends="init" description="Clean all build products." name="clean">
        <delete dir="${classes}/com/sun/star/wiki"/>
        <delete dir="${out}/misc/${target}"/>
        <delete dir="${dist}/${target}.jar"/>
        <delete dir="${dist}/${name}.${ext}"/>
        <delete dir="${dist}/${target}_develop.zip"/>
    </target>

    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

    <target name="uno-deploy" description="Deploys UNO extension package" depends="uno-package">
        <echo message="deploying UNO extension package ..."/>
        <echo message="${office.unopkg} add -f ${uno.package.name}"/>
        <exec executable="${office.unopkg}" dir="${office.program.dir}" failonerror="true">
            <arg value="add"/>
            <arg value="-f"/>
            <arg file="${uno.package.name}"/>
        </exec>
    </target>

    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->

    <target name="uno-debug" description="Debugss UNO extension package in Target Office" depends="uno-package">
        <!-- security fail for executing this without netbeans -->
        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
        <!-- start debugger and get connection address jpda.address -->
        <nbjpdastart name="Debug Office" addressproperty="jpda.address" transport="dt_socket">
            <classpath path="${build.classes.dir}"/>
            <sourcepath path="${src.dir}"/>
        </nbjpdastart>
        <!-- register component in temporaary user installation -->
        <echo message="debugging UNO extension package ..."/>
        <echo message="wait until preparation is finished."/>
        <echo message="  deploying UNO extension package for debugging ..."/>
        <echo message="  ${office.unopkg} add -f ${uno.package.name}"/>
        <exec executable="${office.unopkg}" dir="${office.program.dir}">
            <arg value="add"/>
            <arg value="-f"/>
            <arg file="${uno.package.name}"/>
            <env key="UserInstallation" value="${office.debug.user.directory}"/>
        </exec>
        <!-- start Office with debug Java and user installation -->
        <echo message="  starting the Office with ..."/>
        <echo message="  user installation: ${office.debug.user.directory}"/>
        <echo message="  debug options:     &quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
        <echo message="  ${office.soffice}"/>
        <echo message="preparation finished."/>
        <exec executable="${office.soffice}" dir="${office.program.dir}" failonerror="true">
            <env key="UserInstallation" value="${office.debug.user.directory}"/>
            <env key="JAVA_TOOL_OPTIONS" value="&quot;-Xdebug&quot; &quot;-Xrunjdwp:transport=dt_socket,address=${jpda.address}&quot;"/>
        </exec>
   </target>
</project>