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