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