summaryrefslogtreecommitdiffstats
path: root/make/build.xml
blob: d62281963d9ea86cc24b88bfd67425c1c1e28497 (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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
<?xml version="1.0" encoding="UTF-8"?>
<!--
   - Ant build for the JOGL 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
   - (jogl-demos.jar, jogl-demos-data.jar, jogl-demos-util.jar) must not be on
   - the CLASSPATH.
   -
   - This build requires that the jogl project has been checked out into a sibling
   - directory to the jogl-demos top-level directory and that the jogl.jar has been
   - built into its build directory.
   -->
<project name="JOGL.demos" default="all">

    <!-- This is the version of jogl-demos you are building -->
    <property name="jogl-demos_base_version" value="2.0"/>
    <tstamp>
       <format property="version.timestamp" pattern="yyyyMMdd"/>
    </tstamp>
    <property name="jogl-demos.version" value="${jogl-demos_base_version}-${version.timestamp}" />

    <property name="project.root"  value=".." />

    <condition property="rootrel.build" value="build">
      <not>
          <isset property="rootrel.build"/>
      </not>
    </condition>
    <property name="build" location="${project.root}/${rootrel.build}" />

    <property name="gluegen.root"  value="${project.root}/../gluegen" />
    <property name="gluegen.build" value="${gluegen.root}/${rootrel.build}" />
    <!-- Pull in GlueGen cpptasks build file -->
    <import file="${gluegen.root}/make/gluegen-cpptasks.xml" />
    <import file="${gluegen.root}/make/jogamp-archivetasks.xml" />
    <import file="${gluegen.root}/make/jogamp-env.xml" />

    <property name="jogl.root"     value="${project.root}/../jogl" />
    <property name="jogl.build"    value="${jogl.root}/${rootrel.build}" />

    <property name="joal.root"     value="${project.root}/../joal" />
    <property name="joal.build"    value="${joal.root}/${rootrel.build}" />

    <property name="jogl-demos.build.number" value="manual-build"/>
    <property name="jogl-demos.build.id"     value="${version.timestamp}"/>
    <property name="jogl-demos.build.branch" value="master"/>
    <property name="jogl-demos.build.commit" value="manual"/>

    <!-- 
       - Make sure that jogl-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.jogl.demos.jar">
        <available property="jogl.demos.jar.on.class.path" classname="demos.gears.Gears" />
    </target>
    <target name="java.class.path.validate" depends="test.for.jogl.demos.jar" if="jogl.demos.jar.on.class.path">
        <fail>
        
    ******************************************************************
    ** Your CLASSPATH environment variable appears to be set (some  **
    ** JOGL 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="setup.gles">
        <condition property="isGLES">
          <or>
            <isset property="jogl.es" />
          </or>
        </condition>
    </target>

    <target name="setup.cg.excludes" unless="jogl.cg">
        <property name="jogl.cg.excludes" value="demos/cg/**,demos/hdr/CgPipeline.java,demos/hdr/shaders/cg/**" />
    </target>

    <target name="skip.cg.excludes" if="jogl.cg">
        <property name="jogl.cg.excludes" value="" />
    </target>

    <target name="init.swt">
        <condition property="jogl.swt.excludes"
                   value="demos/swt/**">
            <not>
                <isset property="user.swt.jar" />
            </not>
        </condition>

        <property name="swt.jar"            value="${user.swt.jar}"/>
    </target>

    <target name="init" depends="jogamp.env.init,gluegen.cpptasks.detect.os,java.class.path.validate,setup.gles,setup.cg.excludes,skip.cg.excludes,init.swt">
        <property name="gluegen-rt.jar"      value="${gluegen.build}/gluegen-rt.jar" />
        <property name="jogl.all.jar"        value="${jogl.build}/jar/jogl.all.jar" />
        <property name="joal.jar"            value="${joal.build}/joal.jar" />
        <property name="simple-xml.jar"      value="${project.root}/lib/simple-xml-1.1.1.jar" />
        <property name="classes"             value="${build}/classes" />
        <property name="src"                 value="${project.root}/src" />
        <property name="javadoc"             value="${project.root}/javadoc" />
        <!-- property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" /-->
        <property name="javadoc.link" value="http://download.oracle.com/javase/1.5.0/docs/api/" />
        <property name="javadoc.link.jogl"   value="${jogl.root}/javadoc-public/" />
        <property name="jogl.demos.jar"      value="${build}/jogl-demos.jar" />
        <property name="jogl.demos.util.jar" value="${build}/jogl-demos-util.jar" />
        <property name="jogl.demos.data.jar" value="${build}/jogl-demos-data.jar" />
        <property name="archive.name"        value="jogl-demos-${jogl-demos.version}-${os.and.arch}" />
        <property name="archive"             value="${build}/${archive.name}" />

        <property name="jogl.redbook.excludes" value="redbook/**" />

    </target>

    <target name="nurbs" if="jogl.nurbs">
        <!-- NOTE: this target requires a 1.5 javac to be on the PATH -->
        <javac destdir="${classes}" includes="demos/nurbs/**" source="1.5" debug="true" debuglevel="source,lines"
               includeantruntime="false">
            <src path="${src}" />
            <classpath refid="jogl-demos.classpath" />
        </javac>
	<!-- Copy icons to output dir -->
        <copy todir="${build}">
            <fileset dir="${src}">
                <include name="demos/nurbs/icons/*.png" />
            </fileset>
        </copy>
	<!-- Copy dependent libraries to output dir -->
        <copy file="../lib/simple-xml-1.1.1.jar" todir="${build}" />
        <copy file="../lib/stax-api-1.0.1.jar" todir="${build}" />
        <copy file="../lib/stax-1.2.0.jar" todir="${build}" />
    </target>

    <target name="redbook-javac">
        <javac destdir="${classes}" source="1.5" target="1.5" debug="true" debuglevel="source,lines"
               includeantruntime="false">
            <src path="${src}/redbook/src" />
            <classpath refid="jogl-demos.classpath" />
        </javac>
    </target>

    <target name="all-desktop" unless="isGLES">
        <mkdir dir="${classes}" />
        <path id="jogl-demos.classpath">
            <pathelement location="${jogl.all.jar}" />
            <pathelement location="${joal.jar}" />
            <pathelement location="${gluegen-rt.jar}" />
            <pathelement location="${simple-xml.jar}" />
            <pathelement location="${swt.jar}" />
        </path>
        <javac destdir="${classes}" excludes="${jogl.cg.excludes},demos/nurbs/**,${jogl.swt.excludes},jbullet/**,${jogl.redbook.excludes}" source="1.5" debug="true" debuglevel="source,lines"
            includeantruntime="false">
            <src path="${src}" />
            <classpath refid="jogl-demos.classpath" />
        </javac>
        <antcall target="redbook-javac" inheritrefs="true" />
        <antcall target="nurbs" inheritrefs="true" />
        <jar destfile="${jogl.demos.jar}">
            <fileset dir="${classes}">
                <exclude name="gleem/**" />
                <exclude name="demos/util/**" />
            </fileset>
            <fileset dir="${src}">
                <include name="demos/cg/**/*.cg" />
            </fileset>
            <fileset dir="${src}">
                <include name="demos/hdr/shaders/**/*.cg" />
                <include name="demos/hdr/shaders/**/*.arbvp1" />
                <include name="demos/hdr/shaders/**/*.arbfp1" />
                <include name="demos/es1/bump/*.brs" />
                <include name="demos/es2/shader/**" />
                <include name="demos/es2/perftst/shader/**" />
                <include name="demos/es2/perftst/data/**" />
                <include name="demos/es2/openmax/shader/**" />
            </fileset>
            <!-- Avoid requiring dependence on huge jogl-demos-data.jar for
                 particle engine demo -->
            <fileset dir="${src}">
                <include name="demos/particles/engine/images/*.jpg" />
            </fileset>
        </jar>
        <jar destfile="${jogl.demos.util.jar}">
            <fileset dir="${classes}">
                <include name="gleem/**" />
                <include name="demos/util/**" />
            </fileset>
        </jar>
        <jar destfile="${jogl.demos.data.jar}">
            <fileset dir="${src}">
                <include name="demos/data/**" />
            </fileset>
        </jar>
    </target>

    <target name="all-gles" if="isGLES">
        <echo message="classes destdir ${classes}" />
        <mkdir dir="${classes}" />
        <path id="jogl-demos.classpath">
            <pathelement location="${jogl.all.jar}" />
            <pathelement location="${gluegen-rt.jar}" />
        </path>
        <javac destdir="${classes}" includes="demos/GLInfo*,demos/es1/**,demos/es2/**" source="1.5" debug="true" debuglevel="source,lines"
               includeantruntime="false">
               bootclasspath="${gluegen.root}/make/lib/cdc_fp.jar">
            <src path="${src}" />
            <classpath refid="jogl-demos.classpath" />
        </javac>
        <jar destfile="${jogl.demos.jar}">
            <fileset dir="${classes}">
                <include name="**" />
            </fileset>
            <fileset dir="${src}">
                <include name="demos/es1/bump/*.brs" />
                <include name="demos/es2/shader/**" />
                <include name="demos/es2/perftst/shader/**" />
                <include name="demos/es2/perftst/data/**" />
                <include name="demos/es2/openmax/shader/**" />
            </fileset>
        </jar>
    </target>

    <target name="all" depends="init, all-desktop, all-gles, tag.build, developer-zip-archive" />

    <target name="all.ide" depends="init, all-desktop, all-gles" />

    <target name="tag.build">
        <copy file="${jogl.build}/artifact.properties" todir="${build}" overwrite="true"/>
        <echo message='jogl-demos.build.number=${jogl-demos.build.number}${line.separator}' file="${build}/artifact.properties" append="true"/>
        <echo message='jogl-demos.build.id=${jogl-demos.build.id}${line.separator}'         file="${build}/artifact.properties" append="true"/>
        <echo message='jogl-demos.build.branch=${jogl-demos.build.branch}${line.separator}' file="${build}/artifact.properties" append="true"/>
        <echo message='jogl-demos.build.commit=${jogl-demos.build.commit}${line.separator}' file="${build}/artifact.properties" append="true"/>
    </target>

    <target name="javadoc" depends="init">
        <mkdir dir="${javadoc}" />
        <javadoc destdir="${javadoc}" windowtitle="JOGL Demos"
                 source="1.5">
            <packageset dir="${src}">
                <exclude name="demos/cg/**" />
            </packageset>
            <link href="${javadoc.link}" />
            <!-- FIXME: this doesn't work -->
            <link href="${javadoc.link.jogl}" />
        </javadoc>
    </target>    

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

    <!-- ================================================================== -->
    <!--
       - Build the binary zip archive for developers.
       - This must be called on one target.
      -->

    <target name="developer-zip-archive" depends="init" if="build.archiveon">
        <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
        <mkdir dir="${archive}" />
        <copy file="${build}/artifact.properties" todir="${archive}"/>
        <mkdir dir="${archive}/jar" />
        <copy todir="${archive}/jar">
            <fileset dir="${build}" includes="jogl-demos*.jar"/>
        </copy>
        <mkdir dir="${archive}/jnlp-files" />
        <copy todir="${archive}/jnlp-files">
            <fileset dir="${project.root}/jnlp-files" includes="*" />
        </copy>
        <mkdir dir="${archive}/www" />
        <copy todir="${archive}/www">
            <fileset dir="${project.root}/www" includes="*" />
        </copy>
        <archive.7z destfile="${build}/${archive.name}.7z"
             basedir="${build}"
             includes="${archive.name}/**" />
        <!-- Clean up after ourselves -->
        <delete includeEmptyDirs="true" quiet="true" dir="${archive}" failonerror="false" />
    </target>

 </project>