aboutsummaryrefslogtreecommitdiffstats
path: root/build.xml
blob: bed0decee15574422fd620acf9d116cb13ec4863 (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
<?xml version="1.0"?>

<!-- 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 name="utils.jar" basedir="." default="all">

    <!-- Don't worry if you don't know the Ant syntax completely or need help on some tasks! -->
    <!-- The standard Ant documentation is bundled. See Help | Help Sets | Ant 1.4.1 Manual. -->

    <target name="init">
        <!-- You can set up any variables you want used throughout the script here. -->
        <!-- <property name="hello" value="world"/> -->
        <!-- To use e.g. Jikes, uncomment this line. -->
        <!-- (Or make the same change in Tools | Options | Ant Settings | Properties.) -->
        <!-- <property name="build.compiler" value="jikes"/> -->
        <!-- You might like to set up some overridable paths, etc.: -->
        <!-- <property name="mylib" value="../lib/mylib.jar"/> -->
        <mkdir dir="bin" />
        <mkdir dir="classes" />
        <mkdir dir="apidocs" />
        <mkdir dir="src/tests/test_plugin" />
    </target>

    <target name="compile" depends="init">
        <!-- 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 srcdir="src/java" destdir="classes" debug="true" deprecation="true">
            <include name="net/java/**"/>
            <!-- To add something to the classpath: -->
            <!--
            <classpath>
                <pathelement location="${mylib}"/>
            </classpath>
            -->
            <!-- To exclude some files: -->
            <!--
            <exclude name="com/foo/SomeFile.java"/>
            <exclude name="com/foo/somepackage/"/>
            -->
        </javac>
    </target>

    <target name="jar" depends="init,compile">
        <!-- To make a standalone app: -->
        <!-- 1. Create a myapp.mf manifest somewhere. -->
        <!-- 2. Put in it: -->
        <!--    Manifest-Version: 1.0 -->
        <!--    Main-Class: com.foo.Main -->
        <!-- 3. Pass to <jar>: manifest="myapp.mf" -->
        <jar jarfile="bin/jutils.jar" compress="true" basedir="classes">
            <include name="net/java/**"/>
            <exclude name="**/*.java"/>
            <exclude name="**/*.form"/>
            <exclude name="myapp.mf"/>
            <exclude name="myapp.jar"/>
            <exclude name="apidoc"/>
            <exclude name="**/plugins/test/*Plugin.class"/>
        </jar>
        <copy file="bin/jutils.jar" todir="../jinput/coreAPI/lib" />
        <copy file="bin/jutils.jar" todir="../jinput/plugins/DX8/lib" />
        <jar jarfile="src/tests/test_plugins/test_plugins.jar" compress="true" basedir="classes">
            <include name="**/plugins/test/*Plugin.class"/>
        </jar>
    </target>

    <target name="all" depends="init,jar" description="Build everything.">
        <echo message="Application built. Hello ${hello}!"/>
    </target>

    <target name="test" depends="init,all" description="Try running it.">
        <java classname="net.java.games.util.plugins.test.PluginTest" 
              fork="true" dir="src/tests" failonerror="true">
            <classpath>
               <!-- <pathelement location= "classes" /> -->
                <pathelement location="bin/jutils.jar"/>
            </classpath>
            <!-- Pass some args, perhaps: -->
            <!-- <arg value="-myfile"/> -->
            <!-- Will be given as an absolute path: -->
            <!-- <arg file="myfile.txt"/> -->
        </java>
    </target>

    <target name="javadoc" depends="init" description="Javadoc for input API.">
        <javadoc packagenames="net.java.games.util.plugins.*" 
                 destdir="apidocs"
                 additionalparam="-source 1.4">
            <sourcepath>
                <pathelement location="src/java"/>
            </sourcepath>
        </javadoc>
    </target>

    <target name="clean" depends="init" description="Clean all build products.">
        <delete>
            <fileset dir="classes">
                <include name="**/*.class"/>
            </fileset>
        </delete>
        <delete file="bin/jutils.jar"/>
        <delete file="tests/test_plugins/test_plugins.jar"/>
        <delete dir="apidocs"/>
    </target>

</project>