From: <sp...@us...> - 2010-03-16 19:05:26
|
Revision: 3289 http://java-game-lib.svn.sourceforge.net/java-game-lib/?rev=3289&view=rev Author: spasi Date: 2010-03-16 19:05:19 +0000 (Tue, 16 Mar 2010) Log Message: ----------- Added JNIEXPORT to AL alternate methods. Now forcing full regen when any class in the Generator changes. Modified Paths: -------------- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java Property Changed: ---------------- trunk/LWJGL/src/native/common/ trunk/LWJGL/src/native/linux/ trunk/LWJGL/src/native/macosx/ trunk/LWJGL/src/native/windows/ Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorProcessorFactory.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -35,6 +35,8 @@ import com.sun.mirror.apt.*; import com.sun.mirror.declaration.*; +import java.io.File; +import java.io.FileFilter; import java.util.Collection; import java.util.Set; import java.util.Map; @@ -108,10 +110,11 @@ TypeDeclaration lastFile = null; try { + long generatorLM = getGeneratorLastModified(); TypeMap type_map = (TypeMap)(Class.forName(typemap_classname).newInstance()); for (TypeDeclaration typedecl : env.getSpecifiedTypeDeclarations()) { lastFile = typedecl; - typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific), NO_OP)); + typedecl.accept(getDeclarationScanner(new GeneratorVisitor(env, type_map, generate_error_checks, context_specific, generatorLM), NO_OP)); } } catch (Exception e) { if ( lastFile == null ) @@ -120,5 +123,35 @@ throw new RuntimeException("\n-- Failed to process template: " + lastFile.getQualifiedName() + " --", e); } } + + /** + * Gets the time of the latest change on the Generator classes. + * + * @return time of the latest change + */ + private static long getGeneratorLastModified() { + final File pck = new File(System.getProperty("user.dir") + "/bin/org/lwjgl/util/generator"); + if ( !pck.exists() || !pck.isDirectory() ) + return Long.MAX_VALUE; + + final File[] classes = pck.listFiles(new FileFilter() { + public boolean accept(final File pathname) { + return pathname.isFile() && pathname.getName().endsWith(".class"); + } + }); + + if ( classes == null || classes.length == 0 ) + return Long.MAX_VALUE; + + long lastModified = 0; + + for ( File clazz : classes ) { + long lm = clazz.lastModified(); + if ( lastModified < lm ) + lastModified = lm; + } + + return lastModified; + } } -} +} \ No newline at end of file Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/GeneratorVisitor.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -58,12 +58,14 @@ private final TypeMap type_map; private final boolean generate_error_checks; private final boolean context_specific; + private final long generatorLM; - public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific) { + public GeneratorVisitor(AnnotationProcessorEnvironment env, TypeMap type_map, boolean generate_error_checks, boolean context_specific, long generatorLM) { this.env = env; this.type_map = type_map; this.generate_error_checks = generate_error_checks; this.context_specific = context_specific; + this.generatorLM = generatorLM; } private void validateMethods(InterfaceDeclaration d) { @@ -254,7 +256,7 @@ try { // Skip this class if the output exists and the input has not been modified. - if ( output.exists() && input.lastModified() < output.lastModified() ) + if ( output.exists() && Math.max(input.lastModified(), generatorLM) < output.lastModified() ) return; if (d.getMethods().size() > 0 || d.getFields().size() > 0) { Modified: trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 17:58:48 UTC (rev 3288) +++ trunk/LWJGL/src/java/org/lwjgl/util/generator/NativeMethodStubsGenerator.java 2010-03-16 19:05:19 UTC (rev 3289) @@ -87,7 +87,7 @@ } private static void generateMethodStub(AnnotationProcessorEnvironment env, TypeMap type_map, PrintWriter writer, String interface_name, MethodDeclaration method, Mode mode, boolean generate_error_checks, boolean context_specific) { - if ( !context_specific ) + if ( !context_specific && method.getAnnotation(Alternate.class) == null ) writer.print("static "); else writer.print("JNIEXPORT "); Property changes on: trunk/LWJGL/src/native/common ___________________________________________________________________ Modified: svn:ignore - Debug Release org_lwjgl_input_Cursor.h org_lwjgl_input_Keyboard.h org_lwjgl_input_Mouse.h org_lwjgl_openal_AL.h org_lwjgl_openal_ALC.h org_lwjgl_opengl_GLContext.h org_lwjgl_opengl_Pbuffer.h org_lwjgl_Sys.h org_lwjgl_opengl_Display.h org_lwjgl_DefaultSysImplementation.h org_lwjgl_NativeSysImplementation.h + Debug Release org_lwjgl_DefaultSysImplementation.h org_lwjgl_NativeSysImplementation.h org_lwjgl_Sys.h org_lwjgl_input_Cursor.h org_lwjgl_input_Cursor_CursorElement.h org_lwjgl_input_Keyboard.h org_lwjgl_input_Keyboard_KeyEvent.h org_lwjgl_input_Mouse.h org_lwjgl_openal_AL.h org_lwjgl_openal_ALC.h org_lwjgl_opengl_AWTSurfaceLock.h org_lwjgl_opengl_Display.h org_lwjgl_opengl_GLContext.h org_lwjgl_opengl_GLContext_CapabilitiesCacheEntry.h org_lwjgl_opengl_Pbuffer.h Property changes on: trunk/LWJGL/src/native/linux ___________________________________________________________________ Modified: svn:ignore - org_lwjgl_opengl_LinuxDisplay.h + org_lwjgl_LinuxSysImplementation.h org_lwjgl_opengl_LinuxAWTGLCanvasPeerInfo.h org_lwjgl_opengl_LinuxCanvasImplementation.h org_lwjgl_opengl_LinuxContextImplementation.h org_lwjgl_opengl_LinuxDisplay.h org_lwjgl_opengl_LinuxDisplayPeerInfo.h org_lwjgl_opengl_LinuxEvent.h org_lwjgl_opengl_LinuxKeyboard.h org_lwjgl_opengl_LinuxMouse.h org_lwjgl_opengl_LinuxPbufferPeerInfo.h org_lwjgl_opengl_LinuxPeerInfo.h Property changes on: trunk/LWJGL/src/native/macosx ___________________________________________________________________ Modified: svn:ignore - org_lwjgl_opengl_MacOSXDisplay.h + org_lwjgl_MacOSXSysImplementation.h org_lwjgl_opengl_MacOSXCanvasPeerInfo.h org_lwjgl_opengl_MacOSXContextImplementation.h org_lwjgl_opengl_MacOSXDisplay.h org_lwjgl_opengl_MacOSXMouseEventQueue.h org_lwjgl_opengl_MacOSXPbufferPeerInfo.h org_lwjgl_opengl_MacOSXPeerInfo.h Property changes on: trunk/LWJGL/src/native/windows ___________________________________________________________________ Modified: svn:ignore - Debug Release org_lwjgl_opengl_Win32Display.h org_lwjgl_Win32SysImplementation.h org_lwjgl_NativeSysImplementation.h + Debug Release org_lwjgl_NativeSysImplementation.h org_lwjgl_Win32SysImplementation.h org_lwjgl_WindowsSysImplementation.h org_lwjgl_opengl_Win32Display.h org_lwjgl_opengl_WindowsAWTGLCanvasPeerInfo.h org_lwjgl_opengl_WindowsContextImplementation.h org_lwjgl_opengl_WindowsDisplay.h org_lwjgl_opengl_WindowsDisplayPeerInfo.h org_lwjgl_opengl_WindowsDisplay_Rect.h org_lwjgl_opengl_WindowsKeyboard.h org_lwjgl_opengl_WindowsPbufferPeerInfo.h org_lwjgl_opengl_WindowsPeerInfo.h org_lwjgl_opengl_WindowsRegistry.h This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |