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