aboutsummaryrefslogtreecommitdiff
path: root/build.xml
blob: b987df7ec4394e555100154c3616a7ecfd9cfe2a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
<?xml version="1.0"?>
<!--  Copyright 2003-2005 Elliotte Rusty Harold

This file is part of XQuisitor.

XQuisitor is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published 
by the Free Software Foundation; either version 2 of the License, 
or (at your option) any later version.

XQuisitor is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with XQuisitor; if not, write to the 
Free Software Foundation, Inc. 
59 Temple Place, Suite 330
-->
<project name="XQuisitor2" default="help" basedir=".">
    <description>
        Build XQuisitor
    </description>
    
  <!-- set global properties for this build -->

  <target name="init">
    <tstamp/>
    <property name="Name"    value="XQuisitor2"/>
    <property name="name"    value="xquisitor2"/>
    <property name="version" value="0.1"/>
    <property name="year"    value="2013"/>

    <echo message="----------- ${Name} ${version} ------------"/>

    <property name="debug"       value="on"/>
    <property name="optimize"    value="on"/>
    <property name="deprecation" value="on"/>

    <property name="src.dir"  value="./src"/>
    <property name="lib.dir"  value="./lib"/>
    <property name="packages" value="com.snilius.xquery.*"/>

    <property name="build.dir"      value="./build"/>
    <property name="build.src"      value="./build/src"/>
    <property name="build.dest"     value="./build/classes"/>
    <property name="build.javadocs" value="./build/apidocs"/>
    <property name="dist.dir"       value="./dist"/>   
    <property name="packaging"       value="${src.dir}/packaging"/>    
    
    <filter token="year"    value="${year}"/>
    <filter token="version" value="${version}"/>
    <filter token="date"    value="${TODAY}"/>
    <filter token="log"     value="true"/>
    <filter token="verbose" value="true"/>

    <property name="saxon.jar"     value="${lib.dir}/saxon8.jar"/>
    <property name="macstubs.jar"  value="${lib.dir}/AppleJavaExtensions.jar"/>
    
    <path id="compile.class.path">
      <pathelement location="${macstubs.jar}"/>
      <pathelement location="${saxon.jar}"/>
    </path>
    
  </target>

  <target name="help">
    <echo>
XQuisitor Build file
-------------------------------------------------------------
    
  available targets are:
    
    help     --> print this message
    jar      --> build the xquisitor.jar file
    mac      --> build XQuisitor.app Mac OS X application
    compile  --> compile the source code
    clean    --> clean up the build directory
    dist     --> the zip and .tar.gz files
    
-------------------------------------------------------------
    </echo>
  </target>

  <target name="prepare" depends="init">
    <mkdir dir="${dist.dir}"/>
    <mkdir dir="${build.dir}"/>
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>

    <copy todir="${build.src}" filtering="yes">
      <fileset dir="${src.dir}"/>
    </copy>
    
  </target>

  <target name="compile" depends="prepare" description="Compile the source code">
    <javac srcdir="${build.src}"
           destdir="${build.dest}"
           debug="${debug}"
           optimize="${optimize}"
           deprecation="yes">
      <classpath refid="compile.class.path"/>
    </javac>
    <!-- copy properties files so they get jarred up -->
   <copy todir="${build.dest}/com/snilius/xquery" filtering="yes">
      <fileset dir="${build.src}/com/snilius/xquery" includes="*.properties"/>
    </copy>
        
  </target>

  <target name="jar" depends="compile" description="Create xquisitor.jar">
    <jar jarfile="${build.dir}/${name}-${version}.jar"
         basedir="${build.dest}"
         index="no"
		 compress="no">
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
       <!-- <attribute name="Class-Path" value="${saxon.jar}"/>  -->
        <attribute name="Main-Class" value="com.snilius.xquery.XQuisitor"/>
      </manifest>
    </jar>
    
    <!-- Don't distrivute this one because it bundles saxon too closely
        with XQuisitor and the licenses conflict. However, this one
        doesn't have CLASSPATH problems. -->
    <jar jarfile="${build.dir}/${Name}.jar"
         basedir="${build.dest}"
         index="no"
		 compress="no">
      <manifest>
        <attribute name="Built-By" value="${user.name}"/>
       <!-- <attribute name="Class-Path" value="${saxon.jar}"/>  -->
        <attribute name="Main-Class" value="com.snilius.xquery.XQuisitor"/>
      </manifest>
      <zipfileset src="${saxon.jar}" includes="**/*.class" />
    </jar>
  </target>

  <target name="dist" depends="zip, tar.gz" />

  <target name="zip" depends="jar" description="Build zip file for distro">
    <zip destfile="${dist.dir}/${name}-${version}.zip">
      <zipfileset prefix="XQuisitor" dir="." 
        excludes="**/*.zip, **/.thumbnails/**, **/.nautilus-metafile.xml, website/**, **/.project, **/.classpath, build/**, dist/**"/>   
      <zipfileset fullpath="XQuisitor/${name}-${version}.jar" dir="./${build.dir}" includes="${name}-${version}.jar"/>   
    </zip>
  </target>
  
  <target name="tar" depends="jar" description="Build tar file for distro">
    <tar destfile="${dist.dir}/${name}-${version}.tar">
      <tarfileset prefix="XQuisitor" dir="." 
        excludes="**/*.zip, **/.thumbnails/**, **/.nautilus-metafile.xml, website/**, **/.project, **/.classpath, build/**, dist/**"/>   
       <tarfileset fullpath="XQuisitor/${name}-${version}.jar" dir="./${build.dir}" includes="${name}-${version}.jar"/>   
    </tar>
  </target>
  
  <target name="tar.gz" depends="tar" description="Build tar.gz file for distro">
     <gzip src="${dist.dir}/${name}-${version}.tar" zipfile="${dist.dir}/${name}-${version}.tar.gz"/>
  </target>
  
  
  <target name="mac" depends="jar">
    <property name="appdir" value="${dist.dir}/${Name}.app"/>
    <mkdir dir="${appdir}"/>
    <mkdir dir="${appdir}/Contents"/>
    <mkdir dir="${appdir}/Contents/MacOS"/>
    <mkdir dir="${appdir}/Contents/Resources"/>
    <mkdir dir="${appdir}/Contents/Resources/Java"/>
    <copy file="${packaging}/JavaApplicationStub" todir="${appdir}/Contents/MacOS"/>
    <exec executable="chmod">
      <arg value="755"/> 
      <arg value="${appdir}/Contents/MacOS/JavaApplicationStub"/>
    </exec>
    <copy file="${packaging}/PkgInfo" todir="${dist.dir}/${Name}.app/Contents"/>
    <copy file="${packaging}/Info.plist" todir="${dist.dir}/${Name}.app/Contents"/>
    <copy file="${build.dir}/${name}-${version}.jar" todir="${appdir}/Contents/Resources/Java"/>
    <copy todir="${appdir}/Contents/Resources/Java">
      <fileset dir="${lib.dir}">
        <include name="*.jar"/>
      </fileset>
    </copy>
    <exec executable="/Developer/Tools/SetFile">
       <arg value="-a"/>
       <arg value="B"/>
       <arg value="${appdir}"/>
    </exec>
  </target>
  
    
  <target name="clean" depends="init" description="Remove build files">
    <delete dir="${build.dir}"/>
  </target>
  
</project>