diff options
author | Sven Gothel <[email protected]> | 2014-05-11 03:03:36 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2014-05-11 03:03:36 +0200 |
commit | 1e53a38eb06aa8ff50660fdf7bd8570b27f27c56 (patch) | |
tree | f061dfb77af5b4c1f27da78b4dbd1881b400abc3 /make/build-test.xml | |
parent | 598da96b3d2ffc3e0915f73749cbafa5fa5cea90 (diff) |
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)
Diffstat (limited to 'make/build-test.xml')
-rw-r--r-- | make/build-test.xml | 21 |
1 files changed, 19 insertions, 2 deletions
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 @@ <echo message=" test.base.dir ${test.base.dir}"/> <echo message=" build_t.gen ${build_t.gen}"/> - <!-- Annotation Processor Only - First --> + <!-- Javac of Annotation Processor dependencies - First --> + <javac destdir="${build_t.java}" + fork="yes" + includeAntRuntime="false" + memoryMaximumSize="${javac.memorymax}" + encoding="UTF-8" + source="${target.sourcelevel}" + target="${target.targetlevel}" + bootclasspath="${target.rt.jar}" + debug="${javacdebug}" debuglevel="${javacdebuglevel}"> + <classpath refid="junit.compile.classpath"/> + <compilerarg value="-proc:none"/> + <src path="${test.base.dir}/com/jogamp/junit/util"/> + </javac> + + <!-- Annotation Processor - Second --> + <mkdir dir="${build_t.gen}/classes/com/jogamp/gluegen/test/junit/structgen"/> <javac destdir="${build_t.java}" fork="yes" includeAntRuntime="false" @@ -129,9 +145,10 @@ <compilerarg value="-J-Djogamp.gluegen.structgen.debug"/> <compilerarg value="-J-Djogamp.gluegen.structgen.output=${build_t.gen}/classes"/> <src path="${test.base.dir}/com/jogamp/gluegen/test/junit/structgen"/> + <src path="${build_t.gen}/classes/com/jogamp/gluegen/test/junit/structgen" /> </javac> - <!-- Javac Only - Second --> + <!-- Javac All - Third --> <javac destdir="${build_t.java}" fork="yes" includeAntRuntime="false" |