xref: /aoo41x/main/scripting/java/build.xml (revision 5a5de594)
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>
854aab7c0bSJuergen Schmidt
864aab7c0bSJuergen Schmidt<path id="mac.apple.java.path" location="${java.home}/../Classes/classes.jar"/>
874aab7c0bSJuergen Schmidt  <path id="mac.oracle.java.path" location="${java.home}/lib/rt.jar"/>
884aab7c0bSJuergen Schmidt
894aab7c0bSJuergen Schmidt  <condition property="mac.java.path" value="mac.oracle.java.path" else ="mac.apple.java.path">
904aab7c0bSJuergen Schmidt    <and>
914aab7c0bSJuergen Schmidt      <os family="mac"/>
924aab7c0bSJuergen Schmidt      <os family="unix"/>
93fa262b04SArrigo Marchiori      <or>
94fa262b04SArrigo Marchiori        <contains string="${java.version}" substring="1.7" casesensitive="false" />
95fa262b04SArrigo Marchiori        <contains string="${java.version}" substring="1.8" casesensitive="false" />
96fa262b04SArrigo Marchiori      </or>
97fa262b04SArrigo Marchiori      <or>
98fa262b04SArrigo Marchiori        <contains string="${java.vendor}" substring="Oracle" casesensitive="false" />
99fa262b04SArrigo Marchiori        <contains string="${java.vendor}" substring="adoptopenjdk" casesensitive="false" />
100*5a5de594SArrigo Marchiori        <contains string="${java.vendor}" substring="azul" casesensitive="false" />
101fa262b04SArrigo Marchiori      </or>
1024aab7c0bSJuergen Schmidt    </and>
1034aab7c0bSJuergen Schmidt  </condition>
1044aab7c0bSJuergen Schmidt
1054aab7c0bSJuergen Schmidt  <path id="macPath" refID="${mac.java.path}"/>
1064aab7c0bSJuergen Schmidt
107cdf0e10cSrcweir  <!-- rhino.jar from OpenJDK breaks build -->
108cdf0e10cSrcweir  <path id="nonMacPath">
109cdf0e10cSrcweir    <fileset dir="${java.home}/">
110cdf0e10cSrcweir       <include name="jre/lib/*.jar"/>
111cdf0e10cSrcweir       <include name="lib/*.jar"/>
112cdf0e10cSrcweir       <exclude name="jre/lib/rhino.jar"/>
113cdf0e10cSrcweir       <exclude name="lib/rhino.jar"/>
114cdf0e10cSrcweir     </fileset>
115cdf0e10cSrcweir  </path>
116cdf0e10cSrcweir  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
117cdf0e10cSrcweir
118cdf0e10cSrcweir  <!-- ===================== Prepare Directories ========================= -->
119cdf0e10cSrcweir  <target name="prepare">
120cdf0e10cSrcweir    <mkdir dir="${jardir}"/>
121cdf0e10cSrcweir  </target>
122cdf0e10cSrcweir
123cdf0e10cSrcweir  <!-- ======================== Compile Classes ========================== -->
1249ef65f0eSAndre Fischer  <target name="compile" depends="prepare, eval_environment">
125cdf0e10cSrcweir    <javac srcdir="com" destdir="${jardir}"
126cc697cd0SHerbert Dürr         includes="**/*.java" classpathref="idlclasspath" includeantruntime="false"
127cdf0e10cSrcweir         debug="${debug}" optimize="${optimize}" deprecation="off">
1289ef65f0eSAndre Fischer      <exclude name="**/provider/javascript/*.java" unless="with_rhino" />
1299ef65f0eSAndre Fischer      <exclude name="**/provider/beanshell/*.java" unless="with_beanshell" />
130cdf0e10cSrcweir      <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
131cdf0e10cSrcweir    </javac>
132cdf0e10cSrcweir    <javac srcdir="Framework/" destdir="${jardir}"
133cdf0e10cSrcweir         includes="**/*.java" classpathref="idlclasspath" debug="${debug}"
134cc697cd0SHerbert Dürr         optimize="${optimize}" deprecation="off" includeantruntime="false">
135cdf0e10cSrcweir     <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
136cdf0e10cSrcweir    </javac>
137cdf0e10cSrcweir  </target>
138cdf0e10cSrcweir
139cdf0e10cSrcweir  <target name="idesupport.compile" depends="compile, prepare">
140cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
141cdf0e10cSrcweir           debug="${debug}" deprecation="on">
142cdf0e10cSrcweir      <classpath refid="idesupport.class.path"/>
143cdf0e10cSrcweir      <exclude name="${idesupport.dir}/**/.*/*"/>
144cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/**/*"/>
145cdf0e10cSrcweir      <exclude name="${idesupport.dir}/LocalOffice.java"/>
146cdf0e10cSrcweir      <include name="${idesupport.dir}/*.java"/>
147cdf0e10cSrcweir      <include name="${idesupport.dir}/*/*.java"/>
148cdf0e10cSrcweir    </javac>
149cdf0e10cSrcweir  </target>
150cdf0e10cSrcweir
151cdf0e10cSrcweir  <target name="localoffice.compile" depends="prepare">
152cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
153cdf0e10cSrcweir           debug="${debug}" deprecation="on">
154cdf0e10cSrcweir      <classpath refid="idlclasspath"/>
155cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/.*/*"/>
156cdf0e10cSrcweir      <include name="${idesupport.dir}/localoffice/*.java"/>
157cdf0e10cSrcweir    </javac>
158cdf0e10cSrcweir  </target>
159cdf0e10cSrcweir
160cdf0e10cSrcweir  <target name="netbeans.compile" depends="idesupport.compile, prepare">
161cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
162cdf0e10cSrcweir           debug="${debug}" deprecation="on">
163cdf0e10cSrcweir      <classpath refid="openide.class.path"/>
164cdf0e10cSrcweir      <exclude name="${netbeans.dir}/**/.*/*"/>
165cdf0e10cSrcweir      <include name="${netbeans.dir}/**/*.java"/>
166cdf0e10cSrcweir    </javac>
167cdf0e10cSrcweir  </target>
168cdf0e10cSrcweir
169cdf0e10cSrcweir  <target name="netbeans.editor.support" depends="prepare">
170cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
171cdf0e10cSrcweir           debug="${debug}" deprecation="on">
172cdf0e10cSrcweir      <classpath refid="netbeans.editor.support.classpath"/>
173cdf0e10cSrcweir      <include name="org/openoffice/netbeans/editor/*.java"/>
174cdf0e10cSrcweir    </javac>
175cdf0e10cSrcweir    <jar jarfile="${jardir}/nb-editorsupport.jar">
176cdf0e10cSrcweir      <fileset dir="${jardir}">
177cdf0e10cSrcweir          <include name="org/openoffice/netbeans/editor/*.class"/>
178cdf0e10cSrcweir      </fileset>
179cdf0e10cSrcweir      <fileset dir=".">
180cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcs"/>
181cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcb"/>
182cdf0e10cSrcweir      </fileset>
183cdf0e10cSrcweir    </jar>
184cdf0e10cSrcweir  </target>
185cdf0e10cSrcweir
186cdf0e10cSrcweir  <!-- ===================== jar ========================= -->
1879ef65f0eSAndre Fischer  <target name="jar.provider.java" depends="compile">
188cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJava.jar"
189cdf0e10cSrcweir         basedir="${jardir}">
190cdf0e10cSrcweir        <manifest>
191cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
192cdf0e10cSrcweir            <attribute name="RegistrationClassName"
193cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.java.ScriptProviderForJava"/>
194cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar"/>
195cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
196cdf0e10cSrcweir        </manifest>
197cdf0e10cSrcweir        <include name="**/provider/java/*.class"/>
198cdf0e10cSrcweir    </jar>
1999ef65f0eSAndre Fischer  </target>
200cdf0e10cSrcweir
2019ef65f0eSAndre Fischer  <target name="jar.provider.beanshell" depends="compile" if="with_beanshell">
202cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForBeanShell.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.beanshell.ScriptProviderForBeanShell"/>
208cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar bsh.jar"/>
209cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
210cdf0e10cSrcweir        </manifest>
211cdf0e10cSrcweir        <include name="**/provider/beanshell/*.class"/>
212cdf0e10cSrcweir        <fileset dir=".">
213cdf0e10cSrcweir          <include name="**/provider/beanshell/*.bsh"/>
214cdf0e10cSrcweir        </fileset>
215cdf0e10cSrcweir    </jar>
2169ef65f0eSAndre Fischer  </target>
217cdf0e10cSrcweir
2189ef65f0eSAndre Fischer  <target name="jar.provider.javascript" depends="compile" if="with_rhino">
219cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJavaScript.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.provider.javascript.ScriptProviderForJavaScript"/>
225cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar js.jar"/>
226cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
227cdf0e10cSrcweir        </manifest>
228cdf0e10cSrcweir        <include name="**/provider/javascript/*.class"/>
229cdf0e10cSrcweir        <fileset dir=".">
230cdf0e10cSrcweir          <include name="**/provider/javascript/*.js"/>
231cdf0e10cSrcweir        </fileset>
232cdf0e10cSrcweir    </jar>
2339ef65f0eSAndre Fischer  </target>
234cdf0e10cSrcweir
2359ef65f0eSAndre Fischer  <target name="jar.scriptframework" depends="compile">
236cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptFramework.jar"
237cdf0e10cSrcweir         basedir="${jardir}">
238cdf0e10cSrcweir        <manifest>
239cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
240cdf0e10cSrcweir            <attribute name="RegistrationClassName"
241cdf0e10cSrcweir                       value="com.sun.star.script.framework.security.SecurityDialog"/>
242cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
243cdf0e10cSrcweir        </manifest>
244cdf0e10cSrcweir        <include name="**/security/*"/>
245cdf0e10cSrcweir        <include name="**/log/*.class"/>
246cdf0e10cSrcweir        <include name="**/provider/*.class"/>
247cdf0e10cSrcweir        <include name="**/browse/*.class"/>
248cdf0e10cSrcweir        <include name="**/container/*.class"/>
249cdf0e10cSrcweir        <include name="**/io/*.class"/>
250cdf0e10cSrcweir    </jar>
2519ef65f0eSAndre Fischer  </target>
252cdf0e10cSrcweir
2539ef65f0eSAndre Fischer  <target name="jar" depends="jar.provider.java,jar.provider.beanshell,jar.provider.javascript,jar.scriptframework">
254cdf0e10cSrcweir  </target>
255cdf0e10cSrcweir
256cdf0e10cSrcweir  <target name="idesupport.jar" depends="idesupport.compile">
257cdf0e10cSrcweir    <jar jarfile="${jardir}/idesupport.jar">
258cdf0e10cSrcweir      <fileset dir="${jardir}">
259cdf0e10cSrcweir          <include name="${idesupport.dir}/**/*.class"/>
260cdf0e10cSrcweir          <include name="CommandLineTools*"/>
261cdf0e10cSrcweir          <exclude name="${idesupport.dir}/localoffice/*.class"/>
262cdf0e10cSrcweir      </fileset>
263cdf0e10cSrcweir      <fileset dir=".">
264cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
265cdf0e10cSrcweir      </fileset>
266cdf0e10cSrcweir    </jar>
267cdf0e10cSrcweir  </target>
268cdf0e10cSrcweir
269cdf0e10cSrcweir  <target name="localoffice.jar" depends="localoffice.compile">
270cdf0e10cSrcweir    <unjar
271cdf0e10cSrcweir      src="${solar.jar}/unoil.jar"
272cdf0e10cSrcweir      dest="${jardir}"/>
273cdf0e10cSrcweir    <jar jarfile="${jardir}/localoffice.jar">
274cdf0e10cSrcweir      <fileset dir="${jardir}">
275cdf0e10cSrcweir        <include name="${idesupport.dir}/localoffice/*.class"/>
276cdf0e10cSrcweir        <include name="drafts/com/sun/star/script/framework/storage/*.class"/>
277cdf0e10cSrcweir      </fileset>
278cdf0e10cSrcweir    </jar>
279cdf0e10cSrcweir  </target>
280cdf0e10cSrcweir
281cdf0e10cSrcweir  <target name="netbeans.jar" depends="netbeans.compile">
282cdf0e10cSrcweir    <jar jarfile="${jardir}/office.jar" manifest="manifest.mf">
283cdf0e10cSrcweir      <fileset dir="${jardir}">
284cdf0e10cSrcweir        <include name="${netbeans.dir}/**/*.class"/>
285cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ParcelDescriptorChildren.class"/>
286cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ScriptNode.class"/>
287cdf0e10cSrcweir        <include name="${idesupport.dir}/**/*.class"/>
288cdf0e10cSrcweir        <include name="CommandLineTools*"/>
289cdf0e10cSrcweir      </fileset>
290cdf0e10cSrcweir      <fileset dir=".">
291cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
292cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/*"/>
293cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/templates/*"/>
294cdf0e10cSrcweir        <include name="${netbeans.dir}/**/Bundle*"/>
295cdf0e10cSrcweir      </fileset>
296cdf0e10cSrcweir    </jar>
297cdf0e10cSrcweir  </target>
298cdf0e10cSrcweir
299cdf0e10cSrcweir  <!-- Uncomment this target when building within NetBeans to reinstall the
300cdf0e10cSrcweir       module.
301cdf0e10cSrcweir  <target name="netbeans.install" depends="netbeans.package">
302cdf0e10cSrcweir    <copy file="${jardir}/localoffice.jar"
303cdf0e10cSrcweir          tofile="${netbeans.home}/modules/ext/localoffice.jar"/>
304cdf0e10cSrcweir    <nbinstaller action="reinstall" module="${jardir}/office.jar"/>
305cdf0e10cSrcweir  </target>
306cdf0e10cSrcweir  -->
307cdf0e10cSrcweir
308cdf0e10cSrcweir  <!-- ====================== Clean Generated Files ===================== -->
309cdf0e10cSrcweir  <target name="clean">
310cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJava.jar"/>
311cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJavaScript.jar"/>
312cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForBeanShell.jar"/>
313cdf0e10cSrcweir    <delete file="${jardir}/ScriptFramework.jar"/>
314cdf0e10cSrcweir    <delete file="${jardir}/office.jar"/>
315cdf0e10cSrcweir    <delete file="${jardir}/localoffice.jar"/>
316cdf0e10cSrcweir    <delete file="${jardir}/idesupport.jar"/>
317cdf0e10cSrcweir  </target>
318cdf0e10cSrcweir
319cdf0e10cSrcweir  <!-- ========================= All In One Build ======================= -->
320cdf0e10cSrcweir  <target name="all" depends="jar"/>
321cdf0e10cSrcweir</project>
322