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