summaryrefslogtreecommitdiffstats
path: root/make/build.xml
blob: 7ea559514df6fd131873df6e0e22db91d9e4eff8 (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
<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant build for the JOAL demos. This build has been tested with ANT 1.5.3.
   -
   - In order for this build to succeed the resulting jar files from this build
   - (joal-demos.jar) must not be on the CLASSPATH.
   -
   - This build requires that the joal project has been checked out into a sibling
   - directory to the joal-demos top-level directory and that the joal.jar has been
   - built into its build directory.
   -->
<project name="JOAL.demos" default="all">
    <!-- 
       - Make sure that joal-demos.jar is not on the CLASSPATH; this can
       - cause builds to fail since if this Java process has the jar file
       - open we can not overwrite it.
      -->
    <target name="test.for.joal.demos.jar">
        <available property="joal.demos.jar.on.class.path" classname="demos.devmaster.lesson1.SingleStaticSource" />
    </target>
    <target name="java.class.path.validate" depends="test.for.joal.demos.jar" if="joal.demos.jar.on.class.path">
        <fail>
        
    ******************************************************************
    ** Your CLASSPATH environment variable appears to be set (some  **
    ** JOAL demos' classes are currently visible to the build.)     **
    ** This can cause the build to fail. Please unset your          **
    ** CLASSPATH variable and restart the build.                    **
    ******************************************************************
        </fail>
    </target>

    <target name="init" depends="java.class.path.validate">
        <property name="joal.jar"            value="../../joal/build/joal.jar" />

        <property name="build.dir"           value="../build" />
        <property name="src.dir"             value="../src" />
        <property name="classes.dir"         value="${build.dir}/classes" />
        <property name="joal.demos.jar"      value="${build.dir}/joal-demos.jar" />
        <property name="joal.demos.ogg.jar"  value="${build.dir}/j-ogg.jar" />
        <property name="joal.demos.src.zip"  value="${build.dir}/joal-demos-src.zip" />
    </target>

    <target name="all" depends="jar" description="Build everything">

	<!-- Build a source archive as well -->
        <delete file="${joal.demos.src.zip}" />
        <zip destfile="${joal.demos.src.zip}"
	     basedir="../.."
	     includes="joal-demos/make/**,joal-demos/src/**"
	     excludes="**/*.class,**/*~"
	     />
    </target>

    <target name="jar" depends="compile" description="Build JOAL demos jar file">
        <jar destfile="${joal.demos.jar}">
            <fileset dir="${classes.dir}" />
            <fileset dir="${src.dir}/java">
               <include name="demos/data/**" />
            </fileset>
        </jar>
    </target>

    <target name="compile" depends="init">
        <mkdir dir="${classes.dir}" />

        <copy file="${src.dir}/java/demos/lib/j-ogg-all.jar"
		tofile="${joal.demos.ogg.jar}"/>

        <path id="joal.classpath">
            <pathelement path="${classpath}" />
            <pathelement location="${joal.jar}" />
            <pathelement location="${joal.demos.ogg.jar}" />
        </path>
        <javac destdir="${classes.dir}" source="1.4" debug="true" debuglevel="source,lines">
            <src path="${src.dir}" />
            <classpath refid="joal.classpath" />
        </javac>
    </target>

    <target name="clean" depends="init">
        <delete includeEmptyDirs="true" quiet="true">
            <fileset dir="../build" />
        </delete>
    </target>

    <target name="lesson1" depends="jar" description="Run lesson1 (Single Static Source)">
        <java classname="demos.devmaster.lesson1.SingleStaticSource" fork="true">
            <classpath>
		<pathelement location="${joal.jar}" />
		<pathelement location="${joal.demos.jar}" />
            </classpath>
        </java>
    </target>

    <target name="lesson2" depends="jar" description="Run lesson2 (Looping and Fade Away)">
        <java classname="demos.devmaster.lesson2.LoopingAndFadeaway" fork="true">
            <classpath>
		<pathelement location="${joal.jar}" />
		<pathelement location="${joal.demos.jar}" />
            </classpath>
        </java>
    </target>

    <target name="lesson3" depends="jar" description="Run lesson3 (Multiple Sources)">
        <java classname="demos.devmaster.lesson3.MultipleSources" fork="true">
            <classpath>
		<pathelement location="${joal.jar}" />
		<pathelement location="${joal.demos.jar}" />
            </classpath>
        </java>
    </target>

    <target name="lesson5" depends="jar" description="Run lesson5 (Sources Sharing Buffers)">
        <java classname="demos.devmaster.lesson5.SourcesSharingBuffers" fork="true">
            <classpath>
		<pathelement location="${joal.jar}" />
		<pathelement location="${joal.demos.jar}" />
            </classpath>
        </java>
    </target>

    <target name="lesson8" depends="jar" description="Run lesson8 (Ogg/Vorbis Streaming)">
        <java classname="demos.devmaster.lesson8.OggStreamer" fork="true">
            <classpath>
		<pathelement location="${joal.jar}" />
		<pathelement location="${joal.demos.jar}" />
		<pathelement location="${joal.demos.ogg.jar}" />
            </classpath>
        </java>
    </target>
 </project>