xref: /aoo42x/main/scripting/java/build.xml (revision 33ef1020)
15111cb72SAndrew Rist<!--***********************************************************
25111cb72SAndrew Rist *
35111cb72SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
45111cb72SAndrew Rist * or more contributor license agreements.  See the NOTICE file
55111cb72SAndrew Rist * distributed with this work for additional information
65111cb72SAndrew Rist * regarding copyright ownership.  The ASF licenses this file
75111cb72SAndrew Rist * to you under the Apache License, Version 2.0 (the
85111cb72SAndrew Rist * "License"); you may not use this file except in compliance
95111cb72SAndrew Rist * with the License.  You may obtain a copy of the License at
105111cb72SAndrew Rist *
115111cb72SAndrew Rist *   http://www.apache.org/licenses/LICENSE-2.0
125111cb72SAndrew Rist *
135111cb72SAndrew Rist * Unless required by applicable law or agreed to in writing,
145111cb72SAndrew Rist * software distributed under the License is distributed on an
155111cb72SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
165111cb72SAndrew Rist * KIND, either express or implied.  See the License for the
175111cb72SAndrew Rist * specific language governing permissions and limitations
185111cb72SAndrew Rist * under the License.
195111cb72SAndrew Rist *
205111cb72SAndrew Rist ***********************************************************-->
21cdf0e10cSrcweir
22cdf0e10cSrcweir
23cdf0e10cSrcweir<project name="Scipting Framework" default="all" basedir=".">
24cdf0e10cSrcweir
25cdf0e10cSrcweir  <!-- =================== Environmental Properties ======================= -->
26cdf0e10cSrcweir
27cdf0e10cSrcweir  <property name="prj" value=".."/>
288b0d3335SPedro Giffuni  <property name="build.compiler"   value="modern"/>
29cdf0e10cSrcweir  <property name="optimize"   value="off"/>
30cdf0e10cSrcweir  <property name="debug"   value="on"/>
31cdf0e10cSrcweir  <property name="jardir" value="${out}/class"/>
32cdf0e10cSrcweir  <property name="bindir" value="${out}/bin"/>
33cdf0e10cSrcweir  <property name="idesupport.dir" value="org/openoffice/idesupport"/>
34cdf0e10cSrcweir  <property name="netbeans.dir" value="org/openoffice/netbeans/modules/office"/>
35cdf0e10cSrcweir  <property name="framework.dir" value="Framework/com/sun/star/script/framework/security"/>
36cdf0e10cSrcweir
37cdf0e10cSrcweir  <!-- Change this property if you are building NetBeans editor support jar.
38cdf0e10cSrcweir       Not needed in default build -->
39cdf0e10cSrcweir  <property name="netbeans.install.path" value="/export/home/netbeans"/>
40cdf0e10cSrcweir
41cdf0e10cSrcweir  <property environment="env"/>
42cdf0e10cSrcweir  <property name="env.BSH_JAR" value="${solar.jar}/bsh.jar"/>
43cdf0e10cSrcweir
449ef65f0eSAndre Fischer  <target name="eval_environment">
459ef65f0eSAndre Fischer    <condition property="with_rhino">
469ef65f0eSAndre Fischer      <equals arg1="${env.ENABLE_JAVASCRIPT}" arg2="YES" />
479ef65f0eSAndre Fischer    </condition>
489ef65f0eSAndre Fischer    <condition property="with_beanshell">
499ef65f0eSAndre Fischer      <equals arg1="${env.ENABLE_BEANSHELL}" arg2="YES" />
509ef65f0eSAndre Fischer    </condition>
519ef65f0eSAndre Fischer  </target>
529ef65f0eSAndre Fischer
53cdf0e10cSrcweir  <!-- ==================== classpath setting ============================ -->
54cdf0e10cSrcweir  <path id="idlclasspath">
55cdf0e10cSrcweir    <pathelement location="${solar.jar}/jurt.jar"/>
56cdf0e10cSrcweir    <pathelement location="${solar.jar}/unoil.jar"/>
57cdf0e10cSrcweir    <pathelement location="${solar.jar}/juh.jar"/>
58cdf0e10cSrcweir    <pathelement location="${solar.jar}/java_uno.jar"/>
59cdf0e10cSrcweir    <pathelement location="${solar.jar}/ridl.jar"/>
60cdf0e10cSrcweir    <pathelement location="${env.BSH_JAR}"/>
61cdf0e10cSrcweir    <pathelement location="${solar.jar}/js.jar"/>
62cdf0e10cSrcweir    <pathelement location="${jardir}"/>
63cdf0e10cSrcweir  </path>
64cdf0e10cSrcweir
65cdf0e10cSrcweir  <path id="idesupport.class.path">
66cdf0e10cSrcweir    <pathelement path="${jardir}"/>
67cdf0e10cSrcweir  </path>
68cdf0e10cSrcweir
69cdf0e10cSrcweir  <path id="openide.class.path">
70cdf0e10cSrcweir    <pathelement path="${jardir}"/>
71cdf0e10cSrcweir    <pathelement path="${solar.jar}/openide.jar"/>
72cdf0e10cSrcweir  </path>
73cdf0e10cSrcweir
74cdf0e10cSrcweir  <path id="netbeans.editor.support.classpath">
75cdf0e10cSrcweir    <pathelement path="${jardir}"/>
76cdf0e10cSrcweir    <pathelement path="${netbeans.install.path}/modules/ext/nb-editor.jar"/>
77cdf0e10cSrcweir  </path>
78cdf0e10cSrcweir
79cdf0e10cSrcweir  <condition property="boot_refID" value="macPath" else="nonMacPath">
80cdf0e10cSrcweir    <and>
81cdf0e10cSrcweir      <os family="mac"/>
82cdf0e10cSrcweir      <os family="unix"/>
83cdf0e10cSrcweir    </and>
84cdf0e10cSrcweir  </condition>
85d14fbfd3SJürgen Schmidt
86d14fbfd3SJürgen Schmidt  <path id="mac.apple.java.path" location="${java.home}/../Classes/classes.jar"/>
87d14fbfd3SJürgen Schmidt  <path id="mac.oracle.java.path" location="${java.home}/lib/rt.jar"/>
88d14fbfd3SJürgen Schmidt
89d14fbfd3SJürgen Schmidt  <condition property="mac.java.path" value="mac.oracle.java.path" else ="mac.apple.java.path">
90d14fbfd3SJürgen Schmidt    <and>
91d14fbfd3SJürgen Schmidt      <os family="mac"/>
92d14fbfd3SJürgen Schmidt      <os family="unix"/>
933187fb04SJim Jagielski      <contains string="${java.version}" substring="1.8" casesensitive="false" />
94*33ef1020SArrigo Marchiori      <or>
95*33ef1020SArrigo Marchiori        <contains string="${java.vendor}" substring="Oracle" casesensitive="false" />
96*33ef1020SArrigo Marchiori        <contains string="${java.vendor}" substring="adoptopenjdk" casesensitive="false" />
97*33ef1020SArrigo Marchiori        <contains string="${java.vendor}" substring="azul" casesensitive="false" />
98*33ef1020SArrigo Marchiori      </or>
99d14fbfd3SJürgen Schmidt    </and>
100d14fbfd3SJürgen Schmidt  </condition>
101d14fbfd3SJürgen Schmidt
102d14fbfd3SJürgen Schmidt  <path id="macPath" refID="${mac.java.path}"/>
103d14fbfd3SJürgen Schmidt
104cdf0e10cSrcweir  <!-- rhino.jar from OpenJDK breaks build -->
105cdf0e10cSrcweir  <path id="nonMacPath">
106cdf0e10cSrcweir    <fileset dir="${java.home}/">
107cdf0e10cSrcweir       <include name="jre/lib/*.jar"/>
108cdf0e10cSrcweir       <include name="lib/*.jar"/>
109cdf0e10cSrcweir       <exclude name="jre/lib/rhino.jar"/>
110cdf0e10cSrcweir       <exclude name="lib/rhino.jar"/>
111cdf0e10cSrcweir     </fileset>
112cdf0e10cSrcweir  </path>
113cdf0e10cSrcweir  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
114cdf0e10cSrcweir
115cdf0e10cSrcweir  <!-- ===================== Prepare Directories ========================= -->
116cdf0e10cSrcweir  <target name="prepare">
117cdf0e10cSrcweir    <mkdir dir="${jardir}"/>
118cdf0e10cSrcweir  </target>
119cdf0e10cSrcweir
120cdf0e10cSrcweir  <!-- ======================== Compile Classes ========================== -->
1219ef65f0eSAndre Fischer  <target name="compile" depends="prepare, eval_environment">
122cdf0e10cSrcweir    <javac srcdir="com" destdir="${jardir}"
123cc697cd0SHerbert Dürr         includes="**/*.java" classpathref="idlclasspath" includeantruntime="false"
124cdf0e10cSrcweir         debug="${debug}" optimize="${optimize}" deprecation="off">
1259ef65f0eSAndre Fischer      <exclude name="**/provider/javascript/*.java" unless="with_rhino" />
1269ef65f0eSAndre Fischer      <exclude name="**/provider/beanshell/*.java" unless="with_beanshell" />
127cdf0e10cSrcweir      <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
128cdf0e10cSrcweir    </javac>
129cdf0e10cSrcweir    <javac srcdir="Framework/" destdir="${jardir}"
130cdf0e10cSrcweir         includes="**/*.java" classpathref="idlclasspath" debug="${debug}"
131cc697cd0SHerbert Dürr         optimize="${optimize}" deprecation="off" includeantruntime="false">
132cdf0e10cSrcweir     <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
133cdf0e10cSrcweir    </javac>
134cdf0e10cSrcweir  </target>
135cdf0e10cSrcweir
136cdf0e10cSrcweir  <target name="idesupport.compile" depends="compile, prepare">
137cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
138cdf0e10cSrcweir           debug="${debug}" deprecation="on">
139cdf0e10cSrcweir      <classpath refid="idesupport.class.path"/>
140cdf0e10cSrcweir      <exclude name="${idesupport.dir}/**/.*/*"/>
141cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/**/*"/>
142cdf0e10cSrcweir      <exclude name="${idesupport.dir}/LocalOffice.java"/>
143cdf0e10cSrcweir      <include name="${idesupport.dir}/*.java"/>
144cdf0e10cSrcweir      <include name="${idesupport.dir}/*/*.java"/>
145cdf0e10cSrcweir    </javac>
146cdf0e10cSrcweir  </target>
147cdf0e10cSrcweir
148cdf0e10cSrcweir  <target name="localoffice.compile" depends="prepare">
149cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
150cdf0e10cSrcweir           debug="${debug}" deprecation="on">
151cdf0e10cSrcweir      <classpath refid="idlclasspath"/>
152cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/.*/*"/>
153cdf0e10cSrcweir      <include name="${idesupport.dir}/localoffice/*.java"/>
154cdf0e10cSrcweir    </javac>
155cdf0e10cSrcweir  </target>
156cdf0e10cSrcweir
157cdf0e10cSrcweir  <target name="netbeans.compile" depends="idesupport.compile, prepare">
158cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
159cdf0e10cSrcweir           debug="${debug}" deprecation="on">
160cdf0e10cSrcweir      <classpath refid="openide.class.path"/>
161cdf0e10cSrcweir      <exclude name="${netbeans.dir}/**/.*/*"/>
162cdf0e10cSrcweir      <include name="${netbeans.dir}/**/*.java"/>
163cdf0e10cSrcweir    </javac>
164cdf0e10cSrcweir  </target>
165cdf0e10cSrcweir
166cdf0e10cSrcweir  <target name="netbeans.editor.support" depends="prepare">
167cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
168cdf0e10cSrcweir           debug="${debug}" deprecation="on">
169cdf0e10cSrcweir      <classpath refid="netbeans.editor.support.classpath"/>
170cdf0e10cSrcweir      <include name="org/openoffice/netbeans/editor/*.java"/>
171cdf0e10cSrcweir    </javac>
172cdf0e10cSrcweir    <jar jarfile="${jardir}/nb-editorsupport.jar">
173cdf0e10cSrcweir      <fileset dir="${jardir}">
174cdf0e10cSrcweir          <include name="org/openoffice/netbeans/editor/*.class"/>
175cdf0e10cSrcweir      </fileset>
176cdf0e10cSrcweir      <fileset dir=".">
177cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcs"/>
178cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcb"/>
179cdf0e10cSrcweir      </fileset>
180cdf0e10cSrcweir    </jar>
181cdf0e10cSrcweir  </target>
182cdf0e10cSrcweir
183cdf0e10cSrcweir  <!-- ===================== jar ========================= -->
1849ef65f0eSAndre Fischer  <target name="jar.provider.java" depends="compile">
185cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJava.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.java.ScriptProviderForJava"/>
191cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar"/>
192cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
193cdf0e10cSrcweir        </manifest>
194cdf0e10cSrcweir        <include name="**/provider/java/*.class"/>
195cdf0e10cSrcweir    </jar>
1969ef65f0eSAndre Fischer  </target>
197cdf0e10cSrcweir
1989ef65f0eSAndre Fischer  <target name="jar.provider.beanshell" depends="compile" if="with_beanshell">
199cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForBeanShell.jar"
200cdf0e10cSrcweir         basedir="${jardir}">
201cdf0e10cSrcweir        <manifest>
202cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
203cdf0e10cSrcweir            <attribute name="RegistrationClassName"
204cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.beanshell.ScriptProviderForBeanShell"/>
205cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar bsh.jar"/>
206cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
207cdf0e10cSrcweir        </manifest>
208cdf0e10cSrcweir        <include name="**/provider/beanshell/*.class"/>
209cdf0e10cSrcweir        <fileset dir=".">
210cdf0e10cSrcweir          <include name="**/provider/beanshell/*.bsh"/>
211cdf0e10cSrcweir        </fileset>
212cdf0e10cSrcweir    </jar>
2139ef65f0eSAndre Fischer  </target>
214cdf0e10cSrcweir
2159ef65f0eSAndre Fischer  <target name="jar.provider.javascript" depends="compile" if="with_rhino">
216cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJavaScript.jar"
217cdf0e10cSrcweir         basedir="${jardir}">
218cdf0e10cSrcweir        <manifest>
219cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
220cdf0e10cSrcweir            <attribute name="RegistrationClassName"
221cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.javascript.ScriptProviderForJavaScript"/>
222cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar js.jar"/>
223cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
224cdf0e10cSrcweir        </manifest>
225cdf0e10cSrcweir        <include name="**/provider/javascript/*.class"/>
226cdf0e10cSrcweir        <fileset dir=".">
227cdf0e10cSrcweir          <include name="**/provider/javascript/*.js"/>
228cdf0e10cSrcweir        </fileset>
229cdf0e10cSrcweir    </jar>
2309ef65f0eSAndre Fischer  </target>
231cdf0e10cSrcweir
2329ef65f0eSAndre Fischer  <target name="jar.scriptframework" depends="compile">
233cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptFramework.jar"
234cdf0e10cSrcweir         basedir="${jardir}">
235cdf0e10cSrcweir        <manifest>
236cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
237cdf0e10cSrcweir            <attribute name="RegistrationClassName"
238cdf0e10cSrcweir                       value="com.sun.star.script.framework.security.SecurityDialog"/>
239cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
240cdf0e10cSrcweir        </manifest>
241cdf0e10cSrcweir        <include name="**/security/*"/>
242cdf0e10cSrcweir        <include name="**/log/*.class"/>
243cdf0e10cSrcweir        <include name="**/provider/*.class"/>
244cdf0e10cSrcweir        <include name="**/browse/*.class"/>
245cdf0e10cSrcweir        <include name="**/container/*.class"/>
246cdf0e10cSrcweir        <include name="**/io/*.class"/>
247cdf0e10cSrcweir    </jar>
2489ef65f0eSAndre Fischer  </target>
249cdf0e10cSrcweir
2509ef65f0eSAndre Fischer  <target name="jar" depends="jar.provider.java,jar.provider.beanshell,jar.provider.javascript,jar.scriptframework">
251cdf0e10cSrcweir  </target>
252cdf0e10cSrcweir
253cdf0e10cSrcweir  <target name="idesupport.jar" depends="idesupport.compile">
254cdf0e10cSrcweir    <jar jarfile="${jardir}/idesupport.jar">
255cdf0e10cSrcweir      <fileset dir="${jardir}">
256cdf0e10cSrcweir          <include name="${idesupport.dir}/**/*.class"/>
257cdf0e10cSrcweir          <include name="CommandLineTools*"/>
258cdf0e10cSrcweir          <exclude name="${idesupport.dir}/localoffice/*.class"/>
259cdf0e10cSrcweir      </fileset>
260cdf0e10cSrcweir      <fileset dir=".">
261cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
262cdf0e10cSrcweir      </fileset>
263cdf0e10cSrcweir    </jar>
264cdf0e10cSrcweir  </target>
265cdf0e10cSrcweir
266cdf0e10cSrcweir  <target name="localoffice.jar" depends="localoffice.compile">
267cdf0e10cSrcweir    <unjar
268cdf0e10cSrcweir      src="${solar.jar}/unoil.jar"
269cdf0e10cSrcweir      dest="${jardir}"/>
270cdf0e10cSrcweir    <jar jarfile="${jardir}/localoffice.jar">
271cdf0e10cSrcweir      <fileset dir="${jardir}">
272cdf0e10cSrcweir        <include name="${idesupport.dir}/localoffice/*.class"/>
273cdf0e10cSrcweir        <include name="drafts/com/sun/star/script/framework/storage/*.class"/>
274cdf0e10cSrcweir      </fileset>
275cdf0e10cSrcweir    </jar>
276cdf0e10cSrcweir  </target>
277cdf0e10cSrcweir
278cdf0e10cSrcweir  <target name="netbeans.jar" depends="netbeans.compile">
279cdf0e10cSrcweir    <jar jarfile="${jardir}/office.jar" manifest="manifest.mf">
280cdf0e10cSrcweir      <fileset dir="${jardir}">
281cdf0e10cSrcweir        <include name="${netbeans.dir}/**/*.class"/>
282cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ParcelDescriptorChildren.class"/>
283cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ScriptNode.class"/>
284cdf0e10cSrcweir        <include name="${idesupport.dir}/**/*.class"/>
285cdf0e10cSrcweir        <include name="CommandLineTools*"/>
286cdf0e10cSrcweir      </fileset>
287cdf0e10cSrcweir      <fileset dir=".">
288cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
289cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/*"/>
290cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/templates/*"/>
291cdf0e10cSrcweir        <include name="${netbeans.dir}/**/Bundle*"/>
292cdf0e10cSrcweir      </fileset>
293cdf0e10cSrcweir    </jar>
294cdf0e10cSrcweir  </target>
295cdf0e10cSrcweir
296cdf0e10cSrcweir  <!-- Uncomment this target when building within NetBeans to reinstall the
297cdf0e10cSrcweir       module.
298cdf0e10cSrcweir  <target name="netbeans.install" depends="netbeans.package">
299cdf0e10cSrcweir    <copy file="${jardir}/localoffice.jar"
300cdf0e10cSrcweir          tofile="${netbeans.home}/modules/ext/localoffice.jar"/>
301cdf0e10cSrcweir    <nbinstaller action="reinstall" module="${jardir}/office.jar"/>
302cdf0e10cSrcweir  </target>
303cdf0e10cSrcweir  -->
304cdf0e10cSrcweir
305cdf0e10cSrcweir  <!-- ====================== Clean Generated Files ===================== -->
306cdf0e10cSrcweir  <target name="clean">
307cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJava.jar"/>
308cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJavaScript.jar"/>
309cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForBeanShell.jar"/>
310cdf0e10cSrcweir    <delete file="${jardir}/ScriptFramework.jar"/>
311cdf0e10cSrcweir    <delete file="${jardir}/office.jar"/>
312cdf0e10cSrcweir    <delete file="${jardir}/localoffice.jar"/>
313cdf0e10cSrcweir    <delete file="${jardir}/idesupport.jar"/>
314cdf0e10cSrcweir  </target>
315cdf0e10cSrcweir
316cdf0e10cSrcweir  <!-- ========================= All In One Build ======================= -->
317cdf0e10cSrcweir  <target name="all" depends="jar"/>
318cdf0e10cSrcweir</project>
319