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