aboutsummaryrefslogtreecommitdiff
path: root/build.xml
blob: 1e41706767e7be68e7fc61d786a4f3e714e2b767 (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
<?xml version="1.0" encoding="UTF-8"?>
<!-- Written to assume that classpath is rooted in the current directory. -->
<!-- So this should be OK if you make this script in the root of a filesystem. -->
<!-- If not, you may prefer to adjust the basedir, or move some directories around. -->
<!-- The idea is that both Ant and NetBeans have to know what the package root is -->
<!-- for the classes in your application. -->
<project basedir="." default="all" name="jaimlib">

    <target name="init">     
    </target>

    <target depends="init" name="compile">
       <mkdir dir="build"/>
        <!-- Both srcdir and destdir should be package roots. -->
        <!-- They could be different of course; in that case NetBeans can also be set -->
        <!-- up to compile to a different filesystem in the same way; see Compiler Types: -->
        <javac debug="true" deprecation="true" destdir="build" srcdir="src">
        </javac>
    </target>

    <target depends="init,compile" name="jar">
        <mkdir dir="lib"/>
	<copy todir="build">
 	    <fileset dir="src">
	       <include name="**/*.properties"/>
	    </fileset>
        </copy>
        <jar basedir="build" compress="true" jarfile="lib/jaimlib.jar">    
            <exclude name="**/*.java"/>
            <exclude name="**/jaimtest/**"/>
        </jar>
    </target>

    <target depends="init,compile" name="jartest">
        <mkdir dir="lib"/>
        <jar basedir="build" compress="true" jarfile="lib/jaimtest.jar">    
	    <manifest>
 	       <attribute name="Main-Class" value="com.wilko.jaimtest.JaimTest"/>
	    </manifest>
            <exclude name="**/*.java"/>
        </jar>
    </target>

    <target depends="init,jar,jartest" description="Build everything." name="all">
    </target>

    <target depends="init" description="Javadoc for my API." name="javadoc">
        <mkdir dir="doc/apidoc"/>
        <javadoc destdir="doc/apidoc" packagenames="com.wilko.jaim.*">
            <sourcepath>
                <pathelement location="src"/>
            </sourcepath>
            <footer><![CDATA[<a href="http://jaimlib.sourceforge.net">jaimlib.sourceforge.net</a>]]></footer>
        </javadoc>
    </target>

    <target depends="init" description="Clean all build products." name="clean">
    <delete dir="doc/apidoc" includeEmptyDirs="true"/>
    <delete dir="build" includeEmptyDirs="true"/>
    <delete dir="lib" includeEmptyDirs="true"/>
    <delete>
       <fileset dir="src" includes="**/*.class"/>
    </delete>
    </target>

    <target depends="javadoc,compile,jar,jartest" name="dist">
        <delete>
           <fileset dir="." includes="jaimlib.tar*"/>
        </delete>
        <mkdir dir="jaimlib"/>
        <mkdir dir="jaimlib/lib"/>
        <mkdir dir="jaimlib/doc"/>
        <copy todir="jaimlib">
           <fileset dir="." includes="license.txt"/>
           <fileset dir="." includes="build.xml"/>
           <fileset dir="." includes="changes.txt"/>
           <fileset dir="." includes="readme.txt"/>
        </copy>   
        <copy todir="jaimlib/lib">
           <fileset dir="lib"/>
        </copy>
        <copy todir="jaimlib/doc">
            <fileset dir="doc"/>
        </copy>
        <tar basedir="." includes="jaimlib/**/*" tarfile="jaimlib.tar"/>
        <gzip src="jaimlib.tar" zipfile="jaimlib.tar.gz"/>
        <delete file="jaimlib.tar"/>
        <delete dir="jaimlib" includeEmptyDirs="true"/>
    </target>
    <target depends="javadoc,compile,jar,jartest" name="srcdist">
        <delete>
           <fileset dir="." includes="jaimlibsrc.tar*"/>
        </delete>
        <mkdir dir="jaimlib"/>
        <mkdir dir="jaimlib/lib"/>
        <mkdir dir="jaimlib/doc"/>
        <mkdir dir="jaimlib/src"/>
        <copy todir="jaimlib">
           <fileset dir="." includes="license.txt"/>
           <fileset dir="." includes="build.xml"/>
           <fileset dir="." includes="changes.txt"/>
           <fileset dir="." includes="readme.txt"/>
        </copy>   
        <copy todir="jaimlib/lib">
           <fileset dir="lib"/>
        </copy>
        <copy todir="jaimlib/doc">
            <fileset dir="doc"/>
        </copy>
        <copy todir="jaimlib/src">
            <fileset dir="src"/>
        </copy>
        <tar basedir="." includes="jaimlib/**/*" tarfile="jaimlibsrc.tar"/>
        <gzip src="jaimlibsrc.tar" zipfile="jaimlibsrc.tar.gz"/>
        <delete file="jaimlibsrc.tar"/>
        <delete dir="jaimlib" includeEmptyDirs="true"/>
    </target>
</project>