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