From 1e53a38eb06aa8ff50660fdf7bd8570b27f27c56 Mon Sep 17 00:00:00 2001 From: Sven Gothel Date: Sun, 11 May 2014 03:03:36 +0200 Subject: Bug 923: Remove dependency of CStruct annotation processor _generation_ and generated_class_user due to Java8 issues. Java8's annotation processor as embedded within javac does not allow referencing not-yet existing generated classes in a class source code which will produce these generated classes via the annotation process. Example: +++ import com.jogamp.gluegen.structgen.CStruct; public class Lala { @CStruct(name="RenderingConfig", header="TestStruct01.h") public RenderingConfig config; } +++ Above example illustrates that the type 'RenderingConfig' does not exist at time of processing the annotation. The type will be created via the annotation process itself. Even though we pass '-proc:only', i.e. skip java compilation, Java8's annotation processing via javac fails in such case. We see this as a bug within javac's annotation processing itself! +++ This workaround splits the annotation process and using the class as generated by the former. To allow this to work, CStruct receives a new field 'jname' allowing to enforce the java-name of the structure using a dummy field type like boolean. @CStruct(name="RenderingConfig", jname="RenderingConfig", header="TestStruct01.h") public boolean dummy; Further more CStruct can be annotated on the package, i.e. 'package-info.java', avoiding the dependency problem altogether. To support multiple header files and types, 'CStructs' has been introduced using an array of 'CStruct'. @CStructs({@CStruct(name="RenderingConfig", header="TestStruct01.h"), @CStruct(name="Pixel", header="TestStruct02.h")}) package com.jogamp.gluegen.test.junit.structgen; Tests: - Build w/ Java7 and Java8 - Validated 'major version 50' (Java 6) class files (OK) --- make/build-test.xml | 21 +++++++++++++++++++-- make/scripts/check-java-major-version.sh | 7 ++++--- make/scripts/make.gluegen.all.linux-x86_64.sh | 2 +- make/scripts/runtest.sh | 3 ++- make/scripts/setenv-build-jogl-x86_64.sh | 16 +++++++++++++--- 5 files changed, 39 insertions(+), 10 deletions(-) (limited to 'make') diff --git a/make/build-test.xml b/make/build-test.xml index bccc534..2bf2e37 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -114,7 +114,23 @@ - + + + + + + + + + + - + &1 | tee make.gluegen.all.linux-x86_64.log diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh index 947755f..f518668 100755 --- a/make/scripts/runtest.sh +++ b/make/scripts/runtest.sh @@ -119,7 +119,8 @@ function onetest() { #onetest com.jogamp.common.os.TestElfReader01 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.PCPPTest 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.generation.Test1p1JavaEmitter 2>&1 | tee -a $LOG -onetest com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter 2>&1 | tee -a $LOG +#onetest com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.generation.Test1p2LoadJNIAndImplLib 2>&1 | tee -a $LOG #onetest com.jogamp.gluegen.test.junit.structgen.TestStructGen01 2>&1 | tee -a $LOG +onetest com.jogamp.gluegen.test.junit.structgen.TestStructGen02 2>&1 | tee -a $LOG diff --git a/make/scripts/setenv-build-jogl-x86_64.sh b/make/scripts/setenv-build-jogl-x86_64.sh index c0746e9..8994365 100644 --- a/make/scripts/setenv-build-jogl-x86_64.sh +++ b/make/scripts/setenv-build-jogl-x86_64.sh @@ -26,14 +26,24 @@ if [ -z "$ANT_PATH" ] ; then exit fi -if [ -e /opt-linux-x86_64/jre7 -a -e /opt-linux-x86_64/j2se7 ] ; then - J2RE_HOME=/opt-linux-x86_64/jre7 - JAVA_HOME=/opt-linux-x86_64/j2se7 +if [ -e /opt-linux-x86_64/jre8 -a -e /opt-linux-x86_64/j2se8 ] ; then + J2RE_HOME=/opt-linux-x86_64/jre8 + JAVA_HOME=/opt-linux-x86_64/j2se8 PATH=$J2RE_HOME/bin:$JAVA_HOME/bin:$PATH export J2RE_HOME JAVA_HOME FOUND_JAVA=1 fi +if [ -z "$FOUND_JAVA" ] ; then + if [ -e /opt-linux-x86_64/jre7 -a -e /opt-linux-x86_64/j2se7 ] ; then + J2RE_HOME=/opt-linux-x86_64/jre7 + JAVA_HOME=/opt-linux-x86_64/j2se7 + PATH=$J2RE_HOME/bin:$JAVA_HOME/bin:$PATH + export J2RE_HOME JAVA_HOME + FOUND_JAVA=1 + fi +fi + if [ -z "$FOUND_JAVA" ] ; then if [ -e /opt-linux-x86_64/jre6 -a -e /opt-linux-x86_64/j2se6 ] ; then J2RE_HOME=/opt-linux-x86_64/jre6 -- cgit v1.2.3