summaryrefslogtreecommitdiffstats
path: root/opengl/tools/glgen/gen
diff options
context:
space:
mode:
authorJack Palevich <jackpal@google.com>2009-04-14 19:00:09 -0700
committerJack Palevich <jackpal@google.com>2009-04-14 19:00:09 -0700
commitffac1eff58b59ffdaca1c4a296fa7dead51c487b (patch)
treed57309c60e4e27c906f3b1de1c26e58499fcd194 /opengl/tools/glgen/gen
parent151414fed9007aa911353f609ebabe42abb356c3 (diff)
downloadframeworks_native-ffac1eff58b59ffdaca1c4a296fa7dead51c487b.zip
frameworks_native-ffac1eff58b59ffdaca1c4a296fa7dead51c487b.tar.gz
frameworks_native-ffac1eff58b59ffdaca1c4a296fa7dead51c487b.tar.bz2
Improve glgen
+ gen script is really a bash script rather than a sh script, so declare that to be true. (For example, it uses pushd, which is a part of bash, but not a part of sh. Not sure how this worked until now. Possibly gen was only run in environments where /bin/sh was really bash. + Check the results of the java compile of the code generator, and abort the script if the compile fails. + Turn on the bash shell option that guards against using uninitialized variables in the script. + Remove the generated class files. Refactor JniCodeEmitter into two classes: a general-purpose JniCodeEmitter and a specific Jsr239CodeEmitter. The hope is to use JniCodeEmitter as a base for emitting static OpenGL ES bindings.
Diffstat (limited to 'opengl/tools/glgen/gen')
-rwxr-xr-xopengl/tools/glgen/gen11
1 files changed, 9 insertions, 2 deletions
diff --git a/opengl/tools/glgen/gen b/opengl/tools/glgen/gen
index c060040..25e9a09 100755
--- a/opengl/tools/glgen/gen
+++ b/opengl/tools/glgen/gen
@@ -1,4 +1,5 @@
-#!/bin/sh
+#!/bin/bash
+set -u
rm -rf out generated
mkdir out
@@ -12,12 +13,18 @@ echo "public interface Canvas {}" >> out/android/graphics/Canvas.java
GLFILE=out/javax/microedition/khronos/opengles/GL.java
cp stubs/GLHeader.java-if $GLFILE
-GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JType.java JniCodeEmitter.java ParameterChecker.java"
+GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java"
pushd src > /dev/null
javac ${GLGEN_FILES}
+JAVAC_RESULT=$?
+if [ $JAVAC_RESULT -ne 0 ]; then
+ echo "Could not compile glgen."
+ exit $JAVAC_RESULT
+fi
popd > /dev/null
java -classpath src GenerateGL -c glspec-1.0 glspec-1.0ext glspec-1.1 glspec-1.1ext glspec-1.1extpack glspec-checks
+rm src/*.class
pushd out > /dev/null
mkdir classes