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