xref: /trunk/main/scripting/workben/build.xml (revision cdf0e10c)
1<!--
2
3  DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4
5  Copyright 2000, 2010 Oracle and/or its affiliates.
6
7  OpenOffice.org - a multi-platform office productivity suite
8
9  This file is part of OpenOffice.org.
10
11  OpenOffice.org is free software: you can redistribute it and/or modify
12  it under the terms of the GNU Lesser General Public License version 3
13  only, as published by the Free Software Foundation.
14
15  OpenOffice.org is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  GNU Lesser General Public License version 3 for more details
19  (a copy is included in the LICENSE file that accompanied this code).
20
21  You should have received a copy of the GNU Lesser General Public License
22  version 3 along with OpenOffice.org.  If not, see
23  <http://www.openoffice.org/license.html>
24  for a copy of the LGPLv3 License.
25
26-->
27<project name="Scipting Framework Installer" default="jar" basedir=".">
28
29  <!-- =================== Environmental Properties ======================= -->
30
31  <property name="prj" value=".."/>
32  <property file="${prj}/java/build.env"/>
33  <property name="build.compiler"   value="classic"/>
34  <property name="optimize"   value="on"/>
35  <property name="debug"   value="on"/>
36  <property name="installerclasses" value="${out}/class/sframeworkinstall"/>
37  <property name="jardir" value="${out}/class"/>
38  <property name="bindir" value="${out}/bin"/>
39  <property name="sfversion" value="0.3"/>
40  <property name="installerjarname" value="SFrameworkInstall.jar"/>
41  <property environment="env"/>
42
43  <!-- ==================== classpath setting ============================ -->
44  <path id="idlclasspath">
45    <pathelement location="${solar.jar}/unoil.jar"/>
46    <!-- <pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/>  -->
47    <pathelement location="${solar.jar}/jurt.jar"/>
48    <pathelement location="${solar.jar}/juh.jar"/>
49    <pathelement location="${solar.jar}/java_uno.jar"/>
50    <pathelement location="${solar.jar}/ridl.jar"/>
51  </path>
52  <path id="scriptexampleclasspath">
53    <pathelement location="${solar.jar}/unoil.jar"/>
54    <!-- pathelement location="${prj}/../unoil/${inpath}/class/unoil.jar"/ -->
55    <pathelement location="${solar.jar}/jurt.jar"/>
56    <pathelement location="${solar.jar}/juh.jar"/>
57    <pathelement location="${solar.jar}/java_uno.jar"/>
58    <pathelement location="${solar.jar}/ridl.jar"/>
59    <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/>
60  </path>
61
62  <path id="debuggerclasspath">
63    <pathelement location="${out}/class/ScriptRuntimeForJava.jar"/>
64    <pathelement location="${solar.jar}/ridl.jar"/>
65    <pathelement location="${solar.jar}/unoil.jar"/>
66    <pathelement location="${out}/class/jsruntime/skip_registration/js.jar"/>
67    <pathelement location="${install.dir}/bsh-1.2b7.jar"/>
68  </path>
69  <!-- ===================== Set up build conditionals ========================= -->
70  <target name="product.test">
71      <condition property="noproext">
72            <equals arg1="$${env.PROEXT}" arg2="${env.PROEXT}"/>
73      </condition>
74  </target>
75  <target name="nonproduct.set" if="noproext">
76      <echo message="non-product build"/>
77      <property name="proext" value=""/>
78  </target>
79  <target name="product.set" unless="noproext">
80      <echo message="product build"/>
81      <property name="proext" value="${env.PROEXT}"/>
82  </target>
83  <target name="build.conditions" depends="product.test,nonproduct.set,product.set">
84      <condition property="win9.build">
85            <available file="${prj}/wntmsci9${proext}"/>
86      </condition>
87      <condition property="win8.build">
88            <available file="${prj}/wntmsci8${proext}"/>
89      </condition>
90      <condition property="win7.build">
91            <available file="${prj}/wntmsci7${proext}"/>
92      </condition>
93      <condition property="linx86.build">
94            <available file="${prj}/unxlngi5${proext}"/>
95      </condition>
96      <condition property="solsparc.build">
97            <available file="${prj}/unxsols4${proext}"/>
98      </condition>
99      <!-- <condition property="openoffice.build">
100      </condition> -->
101  </target>
102  <!-- ===================== Build the examples ========================= -->
103  <target name="buildexamples">
104
105    <mkdir dir="${out}/class/examples/java/debugger"/>
106    <javac srcdir="${prj}/examples/java/debugger"
107           destdir="${out}/class/examples/java/debugger"
108       	   includes="*.java"
109           classpathref="debuggerclasspath"
110	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
111
112    <copy todir="${out}/class/examples/java/debugger">
113        <fileset dir="${prj}/examples/java/debugger">
114            <include name="**/*.java"/>
115            <include name="*.xml"/>
116        </fileset>
117    </copy>
118
119    <jar jarfile="${out}/class/examples/java/debugger/debugger.jar"
120        basedir="${out}/class/examples/java/debugger" includes="*.class">
121        <manifest>
122            <attribute name="Built-By" value="Sun Microsystems"/>
123            <attribute name="ScriptFramework-Version" value="${sfversion}"/>
124        </manifest>
125    </jar>
126
127    <delete>
128        <fileset dir="${out}/class/examples/java/debugger" includes="*.class"/>
129    </delete>
130
131    <mkdir dir="${out}/class/examples/java/Highlight"/>
132    <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/Highlight/"
133       	   includes="**/Highlight*.java" classpathref="idlclasspath"
134	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
135    <copy todir="${out}/class/examples/java/Highlight/">
136        <fileset dir="${prj}/examples/java/">
137            <include name="**/Highlight*.java"/>
138        </fileset>
139    </copy>
140    <copy file="${prj}/examples/java/HighlightTextParcel.xml" tofile="${out}/class/examples/java/Highlight/parcel-descriptor.xml"/>
141    <jar jarfile="${out}/class/examples/java/Highlight/Highlight.jar"
142        basedir="${out}/class/examples/java/Highlight"
143        includes="**/*.java,**/*.class,**/*.xml"
144        excludes="${out}/class/examples/java/Highlight/Highlight.jar">
145        <manifest>
146            <attribute name="Built-By" value="Sun Microsystems"/>
147            <attribute name="ScriptFramework-Version" value="${sfversion}"/>
148        </manifest>
149    </jar>
150    <mkdir dir="${out}/class/examples/java/MemoryUsage"/>
151    <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/MemoryUsage/"
152       	   includes="**/MemoryUsage.java" classpathref="idlclasspath"
153	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
154    <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/>
155    <copy file="${prj}/examples/java/MemoryUsageParcel.xml" tofile="${out}/class/examples/java/MemoryUsage/parcel-descriptor.xml"/>
156    <copy file="${prj}/examples/java/MemoryUsage.java" todir="${out}/class/examples/java/MemoryUsage/"/>
157    <copy file="${prj}/examples/java/ExampleSpreadSheet.sxc" todir="${out}/class/examples/java/MemoryUsage/"/>
158
159    <mkdir dir="${out}/class/examples/java/ScriptFrmwrkHelper"/>
160    <javac srcdir="${prj}/examples/java/" destdir="${out}/class/examples/java/ScriptFrmwrkHelper/"
161       	   includes="**/ScriptFrmwrkHelper.java" classpathref="scriptexampleclasspath"
162	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
163    <copy todir="${out}/class/examples/java/ScriptFrmwrkHelper/">
164        <fileset dir="${prj}/examples/java/">
165            <include name="**/ScriptFrmwrkHelper.java"/>
166        </fileset>
167    </copy>
168    <copy file="${prj}/examples/java/ScriptFrameWkHelperParcel.xml" tofile="${out}/class/examples/java/ScriptFrmwrkHelper/parcel-descriptor.xml"/>
169    <jar jarfile="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar"
170        basedir="${out}/class/examples/java/ScriptFrmwrkHelper"
171        includes="**/*.java,**/*.class,**/*.xml"
172        excludes="${out}/class/examples/java/ScriptFrmwrkHelper/ScriptFrmwrkHelper.jar">
173        <manifest>
174            <attribute name="Built-By" value="Sun Microsystems"/>
175            <attribute name="ScriptFramework-Version" value="${sfversion}"/>
176        </manifest>
177    </jar>
178    <mkdir dir="${out}/class/examples/beanshell"/>
179    <copy todir="${out}/class/examples/beanshell">
180        <fileset dir="${prj}/examples/beanshell" includes="**"/>
181    </copy>
182    <mkdir dir="${out}/class/examples/javascript"/>
183    <copy todir="${out}/class/examples/javascript">
184        <fileset dir="${prj}/examples/javascript" includes="**"/>
185    </copy>
186  </target>
187
188  <!-- ===================== Build UNO package ========================= -->
189  <target name="buildunopackage_win9" depends="build.conditions" if="win9.build">
190    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
191    <mkdir dir="${out}/class/sframework"/>
192    <copy file="${solar.bin}/ScriptFramework.rdb"
193        todir="${out}/class/sframework/"/>
194    <copy file="${out}/class/ScriptRuntimeForJava.jar"
195        todir="${out}/class/sframework/"/>
196    <copy file="${out}/class/ScriptFramework.jar"
197        todir="${out}/class/sframework/"/>
198    <mkdir dir="${out}/class/sframework/windows.plt"/>
199    <copy todir="${out}/class/sframework/windows.plt">
200        <fileset dir="${prj}/wntmsci9${proext}/bin/">
201            <include name="**/*.dll"/>
202        </fileset>
203    </copy>
204    <mkdir dir="${out}/class/sframework/skip_registration"/>
205    <copy file="${solar.jar}/unoil.jar"
206        todir="${out}/class/sframework/skip_registration"/>
207  </target>
208  <target name="buildunopackage_win8" depends="build.conditions" if="win8.build">
209    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
210    <mkdir dir="${out}/class/sframework"/>
211    <copy file="${solar.bin}/ScriptFramework.rdb"
212        todir="${out}/class/sframework/"/>
213    <copy file="${out}/class/ScriptRuntimeForJava.jar"
214        todir="${out}/class/sframework/"/>
215    <copy file="${out}/class/ScriptFramework.jar"
216        todir="${out}/class/sframework/"/>
217    <mkdir dir="${out}/class/sframework/windows.plt"/>
218    <copy todir="${out}/class/sframework/windows.plt">
219        <fileset dir="${prj}/wntmsci8${proext}/bin/">
220            <include name="**/*.dll"/>
221        </fileset>
222    </copy>
223    <mkdir dir="${out}/class/sframework/skip_registration"/>
224    <copy file="${solar.jar}/unoil.jar"
225        todir="${out}/class/sframework/skip_registration"/>
226  </target>
227<!--  <target name="buildunopackage_win7" depends="build.conditions" if="win7.build">
228    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
229    <mkdir dir="${out}/class/sframework"/>
230    <copy file="${solar.bin}/ScriptFramework.rdb"
231        todir="${out}/class/sframework/"/>
232    <copy file="${out}/class/ScriptRuntimeForJava.jar"
233        todir="${out}/class/sframework/"/>
234    <copy file="${out}/class/ScriptFramework.jar"
235        todir="${out}/class/sframework/"/>
236    <mkdir dir="${out}/class/sframework/windows.plt"/>
237    <copy todir="${out}/class/sframework/windows.plt">
238        <fileset dir="${prj}/wntmsci7${proext}/bin/">
239            <include name="**/*.dll"/>
240        </fileset>
241    </copy>
242    <mkdir dir="${out}/class/sframework/skip_registration"/>
243    <copy file="${solar.jar}/unoil.jar"
244        todir="${out}/class/sframework/skip_registration"/>
245  </target> -->
246  <target name="buildunopackage_linux" depends="build.conditions" if="linx86.build">
247    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
248    <mkdir dir="${out}/class/sframework"/>
249    <copy file="${solar.bin}/ScriptFramework.rdb"
250        todir="${out}/class/sframework/"/>
251    <copy file="${out}/class/ScriptRuntimeForJava.jar"
252        todir="${out}/class/sframework/"/>
253    <copy file="${out}/class/ScriptFramework.jar"
254        todir="${out}/class/sframework/"/>
255    <mkdir dir="${out}/class/sframework/linux_x86.plt"/>
256    <copy todir="${out}/class/sframework/linux_x86.plt">
257        <fileset dir="${prj}/unxlngi5${proext}/lib/">
258            <include name="**/lib*.so"/>
259        </fileset>
260    </copy>
261    <mkdir dir="${out}/class/sframework/skip_registration"/>
262    <copy file="${solar.jar}/unoil.jar"
263        todir="${out}/class/sframework/skip_registration"/>
264  </target>
265  <target name="buildunopackage_solaris" depends="build.conditions" if="solsparc.build">
266    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
267    <mkdir dir="${out}/class/sframework"/>
268    <copy file="${solar.bin}/ScriptFramework.rdb"
269        todir="${out}/class/sframework/"/>
270    <copy file="${out}/class/ScriptRuntimeForJava.jar"
271        todir="${out}/class/sframework/"/>
272    <copy file="${out}/class/ScriptFramework.jar"
273        todir="${out}/class/sframework/"/>
274    <mkdir dir="${out}/class/sframework/solaris_sparc.plt"/>
275    <copy todir="${out}/class/sframework/solaris_sparc.plt">
276        <fileset dir="${prj}/unxsols4${proext}/lib/">
277            <include name="**/lib*.so"/>
278        </fileset>
279    </copy>
280    <mkdir dir="${out}/class/sframework/skip_registration"/>
281    <copy file="${solar.jar}/unoil.jar"
282        todir="${out}/class/sframework/skip_registration"/>
283  </target>
284  <target name="buildunopackage" depends="buildunopackage_win8,buildunopackage_linux,buildunopackage_solaris">
285  <!-- <target name="buildunopackage" depends="buildunopackage_win9,buildunopackage_win7,buildunopackage_linux,buildunopackage_solaris"> -->
286    <copy file="installer/ProtocolHandler.xcu"
287        todir="${out}/class/sframework/"/>
288    <zip zipfile="${out}/class/sframeworkinstall/sframework/ooscriptframe.zip"
289        basedir="${out}/class/sframework">
290    </zip>
291  </target>
292
293  <!-- ================== Build JavaScript UNO package ===================== -->
294  <target name="buildjsuno">
295    <mkdir dir="${out}/class/sframeworkinstall/sframework"/>
296
297    <mkdir dir="${out}/class/jsruntime"/>
298    <mkdir dir="${out}/class/jsruntime/skip_registration"/>
299    <mkdir dir="${out}/class/jsruntimetmp"/>
300
301    <copy file="${out}/class/ScriptRuntimeForJavaScript.jar"
302        todir="${out}/class/jsruntime/"/>
303    <copy file="installer/Scripting.JavaScript.xcu"
304        tofile="${out}/class/jsruntime/Scripting.xcu"/>
305
306    <unzip src="${install.dir}/js.jar"
307        dest="${out}/class/jsruntimetmp"/>
308
309    <javac srcdir="${prj}/examples/java/debugger"
310           destdir="${out}/class/jsruntimetmp"
311       	   includes="rhino/Main.java" classpathref="debuggerclasspath"
312	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
313
314    <zip destfile="${out}/class/jsruntime/skip_registration/js.jar"
315        basedir="${out}/class/jsruntimetmp" includes="**"/>
316
317    <zip zipfile="${out}/class/sframeworkinstall/sframework/jsruntime.zip"
318        basedir="${out}/class/jsruntime">
319    </zip>
320  </target>
321
322  <!-- =================== Build BeanShell UNO package ===================== -->
323  <target name="buildbshuno">
324    <mkdir dir="${out}/class/bshruntime"/>
325    <copy file="${out}/class/ScriptRuntimeForBeanShell.jar"
326        todir="${out}/class/bshruntime/"/>
327    <copy file="installer/Scripting.BeanShell.xcu"
328        tofile="${out}/class/bshruntime/Scripting.xcu"/>
329    <mkdir dir="${out}/class/bshruntime/skip_registration"/>
330    <copy file="${install.dir}/bsh-1.2b7.jar"
331        todir="${out}/class/bshruntime/skip_registration"/>
332    <zip zipfile="${out}/class/sframeworkinstall/sframework/bshruntime.zip"
333        basedir="${out}/class/bshruntime">
334    </zip>
335  </target>
336
337  <!-- ========= Package schema, scripts, dialogs & examples =========== -->
338  <target name="packagedialogsandexamples" depends="buildexamples">
339    <mkdir dir="${out}/class/sframeworkinstall/schema"/>
340    <copy file="installer/Scripting.xcs"
341        todir="${out}/class/sframeworkinstall/schema/"/>
342    <mkdir dir="${out}/class/sframeworkinstall/bindingdialog"/>
343    <copy todir="${out}/class/sframeworkinstall/bindingdialog">
344        <fileset dir="bindings/">
345            <include name="**/*.x*"/>
346        </fileset>
347    </copy>
348    <mkdir dir="${out}/class/sframeworkinstall/examples"/>
349    <copy todir="${out}/class/sframeworkinstall/examples">
350        <fileset dir="${out}/class/examples/"/>
351    </copy>
352  </target>
353
354  <!-- ===================== Package IDEs ================================== -->
355  <target name="packageide">
356    <mkdir dir="${out}/class/sframeworkinstall/ide"/>
357    <copy todir="${out}/class/sframeworkinstall/ide">
358        <fileset dir="${out}/class/">
359            <include name="idesupport.jar"/>
360            <include name="office.jar"/>
361        </fileset>
362    </copy>
363  </target>
364
365  <!-- ======================== Compile Classes ========================== -->
366  <target name="compileinstaller">
367    <mkdir dir="${installerclasses}"/>
368    <javac srcdir="installer/" destdir="${installerclasses}"
369       	   includes="**/*.java" classpathref="idlclasspath"
370	   debug="${debug}" optimize="${optimize}" deprecation="on"/>
371    <copy file="installer/sidebar.jpg" todir="${out}/class/sframeworkinstall/installer"/>
372  </target>
373
374  <!-- ===================== jar ========================= -->
375  <target name="jar" depends="buildunopackage,buildbshuno,buildjsuno,compileinstaller,packagedialogsandexamples,packageide">
376    <jar jarfile="${jardir}/${installerjarname}"
377         basedir="${installerclasses}">
378        <manifest>
379            <attribute name="Built-By" value="Sun Microsystems"/>
380            <attribute name="ScriptFramework-Version" value="${sfversion}"/>
381            <attribute name="Main-Class" value="installer.InstallWizard"/>
382        </manifest>
383    </jar>
384  </target>
385
386  <!-- ====================== Clean Generated Files ===================== -->
387  <target name="clean">
388    <delete dir="${scriptingclasses}"/>
389    <delete dir="${storageclasses}"/>
390    <delete dir="${jardir}/${scriptingjarname}"/>
391  </target>
392
393  <!-- ========================= All In One Build ======================= -->
394  <target name="all" depends="clean,jar"/>
395
396
397</project>
398