1 <?xml version="1.0" encoding="UTF-8"?>
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 <project default="build">
21 <!-- =================== Global Properties ============================= -->
22 <property environment="env"/>
23 <property name="macroname" value="SayHello"/>
24 <property name="unopkgfile" value="${basedir}/${macroname}.uno.pkg"/>
26 <!-- ==================== initialise properties ========================= -->
27 <target name="checksdk">
28 <condition property="UsingSDK">
29 <available file="${env.OFFICE_PROGRAM_PATH}"/>
33 <target name="initsdk" if="UsingSDK">
34 <property name="opp" value="${env.OFFICE_PROGRAM_PATH}"/>
37 <target name="initnosdk" unless="UsingSDK">
38 <fail unless="opp" message="Path to Office install not set"/>
41 <!-- ==================== classpath setting ============================ -->
42 <target name="init" depends="checksdk,initsdk,initnosdk">
43 <path id="scriptclasspath">
44 <pathelement location="${opp}/classes/unoil.jar"/>
45 <pathelement location="${opp}/classes/ridl.jar"/>
46 <pathelement location="${opp}/classes/jurt.jar"/>
47 <pathelement location="${opp}/classes/juh.jar"/>
48 <pathelement location="${opp}/classes/ScriptFramework.jar"/>
52 <!-- ====================== Clean Generated Files ===================== -->
56 <include name="**/*.class"/>
57 <include name="**/*.jar"/>
58 <include name="**/*.uno.pkg"/>
63 <!-- ===================== Compile the script ========================= -->
64 <target name="compile" depends="init">
65 <javac srcdir="${macroname}" destdir="${macroname}"
66 includes="**/*.java" classpathref="scriptclasspath"
67 debug="on" optimize="on" deprecation="on"/>
70 <!-- ====================== Build UNO Package ========================= -->
71 <target name="build" depends="compile">
72 <delete file="${unopkgfile}"/>
74 <jar jarfile="${macroname}/${macroname}.jar"
75 basedir="${macroname}" includes="*.class,*.gif">
78 <zip zipfile="${unopkgfile}">
79 <fileset dir="${basedir}">
80 <include name="**/*.jar"/>
81 <include name="**/parcel-descriptor.xml"/>
82 <include name="**/manifest.xml"/>
87 <!-- ====================== Deploy Generated Files ==================== -->
88 <target name="deploy" depends="build">
89 <exec executable="${opp}/unopkg">
92 <arg path="${unopkgfile}"/>
96 <!-- ========================= All In One Build ======================= -->
97 <target name="all" depends="clean,build,deploy"/>