use update checker
[jSite.git] / build.xml
1 <?xml version="1.0"?>
2
3 <project name="jSite" default="compile">
4
5         <!-- create this file if you want to re-distribute jSite -->
6         <property file="build.properties" />
7         
8         <!-- default values if no build.properties is present -->
9         <property name="version" value="custom" />
10         <property name="javac.debug" value="false" />
11         
12         <property name="src.dir" value="${basedir}/src" />
13         <property name="bin.dir" value="${basedir}/build" />
14         <property name="dist.dir" value="${basedir}/dist" />
15         <property name="images.dir" value="${basedir}/images" />
16         
17         <!-- if the next lines fails, disable or delete it. you don't need it. unless you stole my development machine. -->
18         <available filepath="${basedir}/../todesbaum-lib" file="build.xml" property="maintainer-build" />
19         <available filepath="${basedir}/../todesbaum-lib" file="build.xml" property="todesbaum.src" value="${basedir}/../todesbaum-lib/src" />
20         
21         <!-- default values for non-maintainer builds -->
22         <property name="todesbaum.src" value="${src.dir}" />
23
24         <target name="prepare">
25                 <mkdir dir="${bin.dir}" />
26         </target>
27
28         <target name="compile-maintainer" depends="prepare" if="maintainer-build">
29                 <javac destdir="${bin.dir}" debug="false" optimize="true">
30                         <src path="${src.dir}" />
31                         <sourcepath path="${todesbaum.src}" />
32                 </javac>
33         </target>
34         
35         <target name="compile-non-maintainer" depends="prepare" unless="maintainer-build">
36                 <javac destdir="${bin.dir}" debug="false" optimize="true">
37                         <src path="${src.dir}" />
38                         <sourcepath path="${todesbaum.src}" />
39                 </javac>
40         </target>
41         
42         <target name="compile" depends="compile-maintainer, compile-non-maintainer" description="compile jSite">
43                 <copy todir="${bin.dir}">
44                         <fileset dir="${src.dir}">
45                                 <include name="**/*.properties" />
46                         </fileset>
47                         <fileset dir="${images.dir}">
48                                 <include name="**/*.png" />
49                         </fileset>
50                 </copy>
51         </target>
52
53         <target name="clean" description="cleans the build environment">
54                 <delete dir="${bin.dir}" />
55         </target>
56
57         <target name="dist-clean" depends="clean" description="cleans build and distribution environments">
58                 <delete dir="${dist.dir}" />
59         </target>
60
61         <target name="prepare-dist">
62                 <mkdir dir="${dist.dir}" />
63         </target>
64                 
65         <target name="prepare-src-dist" depends="prepare-dist">
66                 <mkdir dir="${dist.dir}/${ant.project.name}-${version}" />
67                 <mkdir dir="${dist.dir}/${ant.project.name}-${version}/src" />
68                 <mkdir dir="${dist.dir}/${ant.project.name}-${version}/images" />
69         </target>
70
71         <target name="jar" depends="compile, prepare-dist" description="creates jSite jar file">
72                 <jar destfile="${dist.dir}/${ant.project.name}-${version}.jar">
73                         <fileset dir="${bin.dir}" />
74                         <manifest>
75                                 <attribute name="Main-Class" value="de.todesbaum.jsite.main.Main"/>
76                         </manifest>
77                 </jar>
78         </target>
79
80         <target name="dist-bin-zip" depends="jar" description="create binary distribution zip">
81                 <zip destfile="${dist.dir}/${ant.project.name}-${version}-bin.zip">
82                         <fileset dir="${dist.dir}">
83                                 <include name="${ant.project.name}-${version}.jar" />
84                         </fileset>
85                         <fileset dir="${basedir}">
86                                 <include name="COPYING" />
87                         </fileset>
88                 </zip>
89         </target>
90         
91         <target name="dist-bin-tbz2" depends="jar" description="create binary distribution tar.bz2">
92                 <tar destfile="${dist.dir}/${ant.project.name}-${version}-bin.tar.bz2" compression="bzip2">
93                         <tarfileset dir="${dist.dir}">
94                                 <include name="${ant.project.name}-${version}.jar" />
95                         </tarfileset>
96                         <tarfileset dir="${basedir}">
97                                 <include name="COPYING" />
98                         </tarfileset>
99                 </tar>
100         </target>
101         
102         <target name="dist-bin" depends="dist-bin-zip, dist-bin-tbz2"/>
103         
104         <target name="collect-maintainer-src" depends="prepare-src-dist" if="maintainer-build">
105                 <copy todir="${dist.dir}/${ant.project.name}-${version}/src">
106                         <fileset dir="${todesbaum.src}">
107                                 <includesfile name="build.collect-src.files" />
108                         </fileset>
109                 </copy>
110         </target>
111         
112         <target name="collect-src" depends="prepare-src-dist, collect-maintainer-src">
113                 <copy todir="${dist.dir}/${ant.project.name}-${version}/src">
114                         <fileset dir="${src.dir}">
115                                 <include name="**/*.java" />
116                                 <include name="**/*.properties" />
117                         </fileset>
118                 </copy>
119                 <copy todir="${dist.dir}/${ant.project.name}-${version}/images">
120                         <fileset dir="${images.dir}">
121                                 <include name="**/*.png" />
122                         </fileset>
123                 </copy>
124                 <copy todir="${dist.dir}/${ant.project.name}-${version}">
125                         <fileset dir="${basedir}">
126                                 <include name="COPYING" />
127                                 <include name="build.xml" />
128                         </fileset>
129                 </copy>
130         </target>
131         
132         <target name="dist-src" depends="dist-src-zip, dist-src-tbz2" />
133         
134         <target name="dist-src-zip" depends="collect-src" description="create source distribution zip">
135                 <zip destfile="${dist.dir}/${ant.project.name}-${version}-src.zip">
136                         <fileset dir="${dist.dir}">
137                                 <include name="${ant.project.name}-${version}/**/*" />
138                         </fileset>
139                 </zip>
140         </target>
141
142         <target name="dist-src-tbz2" depends="collect-src" description="create source distribution tar.bz2">
143                 <tar destfile="${dist.dir}/${ant.project.name}-${version}-src.tar.bz2" compression="bzip2">
144                         <tarfileset dir="${dist.dir}">
145                                 <include name="${ant.project.name}-${version}/**/*" />
146                         </tarfileset>
147                 </tar>
148         </target>
149         
150         <target name="dist" depends="dist-bin, dist-src" description="creates all distribution files"/>
151         
152         <target name="build-collect-src" depends="clean, compile" if="maintainer-build">
153                 <exec executable="/bin/sh" output="build.collect-src.files">
154                         <arg value="-c"/>
155                         <arg value="find build -type f | grep -v '\$' | sed 's,^build/,,' | grep '^de/todesbaum/util/' | sed 's,class$,java,'" />
156                 </exec>
157         </target>
158
159 </project>
160