xref: /aoo42x/main/scripting/java/build.xml (revision 9ef65f0e)
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" default="all" basedir=".">
28
29  <!-- =================== Environmental Properties ======================= -->
30
31  <property name="prj" value=".."/>
32  <property name="build.compiler"   value="classic"/>
33  <property name="optimize"   value="off"/>
34  <property name="debug"   value="on"/>
35  <property name="jardir" value="${out}/class"/>
36  <property name="bindir" value="${out}/bin"/>
37  <property name="idesupport.dir" value="org/openoffice/idesupport"/>
38  <property name="netbeans.dir" value="org/openoffice/netbeans/modules/office"/>
39  <property name="framework.dir" value="Framework/com/sun/star/script/framework/security"/>
40
41  <!-- Change this property if you are building NetBeans editor support jar.
42       Not needed in default build -->
43  <property name="netbeans.install.path" value="/export/home/netbeans"/>
44
45  <property environment="env"/>
46  <property name="env.BSH_JAR" value="${solar.jar}/bsh.jar"/>
47
48  <target name="eval_environment">
49    <condition property="with_rhino">
50      <equals arg1="${env.ENABLE_JAVASCRIPT}" arg2="YES" />
51    </condition>
52    <condition property="with_beanshell">
53      <equals arg1="${env.ENABLE_BEANSHELL}" arg2="YES" />
54    </condition>
55  </target>
56
57  <!-- ==================== classpath setting ============================ -->
58  <path id="idlclasspath">
59    <pathelement location="${solar.jar}/jurt.jar"/>
60    <pathelement location="${solar.jar}/unoil.jar"/>
61    <pathelement location="${solar.jar}/juh.jar"/>
62    <pathelement location="${solar.jar}/java_uno.jar"/>
63    <pathelement location="${solar.jar}/ridl.jar"/>
64    <pathelement location="${env.BSH_JAR}"/>
65    <pathelement location="${solar.jar}/js.jar"/>
66    <pathelement location="${jardir}"/>
67  </path>
68
69  <path id="idesupport.class.path">
70    <pathelement path="${jardir}"/>
71  </path>
72
73  <path id="openide.class.path">
74    <pathelement path="${jardir}"/>
75    <pathelement path="${solar.jar}/openide.jar"/>
76  </path>
77
78  <path id="netbeans.editor.support.classpath">
79    <pathelement path="${jardir}"/>
80    <pathelement path="${netbeans.install.path}/modules/ext/nb-editor.jar"/>
81  </path>
82
83  <condition property="boot_refID" value="macPath" else="nonMacPath">
84    <and>
85      <os family="mac"/>
86      <os family="unix"/>
87    </and>
88  </condition>
89  <path id="macPath" location="${java.home}/../Classes/classes.jar"/>
90  <!-- rhino.jar from OpenJDK breaks build -->
91  <path id="nonMacPath">
92    <fileset dir="${java.home}/">
93       <include name="jre/lib/*.jar"/>
94       <include name="lib/*.jar"/>
95       <exclude name="jre/lib/rhino.jar"/>
96       <exclude name="lib/rhino.jar"/>
97     </fileset>
98  </path>
99  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
100
101  <!-- ===================== Prepare Directories ========================= -->
102  <target name="prepare">
103    <mkdir dir="${jardir}"/>
104  </target>
105
106  <!-- ======================== Compile Classes ========================== -->
107  <target name="compile" depends="prepare, eval_environment">
108    <javac srcdir="com" destdir="${jardir}"
109         includes="**/*.java" classpathref="idlclasspath"
110         debug="${debug}" optimize="${optimize}" deprecation="off">
111      <exclude name="**/provider/javascript/*.java" unless="with_rhino" />
112      <exclude name="**/provider/beanshell/*.java" unless="with_beanshell" />
113      <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
114    </javac>
115    <javac srcdir="Framework/" destdir="${jardir}"
116         includes="**/*.java" classpathref="idlclasspath" debug="${debug}"
117         optimize="${optimize}" deprecation="off">
118     <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
119    </javac>
120  </target>
121
122  <target name="idesupport.compile" depends="compile, prepare">
123    <javac srcdir="." destdir="${jardir}"
124           debug="${debug}" deprecation="on">
125      <classpath refid="idesupport.class.path"/>
126      <exclude name="${idesupport.dir}/**/.*/*"/>
127      <exclude name="${idesupport.dir}/localoffice/**/*"/>
128      <exclude name="${idesupport.dir}/LocalOffice.java"/>
129      <include name="${idesupport.dir}/*.java"/>
130      <include name="${idesupport.dir}/*/*.java"/>
131    </javac>
132  </target>
133
134  <target name="localoffice.compile" depends="prepare">
135    <javac srcdir="." destdir="${jardir}"
136           debug="${debug}" deprecation="on">
137      <classpath refid="idlclasspath"/>
138      <exclude name="${idesupport.dir}/localoffice/.*/*"/>
139      <include name="${idesupport.dir}/localoffice/*.java"/>
140    </javac>
141  </target>
142
143  <target name="netbeans.compile" depends="idesupport.compile, prepare">
144    <javac srcdir="." destdir="${jardir}"
145           debug="${debug}" deprecation="on">
146      <classpath refid="openide.class.path"/>
147      <exclude name="${netbeans.dir}/**/.*/*"/>
148      <include name="${netbeans.dir}/**/*.java"/>
149    </javac>
150  </target>
151
152  <target name="netbeans.editor.support" depends="prepare">
153    <javac srcdir="." destdir="${jardir}"
154           debug="${debug}" deprecation="on">
155      <classpath refid="netbeans.editor.support.classpath"/>
156      <include name="org/openoffice/netbeans/editor/*.java"/>
157    </javac>
158    <jar jarfile="${jardir}/nb-editorsupport.jar">
159      <fileset dir="${jardir}">
160          <include name="org/openoffice/netbeans/editor/*.class"/>
161      </fileset>
162      <fileset dir=".">
163        <include name="org/openoffice/netbeans/editor/OOo.jcs"/>
164        <include name="org/openoffice/netbeans/editor/OOo.jcb"/>
165      </fileset>
166    </jar>
167  </target>
168
169  <!-- ===================== jar ========================= -->
170  <target name="jar.provider.java" depends="compile">
171    <jar jarfile="${jardir}/ScriptProviderForJava.jar"
172         basedir="${jardir}">
173        <manifest>
174            <attribute name="Built-By" value="Sun Microsystems"/>
175            <attribute name="RegistrationClassName"
176                       value="com.sun.star.script.framework.provider.java.ScriptProviderForJava"/>
177            <attribute name="Class-Path" value="ScriptFramework.jar"/>
178            <attribute name="UNO-Type-Path" value=""/>
179        </manifest>
180        <include name="**/provider/java/*.class"/>
181    </jar>
182  </target>
183
184  <target name="jar.provider.beanshell" depends="compile" if="with_beanshell">
185    <jar jarfile="${jardir}/ScriptProviderForBeanShell.jar"
186         basedir="${jardir}">
187        <manifest>
188            <attribute name="Built-By" value="Sun Microsystems"/>
189            <attribute name="RegistrationClassName"
190                       value="com.sun.star.script.framework.provider.beanshell.ScriptProviderForBeanShell"/>
191            <attribute name="Class-Path" value="ScriptFramework.jar bsh.jar"/>
192            <attribute name="UNO-Type-Path" value=""/>
193        </manifest>
194        <include name="**/provider/beanshell/*.class"/>
195        <fileset dir=".">
196          <include name="**/provider/beanshell/*.bsh"/>
197        </fileset>
198    </jar>
199  </target>
200
201  <target name="jar.provider.javascript" depends="compile" if="with_rhino">
202    <jar jarfile="${jardir}/ScriptProviderForJavaScript.jar"
203         basedir="${jardir}">
204        <manifest>
205            <attribute name="Built-By" value="Sun Microsystems"/>
206            <attribute name="RegistrationClassName"
207                       value="com.sun.star.script.framework.provider.javascript.ScriptProviderForJavaScript"/>
208            <attribute name="Class-Path" value="ScriptFramework.jar js.jar"/>
209            <attribute name="UNO-Type-Path" value=""/>
210        </manifest>
211        <include name="**/provider/javascript/*.class"/>
212        <fileset dir=".">
213          <include name="**/provider/javascript/*.js"/>
214        </fileset>
215    </jar>
216  </target>
217
218  <target name="jar.scriptframework" depends="compile">
219    <jar jarfile="${jardir}/ScriptFramework.jar"
220         basedir="${jardir}">
221        <manifest>
222            <attribute name="Built-By" value="Sun Microsystems"/>
223            <attribute name="RegistrationClassName"
224                       value="com.sun.star.script.framework.security.SecurityDialog"/>
225            <attribute name="UNO-Type-Path" value=""/>
226        </manifest>
227        <include name="**/security/*"/>
228        <include name="**/log/*.class"/>
229        <include name="**/provider/*.class"/>
230        <include name="**/browse/*.class"/>
231        <include name="**/container/*.class"/>
232        <include name="**/io/*.class"/>
233    </jar>
234  </target>
235
236  <target name="jar" depends="jar.provider.java,jar.provider.beanshell,jar.provider.javascript,jar.scriptframework">
237  </target>
238
239  <target name="idesupport.jar" depends="idesupport.compile">
240    <jar jarfile="${jardir}/idesupport.jar">
241      <fileset dir="${jardir}">
242          <include name="${idesupport.dir}/**/*.class"/>
243          <include name="CommandLineTools*"/>
244          <exclude name="${idesupport.dir}/localoffice/*.class"/>
245      </fileset>
246      <fileset dir=".">
247        <include name="${idesupport.dir}/ui/add.gif"/>
248      </fileset>
249    </jar>
250  </target>
251
252  <target name="localoffice.jar" depends="localoffice.compile">
253    <unjar
254      src="${solar.jar}/unoil.jar"
255      dest="${jardir}"/>
256    <jar jarfile="${jardir}/localoffice.jar">
257      <fileset dir="${jardir}">
258        <include name="${idesupport.dir}/localoffice/*.class"/>
259        <include name="drafts/com/sun/star/script/framework/storage/*.class"/>
260      </fileset>
261    </jar>
262  </target>
263
264  <target name="netbeans.jar" depends="netbeans.compile">
265    <jar jarfile="${jardir}/office.jar" manifest="manifest.mf">
266      <fileset dir="${jardir}">
267        <include name="${netbeans.dir}/**/*.class"/>
268        <exclude name="${netbeans.dir}/**/ParcelDescriptorChildren.class"/>
269        <exclude name="${netbeans.dir}/**/ScriptNode.class"/>
270        <include name="${idesupport.dir}/**/*.class"/>
271        <include name="CommandLineTools*"/>
272      </fileset>
273      <fileset dir=".">
274        <include name="${idesupport.dir}/ui/add.gif"/>
275        <include name="${netbeans.dir}/resources/*"/>
276        <include name="${netbeans.dir}/resources/templates/*"/>
277        <include name="${netbeans.dir}/**/Bundle*"/>
278      </fileset>
279    </jar>
280  </target>
281
282  <!-- Uncomment this target when building within NetBeans to reinstall the
283       module.
284  <target name="netbeans.install" depends="netbeans.package">
285    <copy file="${jardir}/localoffice.jar"
286          tofile="${netbeans.home}/modules/ext/localoffice.jar"/>
287    <nbinstaller action="reinstall" module="${jardir}/office.jar"/>
288  </target>
289  -->
290
291  <!-- ====================== Clean Generated Files ===================== -->
292  <target name="clean">
293    <delete file="${jardir}/ScriptProviderForJava.jar"/>
294    <delete file="${jardir}/ScriptProviderForJavaScript.jar"/>
295    <delete file="${jardir}/ScriptProviderForBeanShell.jar"/>
296    <delete file="${jardir}/ScriptFramework.jar"/>
297    <delete file="${jardir}/office.jar"/>
298    <delete file="${jardir}/localoffice.jar"/>
299    <delete file="${jardir}/idesupport.jar"/>
300  </target>
301
302  <!-- ========================= All In One Build ======================= -->
303  <target name="all" depends="jar"/>
304</project>
305