1*b1cdbd2cSJim Jagielski<?xml version="1.0" encoding="UTF-8"?>
2*b1cdbd2cSJim Jagielski<!--***********************************************************
3*b1cdbd2cSJim Jagielski *
4*b1cdbd2cSJim Jagielski * Licensed to the Apache Software Foundation (ASF) under one
5*b1cdbd2cSJim Jagielski * or more contributor license agreements.  See the NOTICE file
6*b1cdbd2cSJim Jagielski * distributed with this work for additional information
7*b1cdbd2cSJim Jagielski * regarding copyright ownership.  The ASF licenses this file
8*b1cdbd2cSJim Jagielski * to you under the Apache License, Version 2.0 (the
9*b1cdbd2cSJim Jagielski * "License"); you may not use this file except in compliance
10*b1cdbd2cSJim Jagielski * with the License.  You may obtain a copy of the License at
11*b1cdbd2cSJim Jagielski *
12*b1cdbd2cSJim Jagielski *   http://www.apache.org/licenses/LICENSE-2.0
13*b1cdbd2cSJim Jagielski *
14*b1cdbd2cSJim Jagielski * Unless required by applicable law or agreed to in writing,
15*b1cdbd2cSJim Jagielski * software distributed under the License is distributed on an
16*b1cdbd2cSJim Jagielski * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17*b1cdbd2cSJim Jagielski * KIND, either express or implied.  See the License for the
18*b1cdbd2cSJim Jagielski * specific language governing permissions and limitations
19*b1cdbd2cSJim Jagielski * under the License.
20*b1cdbd2cSJim Jagielski *
21*b1cdbd2cSJim Jagielski ***********************************************************-->
22*b1cdbd2cSJim Jagielski<project default="build">
23*b1cdbd2cSJim Jagielski
24*b1cdbd2cSJim Jagielski  <!-- =================== Global Properties ============================= -->
25*b1cdbd2cSJim Jagielski  <property environment="env"/>
26*b1cdbd2cSJim Jagielski  <property name="macroname" value="SayHello"/>
27*b1cdbd2cSJim Jagielski  <property name="unopkgfile" value="${basedir}/${macroname}.uno.pkg"/>
28*b1cdbd2cSJim Jagielski
29*b1cdbd2cSJim Jagielski  <!-- ==================== intialise properties ========================= -->
30*b1cdbd2cSJim Jagielski  <target name="checksdk">
31*b1cdbd2cSJim Jagielski    <condition property="UsingSDK">
32*b1cdbd2cSJim Jagielski      <available file="${env.OFFICE_PROGRAM_PATH}"/>
33*b1cdbd2cSJim Jagielski    </condition>
34*b1cdbd2cSJim Jagielski  </target>
35*b1cdbd2cSJim Jagielski
36*b1cdbd2cSJim Jagielski  <target name="initsdk" if="UsingSDK">
37*b1cdbd2cSJim Jagielski    <property name="opp" value="${env.OFFICE_PROGRAM_PATH}"/>
38*b1cdbd2cSJim Jagielski  </target>
39*b1cdbd2cSJim Jagielski
40*b1cdbd2cSJim Jagielski  <target name="initnosdk" unless="UsingSDK">
41*b1cdbd2cSJim Jagielski    <fail unless="opp" message="Path to Office install not set"/>
42*b1cdbd2cSJim Jagielski  </target>
43*b1cdbd2cSJim Jagielski
44*b1cdbd2cSJim Jagielski  <!-- ==================== classpath setting ============================ -->
45*b1cdbd2cSJim Jagielski  <target name="init" depends="checksdk,initsdk,initnosdk">
46*b1cdbd2cSJim Jagielski    <path id="scriptclasspath">
47*b1cdbd2cSJim Jagielski      <pathelement location="${opp}/classes/unoil.jar"/>
48*b1cdbd2cSJim Jagielski      <pathelement location="${opp}/classes/ridl.jar"/>
49*b1cdbd2cSJim Jagielski      <pathelement location="${opp}/classes/jurt.jar"/>
50*b1cdbd2cSJim Jagielski      <pathelement location="${opp}/classes/juh.jar"/>
51*b1cdbd2cSJim Jagielski      <pathelement location="${opp}/classes/ScriptFramework.jar"/>
52*b1cdbd2cSJim Jagielski    </path>
53*b1cdbd2cSJim Jagielski  </target>
54*b1cdbd2cSJim Jagielski
55*b1cdbd2cSJim Jagielski  <!-- ====================== Clean Generated Files ===================== -->
56*b1cdbd2cSJim Jagielski  <target name="clean">
57*b1cdbd2cSJim Jagielski    <delete>
58*b1cdbd2cSJim Jagielski      <fileset dir=".">
59*b1cdbd2cSJim Jagielski        <include name="**/*.class"/>
60*b1cdbd2cSJim Jagielski        <include name="**/*.jar"/>
61*b1cdbd2cSJim Jagielski        <include name="**/*.uno.pkg"/>
62*b1cdbd2cSJim Jagielski      </fileset>
63*b1cdbd2cSJim Jagielski    </delete>
64*b1cdbd2cSJim Jagielski  </target>
65*b1cdbd2cSJim Jagielski
66*b1cdbd2cSJim Jagielski  <!-- ===================== Compile the script ========================= -->
67*b1cdbd2cSJim Jagielski  <target name="compile" depends="init">
68*b1cdbd2cSJim Jagielski    <javac srcdir="${macroname}" destdir="${macroname}"
69*b1cdbd2cSJim Jagielski           includes="**/*.java" classpathref="scriptclasspath"
70*b1cdbd2cSJim Jagielski           debug="on" optimize="on" deprecation="on"/>
71*b1cdbd2cSJim Jagielski  </target>
72*b1cdbd2cSJim Jagielski
73*b1cdbd2cSJim Jagielski  <!-- ====================== Build UNO Package ========================= -->
74*b1cdbd2cSJim Jagielski  <target name="build" depends="compile">
75*b1cdbd2cSJim Jagielski    <delete file="${unopkgfile}"/>
76*b1cdbd2cSJim Jagielski
77*b1cdbd2cSJim Jagielski    <jar jarfile="${macroname}/${macroname}.jar"
78*b1cdbd2cSJim Jagielski         basedir="${macroname}" includes="*.class,*.gif">
79*b1cdbd2cSJim Jagielski    </jar>
80*b1cdbd2cSJim Jagielski
81*b1cdbd2cSJim Jagielski    <zip zipfile="${unopkgfile}">
82*b1cdbd2cSJim Jagielski      <fileset dir="${basedir}">
83*b1cdbd2cSJim Jagielski        <include name="**/*.jar"/>
84*b1cdbd2cSJim Jagielski        <include name="**/parcel-descriptor.xml"/>
85*b1cdbd2cSJim Jagielski        <include name="**/manifest.xml"/>
86*b1cdbd2cSJim Jagielski      </fileset>
87*b1cdbd2cSJim Jagielski    </zip>
88*b1cdbd2cSJim Jagielski  </target>
89*b1cdbd2cSJim Jagielski
90*b1cdbd2cSJim Jagielski  <!-- ====================== Deploy Generated Files ==================== -->
91*b1cdbd2cSJim Jagielski  <target name="deploy" depends="build">
92*b1cdbd2cSJim Jagielski    <exec executable="${opp}/unopkg">
93*b1cdbd2cSJim Jagielski      <arg line="add"/>
94*b1cdbd2cSJim Jagielski      <arg line="--force"/>
95*b1cdbd2cSJim Jagielski      <arg path="${unopkgfile}"/>
96*b1cdbd2cSJim Jagielski    </exec>
97*b1cdbd2cSJim Jagielski  </target>
98*b1cdbd2cSJim Jagielski
99*b1cdbd2cSJim Jagielski  <!-- ========================= All In One Build ======================= -->
100*b1cdbd2cSJim Jagielski  <target name="all" depends="clean,build,deploy"/>
101*b1cdbd2cSJim Jagielski
102*b1cdbd2cSJim Jagielski</project>
103