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