xref: /aoo42x/main/scripting/java/build.xml (revision 3187fb04)
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"/>
93*3187fb04SJim Jagielski      <contains string="${java.version}" substring="1.8" casesensitive="false" />
94d14fbfd3SJürgen Schmidt      <contains string="${java.vendor}" substring="Oracle" casesensitive="false" />
95d14fbfd3SJürgen Schmidt    </and>
96d14fbfd3SJürgen Schmidt  </condition>
97d14fbfd3SJürgen Schmidt
98d14fbfd3SJürgen Schmidt  <path id="macPath" refID="${mac.java.path}"/>
99d14fbfd3SJürgen Schmidt
100cdf0e10cSrcweir  <!-- rhino.jar from OpenJDK breaks build -->
101cdf0e10cSrcweir  <path id="nonMacPath">
102cdf0e10cSrcweir    <fileset dir="${java.home}/">
103cdf0e10cSrcweir       <include name="jre/lib/*.jar"/>
104cdf0e10cSrcweir       <include name="lib/*.jar"/>
105cdf0e10cSrcweir       <exclude name="jre/lib/rhino.jar"/>
106cdf0e10cSrcweir       <exclude name="lib/rhino.jar"/>
107cdf0e10cSrcweir     </fileset>
108cdf0e10cSrcweir  </path>
109cdf0e10cSrcweir  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
110cdf0e10cSrcweir
111cdf0e10cSrcweir  <!-- ===================== Prepare Directories ========================= -->
112cdf0e10cSrcweir  <target name="prepare">
113cdf0e10cSrcweir    <mkdir dir="${jardir}"/>
114cdf0e10cSrcweir  </target>
115cdf0e10cSrcweir
116cdf0e10cSrcweir  <!-- ======================== Compile Classes ========================== -->
1179ef65f0eSAndre Fischer  <target name="compile" depends="prepare, eval_environment">
118cdf0e10cSrcweir    <javac srcdir="com" destdir="${jardir}"
119cc697cd0SHerbert Dürr         includes="**/*.java" classpathref="idlclasspath" includeantruntime="false"
120cdf0e10cSrcweir         debug="${debug}" optimize="${optimize}" deprecation="off">
1219ef65f0eSAndre Fischer      <exclude name="**/provider/javascript/*.java" unless="with_rhino" />
1229ef65f0eSAndre Fischer      <exclude name="**/provider/beanshell/*.java" unless="with_beanshell" />
123cdf0e10cSrcweir      <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
124cdf0e10cSrcweir    </javac>
125cdf0e10cSrcweir    <javac srcdir="Framework/" destdir="${jardir}"
126cdf0e10cSrcweir         includes="**/*.java" classpathref="idlclasspath" debug="${debug}"
127cc697cd0SHerbert Dürr         optimize="${optimize}" deprecation="off" includeantruntime="false">
128cdf0e10cSrcweir     <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
129cdf0e10cSrcweir    </javac>
130cdf0e10cSrcweir  </target>
131cdf0e10cSrcweir
132cdf0e10cSrcweir  <target name="idesupport.compile" depends="compile, prepare">
133cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
134cdf0e10cSrcweir           debug="${debug}" deprecation="on">
135cdf0e10cSrcweir      <classpath refid="idesupport.class.path"/>
136cdf0e10cSrcweir      <exclude name="${idesupport.dir}/**/.*/*"/>
137cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/**/*"/>
138cdf0e10cSrcweir      <exclude name="${idesupport.dir}/LocalOffice.java"/>
139cdf0e10cSrcweir      <include name="${idesupport.dir}/*.java"/>
140cdf0e10cSrcweir      <include name="${idesupport.dir}/*/*.java"/>
141cdf0e10cSrcweir    </javac>
142cdf0e10cSrcweir  </target>
143cdf0e10cSrcweir
144cdf0e10cSrcweir  <target name="localoffice.compile" depends="prepare">
145cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
146cdf0e10cSrcweir           debug="${debug}" deprecation="on">
147cdf0e10cSrcweir      <classpath refid="idlclasspath"/>
148cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/.*/*"/>
149cdf0e10cSrcweir      <include name="${idesupport.dir}/localoffice/*.java"/>
150cdf0e10cSrcweir    </javac>
151cdf0e10cSrcweir  </target>
152cdf0e10cSrcweir
153cdf0e10cSrcweir  <target name="netbeans.compile" depends="idesupport.compile, prepare">
154cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
155cdf0e10cSrcweir           debug="${debug}" deprecation="on">
156cdf0e10cSrcweir      <classpath refid="openide.class.path"/>
157cdf0e10cSrcweir      <exclude name="${netbeans.dir}/**/.*/*"/>
158cdf0e10cSrcweir      <include name="${netbeans.dir}/**/*.java"/>
159cdf0e10cSrcweir    </javac>
160cdf0e10cSrcweir  </target>
161cdf0e10cSrcweir
162cdf0e10cSrcweir  <target name="netbeans.editor.support" depends="prepare">
163cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
164cdf0e10cSrcweir           debug="${debug}" deprecation="on">
165cdf0e10cSrcweir      <classpath refid="netbeans.editor.support.classpath"/>
166cdf0e10cSrcweir      <include name="org/openoffice/netbeans/editor/*.java"/>
167cdf0e10cSrcweir    </javac>
168cdf0e10cSrcweir    <jar jarfile="${jardir}/nb-editorsupport.jar">
169cdf0e10cSrcweir      <fileset dir="${jardir}">
170cdf0e10cSrcweir          <include name="org/openoffice/netbeans/editor/*.class"/>
171cdf0e10cSrcweir      </fileset>
172cdf0e10cSrcweir      <fileset dir=".">
173cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcs"/>
174cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcb"/>
175cdf0e10cSrcweir      </fileset>
176cdf0e10cSrcweir    </jar>
177cdf0e10cSrcweir  </target>
178cdf0e10cSrcweir
179cdf0e10cSrcweir  <!-- ===================== jar ========================= -->
1809ef65f0eSAndre Fischer  <target name="jar.provider.java" depends="compile">
181cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJava.jar"
182cdf0e10cSrcweir         basedir="${jardir}">
183cdf0e10cSrcweir        <manifest>
184cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
185cdf0e10cSrcweir            <attribute name="RegistrationClassName"
186cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.java.ScriptProviderForJava"/>
187cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar"/>
188cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
189cdf0e10cSrcweir        </manifest>
190cdf0e10cSrcweir        <include name="**/provider/java/*.class"/>
191cdf0e10cSrcweir    </jar>
1929ef65f0eSAndre Fischer  </target>
193cdf0e10cSrcweir
1949ef65f0eSAndre Fischer  <target name="jar.provider.beanshell" depends="compile" if="with_beanshell">
195cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForBeanShell.jar"
196cdf0e10cSrcweir         basedir="${jardir}">
197cdf0e10cSrcweir        <manifest>
198cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
199cdf0e10cSrcweir            <attribute name="RegistrationClassName"
200cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.beanshell.ScriptProviderForBeanShell"/>
201cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar bsh.jar"/>
202cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
203cdf0e10cSrcweir        </manifest>
204cdf0e10cSrcweir        <include name="**/provider/beanshell/*.class"/>
205cdf0e10cSrcweir        <fileset dir=".">
206cdf0e10cSrcweir          <include name="**/provider/beanshell/*.bsh"/>
207cdf0e10cSrcweir        </fileset>
208cdf0e10cSrcweir    </jar>
2099ef65f0eSAndre Fischer  </target>
210cdf0e10cSrcweir
2119ef65f0eSAndre Fischer  <target name="jar.provider.javascript" depends="compile" if="with_rhino">
212cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJavaScript.jar"
213cdf0e10cSrcweir         basedir="${jardir}">
214cdf0e10cSrcweir        <manifest>
215cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
216cdf0e10cSrcweir            <attribute name="RegistrationClassName"
217cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.javascript.ScriptProviderForJavaScript"/>
218cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar js.jar"/>
219cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
220cdf0e10cSrcweir        </manifest>
221cdf0e10cSrcweir        <include name="**/provider/javascript/*.class"/>
222cdf0e10cSrcweir        <fileset dir=".">
223cdf0e10cSrcweir          <include name="**/provider/javascript/*.js"/>
224cdf0e10cSrcweir        </fileset>
225cdf0e10cSrcweir    </jar>
2269ef65f0eSAndre Fischer  </target>
227cdf0e10cSrcweir
2289ef65f0eSAndre Fischer  <target name="jar.scriptframework" depends="compile">
229cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptFramework.jar"
230cdf0e10cSrcweir         basedir="${jardir}">
231cdf0e10cSrcweir        <manifest>
232cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
233cdf0e10cSrcweir            <attribute name="RegistrationClassName"
234cdf0e10cSrcweir                       value="com.sun.star.script.framework.security.SecurityDialog"/>
235cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
236cdf0e10cSrcweir        </manifest>
237cdf0e10cSrcweir        <include name="**/security/*"/>
238cdf0e10cSrcweir        <include name="**/log/*.class"/>
239cdf0e10cSrcweir        <include name="**/provider/*.class"/>
240cdf0e10cSrcweir        <include name="**/browse/*.class"/>
241cdf0e10cSrcweir        <include name="**/container/*.class"/>
242cdf0e10cSrcweir        <include name="**/io/*.class"/>
243cdf0e10cSrcweir    </jar>
2449ef65f0eSAndre Fischer  </target>
245cdf0e10cSrcweir
2469ef65f0eSAndre Fischer  <target name="jar" depends="jar.provider.java,jar.provider.beanshell,jar.provider.javascript,jar.scriptframework">
247cdf0e10cSrcweir  </target>
248cdf0e10cSrcweir
249cdf0e10cSrcweir  <target name="idesupport.jar" depends="idesupport.compile">
250cdf0e10cSrcweir    <jar jarfile="${jardir}/idesupport.jar">
251cdf0e10cSrcweir      <fileset dir="${jardir}">
252cdf0e10cSrcweir          <include name="${idesupport.dir}/**/*.class"/>
253cdf0e10cSrcweir          <include name="CommandLineTools*"/>
254cdf0e10cSrcweir          <exclude name="${idesupport.dir}/localoffice/*.class"/>
255cdf0e10cSrcweir      </fileset>
256cdf0e10cSrcweir      <fileset dir=".">
257cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
258cdf0e10cSrcweir      </fileset>
259cdf0e10cSrcweir    </jar>
260cdf0e10cSrcweir  </target>
261cdf0e10cSrcweir
262cdf0e10cSrcweir  <target name="localoffice.jar" depends="localoffice.compile">
263cdf0e10cSrcweir    <unjar
264cdf0e10cSrcweir      src="${solar.jar}/unoil.jar"
265cdf0e10cSrcweir      dest="${jardir}"/>
266cdf0e10cSrcweir    <jar jarfile="${jardir}/localoffice.jar">
267cdf0e10cSrcweir      <fileset dir="${jardir}">
268cdf0e10cSrcweir        <include name="${idesupport.dir}/localoffice/*.class"/>
269cdf0e10cSrcweir        <include name="drafts/com/sun/star/script/framework/storage/*.class"/>
270cdf0e10cSrcweir      </fileset>
271cdf0e10cSrcweir    </jar>
272cdf0e10cSrcweir  </target>
273cdf0e10cSrcweir
274cdf0e10cSrcweir  <target name="netbeans.jar" depends="netbeans.compile">
275cdf0e10cSrcweir    <jar jarfile="${jardir}/office.jar" manifest="manifest.mf">
276cdf0e10cSrcweir      <fileset dir="${jardir}">
277cdf0e10cSrcweir        <include name="${netbeans.dir}/**/*.class"/>
278cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ParcelDescriptorChildren.class"/>
279cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ScriptNode.class"/>
280cdf0e10cSrcweir        <include name="${idesupport.dir}/**/*.class"/>
281cdf0e10cSrcweir        <include name="CommandLineTools*"/>
282cdf0e10cSrcweir      </fileset>
283cdf0e10cSrcweir      <fileset dir=".">
284cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
285cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/*"/>
286cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/templates/*"/>
287cdf0e10cSrcweir        <include name="${netbeans.dir}/**/Bundle*"/>
288cdf0e10cSrcweir      </fileset>
289cdf0e10cSrcweir    </jar>
290cdf0e10cSrcweir  </target>
291cdf0e10cSrcweir
292cdf0e10cSrcweir  <!-- Uncomment this target when building within NetBeans to reinstall the
293cdf0e10cSrcweir       module.
294cdf0e10cSrcweir  <target name="netbeans.install" depends="netbeans.package">
295cdf0e10cSrcweir    <copy file="${jardir}/localoffice.jar"
296cdf0e10cSrcweir          tofile="${netbeans.home}/modules/ext/localoffice.jar"/>
297cdf0e10cSrcweir    <nbinstaller action="reinstall" module="${jardir}/office.jar"/>
298cdf0e10cSrcweir  </target>
299cdf0e10cSrcweir  -->
300cdf0e10cSrcweir
301cdf0e10cSrcweir  <!-- ====================== Clean Generated Files ===================== -->
302cdf0e10cSrcweir  <target name="clean">
303cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJava.jar"/>
304cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJavaScript.jar"/>
305cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForBeanShell.jar"/>
306cdf0e10cSrcweir    <delete file="${jardir}/ScriptFramework.jar"/>
307cdf0e10cSrcweir    <delete file="${jardir}/office.jar"/>
308cdf0e10cSrcweir    <delete file="${jardir}/localoffice.jar"/>
309cdf0e10cSrcweir    <delete file="${jardir}/idesupport.jar"/>
310cdf0e10cSrcweir  </target>
311cdf0e10cSrcweir
312cdf0e10cSrcweir  <!-- ========================= All In One Build ======================= -->
313cdf0e10cSrcweir  <target name="all" depends="jar"/>
314cdf0e10cSrcweir</project>
315