Jogamp
ef3064c00f2803033245fcbb459cfb21c81425c8
[joal-demos.git] / make / build.xml
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!--
3    - Ant build for the JOAL demos. This build has been tested with ANT 1.5.3.
4    -
5    - In order for this build to succeed the resulting jar files from this build
6    - (joal-demos.jar) must not be on the CLASSPATH.
7    -
8    - This build requires that the joal project has been checked out into a sibling
9    - directory to the joal-demos top-level directory and that the joal.jar has been
10    - built into its build directory.
11    -->
12 <project name="JOAL.demos" default="all">
13     <property name="joal-demos_base_version" value="2.0"/>
14     <tstamp>
15        <format property="version.timestamp" pattern="yyyyMMdd"/>
16     </tstamp>
17     <property name="joal-demos.version" value="${joal-demos_base_version}-${version.timestamp}" />
18
19     <property name="project.root"  value=".." />
20
21     <condition property="rootrel.build" value="build">
22       <not>
23           <isset property="rootrel.build"/>
24       </not>
25     </condition>
26     <property name="build" location="${project.root}/${rootrel.build}" />
27
28     <property name="gluegen.root"  value="${project.root}/../gluegen" />
29     <property name="gluegen.build" value="${gluegen.root}/${rootrel.build}" />
30     <!-- Pull in GlueGen cpptasks build file -->
31     <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
32     <import file="${gluegen.root}/make/jogamp-archivetasks.xml" />
33     <import file="${gluegen.root}/make/jogamp-env.xml" />
34
35     <property name="joal.root"     value="${project.root}/../joal" />
36     <property name="joal.build"    value="${joal.root}/${rootrel.build}" />
37
38     <property file="${build}/artifact.properties"/>
39     <property name="joal-demos.build.number" value="manual-build"/>
40     <property name="joal-demos.build.id"     value="${version.timestamp}"/>
41     <property name="joal-demos.build.branch" value="master"/>
42     <property name="joal-demos.build.commit" value="manual"/>
43
44     <!-- 
45        - Make sure that joal-demos.jar is not on the CLASSPATH; this can
46        - cause builds to fail since if this Java process has the jar file
47        - open we can not overwrite it.
48       -->
49     <target name="test.for.joal.demos.jar">
50         <available property="joal.demos.jar.on.class.path" classname="demos.devmaster.lesson1.SingleStaticSource" />
51     </target>
52     <target name="java.class.path.validate" depends="test.for.joal.demos.jar" if="joal.demos.jar.on.class.path">
53         <fail>
54         
55     ******************************************************************
56     ** Your CLASSPATH environment variable appears to be set (some  **
57     ** JOAL demos' classes are currently visible to the build.)     **
58     ** This can cause the build to fail. Please unset your          **
59     ** CLASSPATH variable and restart the build.                    **
60     ******************************************************************
61         </fail>
62     </target>
63
64     <target name="init" depends="jogamp.env.init, gluegen.cpptasks.detect.os, java.class.path.validate, gluegen.cpptasks.detect.os">
65         <property name="gluegen-rt.jar"      value="${gluegen.build}/gluegen-rt.jar" />
66         <property name="joal.jar"            value="${joal.build}/joal.jar" />
67
68         <property name="src.dir"             value="../src" />
69         <property name="classes.dir"         value="${build}/classes" />
70         <property name="joal.demos.jar"      value="${build}/joal-demos.jar" />
71
72         <property name="archive.name"        value="joal-demos-${joal-demos.version}-${os.and.arch}" />
73         <property name="archive"             value="${build}/${archive.name}" />
74
75         <property name="obj.all.paths"        value="${gluegen.build}/obj${path.separator}${joal.build}/obj" />
76     </target>
77
78     <target name="all" depends="jar, tag.build, developer-zip-archive"/>
79
80     <!-- Build binary zip archives for developers -->
81     <target name="developer-zip-archive" depends="init" if="build.archiveon">
82         <!-- Clean up and create temporary directory -->
83         <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
84         <mkdir dir="${archive}" />
85         <copy file="${build}/artifact.properties" todir="${archive}"/>
86         <mkdir dir="${archive}/jar" />
87         <copy todir="${archive}/jar">
88             <fileset dir="${build}" includes="*.jar"/>
89         </copy>
90         <mkdir dir="${archive}/jnlp-files" />
91         <copy todir="${archive}/jnlp-files">
92             <fileset dir="${project.root}/jnlp-files" includes="*" />
93         </copy>
94         <mkdir dir="${archive}/www" />
95         <copy todir="${archive}/www">
96             <fileset dir="${project.root}/www" includes="*" />
97         </copy>
98         <archive.7z destfile="${build}/${archive.name}.7z"
99              basedir="${build}"
100              includes="${archive.name}/**" />
101         <!-- Clean up after ourselves -->
102         <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
103     </target>
104
105     <target name="tag.build">
106         <copy file="${gluegen.build}/artifact.properties" todir="${build}" overwrite="true"/>
107         <echo message='joal-demos.build.number=${joal-demos.build.number}${line.separator}' file="${build}/artifact.properties" append="true"/>
108         <echo message='joal-demos.build.id=${joal-demos.build.id}${line.separator}'         file="${build}/artifact.properties" append="true"/>
109         <echo message='joal-demos.build.branch=${joal-demos.build.branch}${line.separator}' file="${build}/artifact.properties" append="true"/>
110         <echo message='joal-demos.build.commit=${joal-demos.build.commit}${line.separator}' file="${build}/artifact.properties" append="true"/>
111     </target>
112
113     <target name="jar" depends="compile" description="Build JOAL demos jar file">
114         <jar destfile="${joal.demos.jar}">
115             <fileset dir="${classes.dir}" />
116             <fileset dir="${src.dir}/java">
117                <include name="demos/data/**" />
118             </fileset>
119         </jar>
120     </target>
121
122     <target name="compile" depends="init">
123         <mkdir dir="${classes.dir}" />
124
125         <copy todir="${build}">
126             <fileset dir="${src.dir}/java/demos/lib" includes="j-ogg-*.jar" />
127         </copy>
128
129         <path id="joal.classpath">
130             <pathelement path="${classpath}" />
131             <pathelement location="${joal.jar}" />
132             <pathelement location="${build}/j-ogg-oggd.jar" />
133             <pathelement location="${build}/j-ogg-vorbisd.jar" />
134         </path>
135         <javac destdir="${classes.dir}" 
136                includeantruntime="false"
137                memoryMaximumSize="${javac.memorymax}"
138                encoding="UTF-8"
139                source="${target.sourcelevel}" 
140                target="${target.targetlevel}" 
141                bootclasspath="${target.rt.jar}"
142                debug="${javacdebug}" debuglevel="${javacdebuglevel}">
143             <src path="${src.dir}" />
144             <classpath refid="joal.classpath" />
145         </javac>
146     </target>
147
148     <target name="clean" depends="init">
149         <delete includeEmptyDirs="true" quiet="true">
150             <fileset dir="../${rootrel.build}" />
151         </delete>
152     </target>
153
154     <target name="lesson1" depends="jar" description="Run lesson1 (Single Static Source)">
155         <java classname="demos.devmaster.lesson1.SingleStaticSource" fork="true">
156             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
157             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
158             <classpath>
159                 <pathelement location="${gluegen-rt.jar}" />
160                 <pathelement location="${joal.jar}" />
161                 <pathelement location="${joal.demos.jar}" />
162             </classpath>
163         </java>
164     </target>
165
166     <target name="lesson2" depends="jar" description="Run lesson2 (Looping and Fade Away)">
167         <java classname="demos.devmaster.lesson2.LoopingAndFadeaway" fork="true">
168             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
169             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
170             <classpath>
171                 <pathelement location="${gluegen-rt.jar}" />
172                 <pathelement location="${joal.jar}" />
173                 <pathelement location="${joal.demos.jar}" />
174             </classpath>
175         </java>
176     </target>
177
178     <target name="lesson3" depends="jar" description="Run lesson3 (Multiple Sources)">
179         <java classname="demos.devmaster.lesson3.MultipleSources" fork="true">
180             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
181             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
182             <classpath>
183                 <pathelement location="${gluegen-rt.jar}" />
184                 <pathelement location="${joal.jar}" />
185                 <pathelement location="${joal.demos.jar}" />
186             </classpath>
187         </java>
188     </target>
189
190     <target name="lesson5" depends="jar" description="Run lesson5 (Sources Sharing Buffers)">
191         <java classname="demos.devmaster.lesson5.SourcesSharingBuffers" fork="true">
192             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
193             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
194             <classpath>
195                 <pathelement location="${gluegen-rt.jar}" />
196                 <pathelement location="${joal.jar}" />
197                 <pathelement location="${joal.demos.jar}" />
198             </classpath>
199         </java>
200     </target>
201
202     <target name="lesson8" depends="jar" description="Run lesson8 (Ogg/Vorbis Streaming)">
203         <java classname="demos.devmaster.lesson8.OggStreamer" fork="true">
204             <env key="${system.env.library.path}" path="${obj.all.paths}"/>
205             <jvmarg value="-Djava.library.path=${obj.all.paths}"/>
206             <classpath>
207                 <pathelement location="${gluegen-rt.jar}" />
208                 <pathelement location="${joal.jar}" />
209                 <pathelement location="${joal.demos.jar}" />
210                 <pathelement location="${build}/j-ogg-oggd.jar" />
211                 <pathelement location="${build}/j-ogg-vorbisd.jar" />
212             </classpath>
213         </java>
214     </target>
215  </project>
216
http://JogAmp.org git info: FAQ, tutorial and man pages.