1<project default="build"> 2 3 <!-- =================== Global Properties ============================= --> 4 <property environment="env"/> 5 <property name="macroname" value="SayHello"/> 6 <property name="unopkgfile" value="${basedir}/${macroname}.uno.pkg"/> 7 8 <!-- ==================== intialise properties ========================= --> 9 <target name="checksdk"> 10 <condition property="UsingSDK"> 11 <available file="${env.OFFICE_PROGRAM_PATH}"/> 12 </condition> 13 </target> 14 15 <target name="initsdk" if="UsingSDK"> 16 <property name="opp" value="${env.OFFICE_PROGRAM_PATH}"/> 17 </target> 18 19 <target name="initnosdk" unless="UsingSDK"> 20 <fail unless="opp" message="Path to Office install not set"/> 21 </target> 22 23 <!-- ==================== classpath setting ============================ --> 24 <target name="init" depends="checksdk,initsdk,initnosdk"> 25 <path id="scriptclasspath"> 26 <pathelement location="${opp}/classes/unoil.jar"/> 27 <pathelement location="${opp}/classes/ridl.jar"/> 28 <pathelement location="${opp}/classes/jurt.jar"/> 29 <pathelement location="${opp}/classes/juh.jar"/> 30 <pathelement location="${opp}/classes/ScriptFramework.jar"/> 31 </path> 32 </target> 33 34 <!-- ====================== Clean Generated Files ===================== --> 35 <target name="clean"> 36 <delete> 37 <fileset dir="."> 38 <include name="**/*.class"/> 39 <include name="**/*.jar"/> 40 <include name="**/*.uno.pkg"/> 41 </fileset> 42 </delete> 43 </target> 44 45 <!-- ===================== Compile the script ========================= --> 46 <target name="compile" depends="init"> 47 <javac srcdir="${macroname}" destdir="${macroname}" 48 includes="**/*.java" classpathref="scriptclasspath" 49 debug="on" optimize="on" deprecation="on"/> 50 </target> 51 52 <!-- ====================== Build UNO Package ========================= --> 53 <target name="build" depends="compile"> 54 <delete file="${unopkgfile}"/> 55 56 <jar jarfile="${macroname}/${macroname}.jar" 57 basedir="${macroname}" includes="*.class,*.gif"> 58 </jar> 59 60 <zip zipfile="${unopkgfile}"> 61 <fileset dir="${basedir}"> 62 <include name="**/*.jar"/> 63 <include name="**/parcel-descriptor.xml"/> 64 <include name="**/manifest.xml"/> 65 </fileset> 66 </zip> 67 </target> 68 69 <!-- ====================== Deploy Generated Files ==================== --> 70 <target name="deploy" depends="build"> 71 <exec executable="${opp}/unopkg"> 72 <arg line="add"/> 73 <arg line="--force"/> 74 <arg path="${unopkgfile}"/> 75 </exec> 76 </target> 77 78 <!-- ========================= All In One Build ======================= --> 79 <target name="all" depends="clean,build,deploy"/> 80 81</project> 82