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