xref: /aoo42x/main/scripting/java/build.xml (revision 8b0d3335)
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=".."/>
28*8b0d3335SPedro 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>
85cdf0e10cSrcweir  <path id="macPath" location="${java.home}/../Classes/classes.jar"/>
86cdf0e10cSrcweir  <!-- rhino.jar from OpenJDK breaks build -->
87cdf0e10cSrcweir  <path id="nonMacPath">
88cdf0e10cSrcweir    <fileset dir="${java.home}/">
89cdf0e10cSrcweir       <include name="jre/lib/*.jar"/>
90cdf0e10cSrcweir       <include name="lib/*.jar"/>
91cdf0e10cSrcweir       <exclude name="jre/lib/rhino.jar"/>
92cdf0e10cSrcweir       <exclude name="lib/rhino.jar"/>
93cdf0e10cSrcweir     </fileset>
94cdf0e10cSrcweir  </path>
95cdf0e10cSrcweir  <path id="my.bootstrap.classpath" refID="${boot_refID}"/>
96cdf0e10cSrcweir
97cdf0e10cSrcweir  <!-- ===================== Prepare Directories ========================= -->
98cdf0e10cSrcweir  <target name="prepare">
99cdf0e10cSrcweir    <mkdir dir="${jardir}"/>
100cdf0e10cSrcweir  </target>
101cdf0e10cSrcweir
102cdf0e10cSrcweir  <!-- ======================== Compile Classes ========================== -->
1039ef65f0eSAndre Fischer  <target name="compile" depends="prepare, eval_environment">
104cdf0e10cSrcweir    <javac srcdir="com" destdir="${jardir}"
105cc697cd0SHerbert Dürr         includes="**/*.java" classpathref="idlclasspath" includeantruntime="false"
106cdf0e10cSrcweir         debug="${debug}" optimize="${optimize}" deprecation="off">
1079ef65f0eSAndre Fischer      <exclude name="**/provider/javascript/*.java" unless="with_rhino" />
1089ef65f0eSAndre Fischer      <exclude name="**/provider/beanshell/*.java" unless="with_beanshell" />
109cdf0e10cSrcweir      <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
110cdf0e10cSrcweir    </javac>
111cdf0e10cSrcweir    <javac srcdir="Framework/" destdir="${jardir}"
112cdf0e10cSrcweir         includes="**/*.java" classpathref="idlclasspath" debug="${debug}"
113cc697cd0SHerbert Dürr         optimize="${optimize}" deprecation="off" includeantruntime="false">
114cdf0e10cSrcweir     <compilerarg value="-Xbootclasspath:${toString:my.bootstrap.classpath}"/>
115cdf0e10cSrcweir    </javac>
116cdf0e10cSrcweir  </target>
117cdf0e10cSrcweir
118cdf0e10cSrcweir  <target name="idesupport.compile" depends="compile, prepare">
119cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
120cdf0e10cSrcweir           debug="${debug}" deprecation="on">
121cdf0e10cSrcweir      <classpath refid="idesupport.class.path"/>
122cdf0e10cSrcweir      <exclude name="${idesupport.dir}/**/.*/*"/>
123cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/**/*"/>
124cdf0e10cSrcweir      <exclude name="${idesupport.dir}/LocalOffice.java"/>
125cdf0e10cSrcweir      <include name="${idesupport.dir}/*.java"/>
126cdf0e10cSrcweir      <include name="${idesupport.dir}/*/*.java"/>
127cdf0e10cSrcweir    </javac>
128cdf0e10cSrcweir  </target>
129cdf0e10cSrcweir
130cdf0e10cSrcweir  <target name="localoffice.compile" depends="prepare">
131cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
132cdf0e10cSrcweir           debug="${debug}" deprecation="on">
133cdf0e10cSrcweir      <classpath refid="idlclasspath"/>
134cdf0e10cSrcweir      <exclude name="${idesupport.dir}/localoffice/.*/*"/>
135cdf0e10cSrcweir      <include name="${idesupport.dir}/localoffice/*.java"/>
136cdf0e10cSrcweir    </javac>
137cdf0e10cSrcweir  </target>
138cdf0e10cSrcweir
139cdf0e10cSrcweir  <target name="netbeans.compile" depends="idesupport.compile, prepare">
140cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
141cdf0e10cSrcweir           debug="${debug}" deprecation="on">
142cdf0e10cSrcweir      <classpath refid="openide.class.path"/>
143cdf0e10cSrcweir      <exclude name="${netbeans.dir}/**/.*/*"/>
144cdf0e10cSrcweir      <include name="${netbeans.dir}/**/*.java"/>
145cdf0e10cSrcweir    </javac>
146cdf0e10cSrcweir  </target>
147cdf0e10cSrcweir
148cdf0e10cSrcweir  <target name="netbeans.editor.support" depends="prepare">
149cdf0e10cSrcweir    <javac srcdir="." destdir="${jardir}"
150cdf0e10cSrcweir           debug="${debug}" deprecation="on">
151cdf0e10cSrcweir      <classpath refid="netbeans.editor.support.classpath"/>
152cdf0e10cSrcweir      <include name="org/openoffice/netbeans/editor/*.java"/>
153cdf0e10cSrcweir    </javac>
154cdf0e10cSrcweir    <jar jarfile="${jardir}/nb-editorsupport.jar">
155cdf0e10cSrcweir      <fileset dir="${jardir}">
156cdf0e10cSrcweir          <include name="org/openoffice/netbeans/editor/*.class"/>
157cdf0e10cSrcweir      </fileset>
158cdf0e10cSrcweir      <fileset dir=".">
159cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcs"/>
160cdf0e10cSrcweir        <include name="org/openoffice/netbeans/editor/OOo.jcb"/>
161cdf0e10cSrcweir      </fileset>
162cdf0e10cSrcweir    </jar>
163cdf0e10cSrcweir  </target>
164cdf0e10cSrcweir
165cdf0e10cSrcweir  <!-- ===================== jar ========================= -->
1669ef65f0eSAndre Fischer  <target name="jar.provider.java" depends="compile">
167cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJava.jar"
168cdf0e10cSrcweir         basedir="${jardir}">
169cdf0e10cSrcweir        <manifest>
170cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
171cdf0e10cSrcweir            <attribute name="RegistrationClassName"
172cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.java.ScriptProviderForJava"/>
173cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar"/>
174cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
175cdf0e10cSrcweir        </manifest>
176cdf0e10cSrcweir        <include name="**/provider/java/*.class"/>
177cdf0e10cSrcweir    </jar>
1789ef65f0eSAndre Fischer  </target>
179cdf0e10cSrcweir
1809ef65f0eSAndre Fischer  <target name="jar.provider.beanshell" depends="compile" if="with_beanshell">
181cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForBeanShell.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.beanshell.ScriptProviderForBeanShell"/>
187cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar bsh.jar"/>
188cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
189cdf0e10cSrcweir        </manifest>
190cdf0e10cSrcweir        <include name="**/provider/beanshell/*.class"/>
191cdf0e10cSrcweir        <fileset dir=".">
192cdf0e10cSrcweir          <include name="**/provider/beanshell/*.bsh"/>
193cdf0e10cSrcweir        </fileset>
194cdf0e10cSrcweir    </jar>
1959ef65f0eSAndre Fischer  </target>
196cdf0e10cSrcweir
1979ef65f0eSAndre Fischer  <target name="jar.provider.javascript" depends="compile" if="with_rhino">
198cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptProviderForJavaScript.jar"
199cdf0e10cSrcweir         basedir="${jardir}">
200cdf0e10cSrcweir        <manifest>
201cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
202cdf0e10cSrcweir            <attribute name="RegistrationClassName"
203cdf0e10cSrcweir                       value="com.sun.star.script.framework.provider.javascript.ScriptProviderForJavaScript"/>
204cdf0e10cSrcweir            <attribute name="Class-Path" value="ScriptFramework.jar js.jar"/>
205cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
206cdf0e10cSrcweir        </manifest>
207cdf0e10cSrcweir        <include name="**/provider/javascript/*.class"/>
208cdf0e10cSrcweir        <fileset dir=".">
209cdf0e10cSrcweir          <include name="**/provider/javascript/*.js"/>
210cdf0e10cSrcweir        </fileset>
211cdf0e10cSrcweir    </jar>
2129ef65f0eSAndre Fischer  </target>
213cdf0e10cSrcweir
2149ef65f0eSAndre Fischer  <target name="jar.scriptframework" depends="compile">
215cdf0e10cSrcweir    <jar jarfile="${jardir}/ScriptFramework.jar"
216cdf0e10cSrcweir         basedir="${jardir}">
217cdf0e10cSrcweir        <manifest>
218cdf0e10cSrcweir            <attribute name="Built-By" value="Sun Microsystems"/>
219cdf0e10cSrcweir            <attribute name="RegistrationClassName"
220cdf0e10cSrcweir                       value="com.sun.star.script.framework.security.SecurityDialog"/>
221cdf0e10cSrcweir            <attribute name="UNO-Type-Path" value=""/>
222cdf0e10cSrcweir        </manifest>
223cdf0e10cSrcweir        <include name="**/security/*"/>
224cdf0e10cSrcweir        <include name="**/log/*.class"/>
225cdf0e10cSrcweir        <include name="**/provider/*.class"/>
226cdf0e10cSrcweir        <include name="**/browse/*.class"/>
227cdf0e10cSrcweir        <include name="**/container/*.class"/>
228cdf0e10cSrcweir        <include name="**/io/*.class"/>
229cdf0e10cSrcweir    </jar>
2309ef65f0eSAndre Fischer  </target>
231cdf0e10cSrcweir
2329ef65f0eSAndre Fischer  <target name="jar" depends="jar.provider.java,jar.provider.beanshell,jar.provider.javascript,jar.scriptframework">
233cdf0e10cSrcweir  </target>
234cdf0e10cSrcweir
235cdf0e10cSrcweir  <target name="idesupport.jar" depends="idesupport.compile">
236cdf0e10cSrcweir    <jar jarfile="${jardir}/idesupport.jar">
237cdf0e10cSrcweir      <fileset dir="${jardir}">
238cdf0e10cSrcweir          <include name="${idesupport.dir}/**/*.class"/>
239cdf0e10cSrcweir          <include name="CommandLineTools*"/>
240cdf0e10cSrcweir          <exclude name="${idesupport.dir}/localoffice/*.class"/>
241cdf0e10cSrcweir      </fileset>
242cdf0e10cSrcweir      <fileset dir=".">
243cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
244cdf0e10cSrcweir      </fileset>
245cdf0e10cSrcweir    </jar>
246cdf0e10cSrcweir  </target>
247cdf0e10cSrcweir
248cdf0e10cSrcweir  <target name="localoffice.jar" depends="localoffice.compile">
249cdf0e10cSrcweir    <unjar
250cdf0e10cSrcweir      src="${solar.jar}/unoil.jar"
251cdf0e10cSrcweir      dest="${jardir}"/>
252cdf0e10cSrcweir    <jar jarfile="${jardir}/localoffice.jar">
253cdf0e10cSrcweir      <fileset dir="${jardir}">
254cdf0e10cSrcweir        <include name="${idesupport.dir}/localoffice/*.class"/>
255cdf0e10cSrcweir        <include name="drafts/com/sun/star/script/framework/storage/*.class"/>
256cdf0e10cSrcweir      </fileset>
257cdf0e10cSrcweir    </jar>
258cdf0e10cSrcweir  </target>
259cdf0e10cSrcweir
260cdf0e10cSrcweir  <target name="netbeans.jar" depends="netbeans.compile">
261cdf0e10cSrcweir    <jar jarfile="${jardir}/office.jar" manifest="manifest.mf">
262cdf0e10cSrcweir      <fileset dir="${jardir}">
263cdf0e10cSrcweir        <include name="${netbeans.dir}/**/*.class"/>
264cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ParcelDescriptorChildren.class"/>
265cdf0e10cSrcweir        <exclude name="${netbeans.dir}/**/ScriptNode.class"/>
266cdf0e10cSrcweir        <include name="${idesupport.dir}/**/*.class"/>
267cdf0e10cSrcweir        <include name="CommandLineTools*"/>
268cdf0e10cSrcweir      </fileset>
269cdf0e10cSrcweir      <fileset dir=".">
270cdf0e10cSrcweir        <include name="${idesupport.dir}/ui/add.gif"/>
271cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/*"/>
272cdf0e10cSrcweir        <include name="${netbeans.dir}/resources/templates/*"/>
273cdf0e10cSrcweir        <include name="${netbeans.dir}/**/Bundle*"/>
274cdf0e10cSrcweir      </fileset>
275cdf0e10cSrcweir    </jar>
276cdf0e10cSrcweir  </target>
277cdf0e10cSrcweir
278cdf0e10cSrcweir  <!-- Uncomment this target when building within NetBeans to reinstall the
279cdf0e10cSrcweir       module.
280cdf0e10cSrcweir  <target name="netbeans.install" depends="netbeans.package">
281cdf0e10cSrcweir    <copy file="${jardir}/localoffice.jar"
282cdf0e10cSrcweir          tofile="${netbeans.home}/modules/ext/localoffice.jar"/>
283cdf0e10cSrcweir    <nbinstaller action="reinstall" module="${jardir}/office.jar"/>
284cdf0e10cSrcweir  </target>
285cdf0e10cSrcweir  -->
286cdf0e10cSrcweir
287cdf0e10cSrcweir  <!-- ====================== Clean Generated Files ===================== -->
288cdf0e10cSrcweir  <target name="clean">
289cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJava.jar"/>
290cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForJavaScript.jar"/>
291cdf0e10cSrcweir    <delete file="${jardir}/ScriptProviderForBeanShell.jar"/>
292cdf0e10cSrcweir    <delete file="${jardir}/ScriptFramework.jar"/>
293cdf0e10cSrcweir    <delete file="${jardir}/office.jar"/>
294cdf0e10cSrcweir    <delete file="${jardir}/localoffice.jar"/>
295cdf0e10cSrcweir    <delete file="${jardir}/idesupport.jar"/>
296cdf0e10cSrcweir  </target>
297cdf0e10cSrcweir
298cdf0e10cSrcweir  <!-- ========================= All In One Build ======================= -->
299cdf0e10cSrcweir  <target name="all" depends="jar"/>
300cdf0e10cSrcweir</project>
301