Browse Source

Jdk 11 Build Support

Trevor Flynn 6 years ago
parent
commit
ad2ba95e99

+ 52 - 49
.gitignore

@@ -1,49 +1,52 @@
-**/nbproject/private/
-**/.classpath
-**/.settings
-**/.project
-**/.vscode
-**/out/
-/.gradle/
-/.nb-gradle/
-/.idea/
-/dist/
-/build/
-/bin/
-/netbeans/
-/.classpath
-/.project
-/.settings
-*.dll
-*.so
-*.jnilib
-*.dylib
-*.iml
-.gradletasknamecache
-.DS_Store
-/jme3-core/src/main/resources/com/jme3/system/version.properties
-/jme3-*/build/
-/jme3-*/bin/
-/jme3-bullet-native/bullet3.zip
-/jme3-bullet-native/bullet3-*/
-/jme3-bullet-native/src/native/cpp/com_jme3_bullet_*.h
-/jme3-android-native/openal-soft/
-/jme3-android-native/OpenALSoft.zip
-/jme3-android-native/src/native/jme_decode/STBI/
-/jme3-android-native/src/native/jme_decode/Tremor/
-/jme3-android-native/src/native/jme_decode/com_jme3_audio_plugins_NativeVorbisFile.h
-/jme3-android-native/src/native/jme_decode/com_jme3_texture_plugins_AndroidNativeImageLoader.h
-/jme3-android-native/stb_image.h
-!/jme3-bullet-native/libs/native/windows/x86_64/bulletjme.dll
-!/jme3-bullet-native/libs/native/windows/x86/bulletjme.dll
-!/jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
-!/jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
-!/jme3-bullet-native/libs/native/linux/x86/libbulletjme.so
-!/jme3-bullet-native/libs/native/linux/x86_64/libbulletjme.so
-/jme3-examples/private/
-!/jme3-vr/src/main/resources/**/*.dylib
-!/jme3-vr/src/main/resources/**/*.so
-!/jme3-vr/src/main/resources/**/*.so.dbg
-!/jme3-vr/src/main/resources/**/*.dll
-!/jme3-vr/src/main/resources/**/*.pdb
-/buildMaven.bat
+**/nbproject/private/
+**/.classpath
+**/.settings
+**/.project
+**/.vscode
+**/out/
+/.gradle/
+/.nb-gradle/
+/.idea/
+/dist/
+/build/
+/bin/
+/netbeans/
+/.classpath
+/.project
+/.settings
+*.dll
+*.so
+*.jnilib
+*.dylib
+*.iml
+*.class
+*.jtxt
+.gradletasknamecache
+.DS_Store
+/jme3-core/src/main/resources/com/jme3/system/version.properties
+/jme3-*/build/
+/jme3-*/bin/
+/jme3-bullet-native/bullet3.zip
+/jme3-bullet-native/bullet3-*/
+/jme3-bullet-native/src/native/cpp/com_jme3_bullet_*.h
+/jme3-android-native/openal-soft/
+/jme3-android-native/OpenALSoft.zip
+/jme3-android-native/src/native/jme_decode/STBI/
+/jme3-android-native/src/native/jme_decode/Tremor/
+/jme3-android-native/src/native/jme_decode/com_jme3_audio_plugins_NativeVorbisFile.h
+/jme3-android-native/src/native/jme_decode/com_jme3_texture_plugins_AndroidNativeImageLoader.h
+/jme3-android-native/stb_image.h
+!/jme3-bullet-native/libs/native/windows/x86_64/bulletjme.dll
+!/jme3-bullet-native/libs/native/windows/x86/bulletjme.dll
+!/jme3-bullet-native/libs/native/osx/x86/libbulletjme.dylib
+!/jme3-bullet-native/libs/native/osx/x86_64/libbulletjme.dylib
+!/jme3-bullet-native/libs/native/linux/x86/libbulletjme.so
+!/jme3-bullet-native/libs/native/linux/x86_64/libbulletjme.so
+/jme3-examples/private/
+!/jme3-vr/src/main/resources/**/*.dylib
+!/jme3-vr/src/main/resources/**/*.so
+!/jme3-vr/src/main/resources/**/*.so.dbg
+!/jme3-vr/src/main/resources/**/*.dll
+!/jme3-vr/src/main/resources/**/*.pdb
+/buildMaven.bat
+

+ 1 - 1
.travis.yml

@@ -14,7 +14,7 @@ matrix:
     jdk: oraclejdk8
     env: UPLOAD=true UPLOAD_NATIVE=true
   - os: linux
-    jdk: openjdk7
+    jdk: openjdk11
     dist: precise
   - os: osx
     osx_image: xcode9.3

+ 2 - 2
common.gradle

@@ -8,7 +8,7 @@ apply plugin: 'maven'
 group = 'org.jmonkeyengine'
 version = jmePomVersion
 
-sourceCompatibility = '1.7'
+sourceCompatibility = '1.8'
 [compileJava, compileTestJava]*.options*.encoding = 'UTF-8'
 
 repositories {
@@ -24,7 +24,7 @@ repositories {
 dependencies {
     // Adding dependencies here will add the dependencies to each subproject.
     testCompile group: 'junit', name: 'junit', version: '4.12'
-    testCompile group: 'org.mockito', name: 'mockito-core', version: '2.0.28-beta'
+    testCompile group: 'org.mockito', name: 'mockito-core', version: '1.10.19'
     testCompile group: 'org.easytesting', name: 'fest-assert-core', version: '2.0M10'
 }
 

+ 12 - 6
jme3-android-native/decode.gradle

@@ -44,13 +44,19 @@ task copyTremorFiles(type: Copy) {
     into outputDir
 }
 
-// Generate headers via javah
+// Generate headers via javac -h
 task generateJavahHeaders(type: Exec) {
-    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
-    args '-d', decodeSourceDir
-    args '-classpath', project.projectClassPath
-    args "com.jme3.audio.plugins.NativeVorbisFile"
-    args "com.jme3.texture.plugins.AndroidNativeImageLoader"
+    def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files2 = fileTree("../jme3-core/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files3 = fileTree("../jme3-core/src/plugins/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files4 = fileTree("../jme3-core/src/tools/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files5 = fileTree("../jme3-terrain/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def filesList = "\"" + files0.join("\"\n\"") + "\"\n\"" + files1.join("\"\n\"") + "\"\n\"" + files2.join("\"\n\"") + "\"\n\"" + files3.join("\"\n\"") + "\"\n\"" + files4.join("\"\n\"") + "\"\n\"" + files5.join("\"\n\"") + "\""
+	new File("$projectDir/java_classes.jtxt").text = filesList.replaceAll(java.util.regex.Pattern.quote("\\"), java.util.regex.Matcher.quoteReplacement("/"))
+    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javac')
+    args '-h', decodeSourceDir
+    args "@$projectDir/java_classes.jtxt"
 }
 
 // Copy jME Android native files to jni directory

+ 11 - 6
jme3-android-native/openalsoft.gradle

@@ -73,12 +73,17 @@ task copyJmeOpenALSoft(type: Copy, dependsOn:copyOpenALSoft) {
 }
 
 task generateOpenAlSoftHeaders(type:Exec, dependsOn: copyJmeOpenALSoft) {
-    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
-    args '-d', openalsoftJmeAndroidPath
-    args '-classpath', project.projectClassPath
-    args "com.jme3.audio.android.AndroidAL"
-    args "com.jme3.audio.android.AndroidALC"
-    args "com.jme3.audio.android.AndroidEFX"
+    def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files2 = fileTree("../jme3-core/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files3 = fileTree("../jme3-core/src/plugins/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files4 = fileTree("../jme3-core/src/tools/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files5 = fileTree("../jme3-terrain/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def filesList = "\"" + files0.join("\"\n\"") + "\"\n\"" + files1.join("\"\n\"") + "\"\n\"" + files2.join("\"\n\"") + "\"\n\"" + files3.join("\"\n\"") + "\"\n\"" + files4.join("\"\n\"") + "\"\n\"" + files5.join("\"\n\"") + "\""
+	new File("$projectDir/java_classes.jtxt").text = filesList.replaceAll(java.util.regex.Pattern.quote("\\"), java.util.regex.Matcher.quoteReplacement("/"))
+    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javac')
+    args '-h', openalsoftJmeAndroidPath
+    args "@$projectDir/java_classes.jtxt"
 }
 
 task buildOpenAlSoftNativeLib(type: Exec, dependsOn: generateOpenAlSoftHeaders) {

+ 1 - 1
jme3-bullet-native/build.gradle

@@ -220,7 +220,7 @@ task unzipBulletIfNeeded {
 }
 
 unzipBulletIfNeeded.dependsOn {
-    if (buildNativeProjects == "true" && !file(bulletFolder).isDirectory()) {
+    if (buildNativeProjects == "true") {
         unzipBullet
     }
 }

+ 15 - 44
jme3-bullet/build.gradle

@@ -17,52 +17,23 @@ dependencies {
 }
 
 task generateNativeHeaders(type: Exec, dependsOn: classes) {
-    def classes = " \
-        com.jme3.bullet.PhysicsSpace, \
-        \
-        com.jme3.bullet.collision.PhysicsCollisionEvent, \
-        com.jme3.bullet.collision.PhysicsCollisionObject,\
-        com.jme3.bullet.objects.PhysicsCharacter, \
-        com.jme3.bullet.objects.PhysicsGhostObject, \
-        com.jme3.bullet.objects.PhysicsRigidBody, \
-        com.jme3.bullet.objects.PhysicsVehicle, \
-        com.jme3.bullet.objects.VehicleWheel, \
-        com.jme3.bullet.objects.infos.RigidBodyMotionState, \
-        \
-        com.jme3.bullet.collision.shapes.CollisionShape, \
-        com.jme3.bullet.collision.shapes.BoxCollisionShape, \
-        com.jme3.bullet.collision.shapes.CapsuleCollisionShape, \
-        com.jme3.bullet.collision.shapes.CompoundCollisionShape, \
-        com.jme3.bullet.collision.shapes.ConeCollisionShape, \
-        com.jme3.bullet.collision.shapes.CylinderCollisionShape, \
-        com.jme3.bullet.collision.shapes.GImpactCollisionShape, \
-        com.jme3.bullet.collision.shapes.HeightfieldCollisionShape, \
-        com.jme3.bullet.collision.shapes.HullCollisionShape, \
-        com.jme3.bullet.collision.shapes.MeshCollisionShape, \
-        com.jme3.bullet.collision.shapes.PlaneCollisionShape, \
-        com.jme3.bullet.collision.shapes.SimplexCollisionShape, \
-        com.jme3.bullet.collision.shapes.SphereCollisionShape, \
-        \
-        com.jme3.bullet.joints.PhysicsJoint, \
-        com.jme3.bullet.joints.ConeJoint, \
-        com.jme3.bullet.joints.HingeJoint, \
-        com.jme3.bullet.joints.Point2PointJoint, \
-        com.jme3.bullet.joints.SixDofJoint, \
-        com.jme3.bullet.joints.SixDofSpringJoint, \
-        com.jme3.bullet.joints.SliderJoint, \
-        com.jme3.bullet.joints.motors.RotationalLimitMotor, \
-        com.jme3.bullet.joints.motors.TranslationalLimitMotor, \
-        \
-        com.jme3.bullet.util.NativeMeshUtil, \
-        com.jme3.bullet.util.DebugShapeFactory"
-
+    def files0 = fileTree("src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files1 = fileTree("src/common/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files2 = fileTree("../jme3-core/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files3 = fileTree("../jme3-core/src/plugins/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files4 = fileTree("../jme3-core/src/tools/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
+    def files5 = fileTree("../jme3-terrain/src/main/java/").filter { it.isFile() && it.getName().endsWith(".java") }.files
     def classpath = sourceSets.main.runtimeClasspath.asPath
     def nativeIncludes = new File(project(":jme3-bullet-native").projectDir, "src/native/cpp")
-
-    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javah')
-    args "-d", nativeIncludes
-    args "-classpath", classpath
-    args classes.split(",").collect { it.trim() }
+	def filesList = "\"" + files0.join("\"\n\"") + "\"\n\"" + files1.join("\"\n\"") + "\"\n\"" + files2.join("\"\n\"") + "\"\n\"" + files3.join("\"\n\"") + "\"\n\"" + files4.join("\"\n\"") + "\"\n\"" + files5.join("\"\n\"") + "\""
+	new File("$projectDir/java_classes.jtxt").text = filesList.replaceAll(java.util.regex.Pattern.quote("\\"), java.util.regex.Matcher.quoteReplacement("/"))
+    //project.logger.lifecycle("Files: " + files0.size())
+    //project.logger.lifecycle("Files: " + files1.size())
+    executable org.gradle.internal.jvm.Jvm.current().getExecutable('javac')
+    args "-h", nativeIncludes
+    //args "-classpath", classpath
+    args "@$projectDir/java_classes.jtxt"
+    //args classes.split(",").collect { it.trim() }
 }
 
 assemble.dependsOn(generateNativeHeaders)

+ 11 - 5
jme3-networking/src/main/java/com/jme3/network/service/rmi/MethodInfo.java

@@ -33,9 +33,9 @@
 package com.jme3.network.service.rmi;
 
 import com.jme3.network.serializing.Serializable;
+import java.lang.annotation.Annotation;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
-import javax.jws.Oneway;
 
 
 /**
@@ -102,12 +102,18 @@ public final class MethodInfo {
     }
  
     public static CallType getCallType( Method m ) {
-        if( m.getReturnType() != Void.TYPE )
+        if( m.getReturnType() != Void.TYPE ) {
             return CallType.Synchronous;
-        if( m.getAnnotation(Oneway.class) != null )
-            return CallType.Asynchronous;
-        if( m.getAnnotation(Asynchronous.class) == null )
+        }
+        if( m.getAnnotation(Asynchronous.class) == null ) {
             return CallType.Synchronous;
+        }
+        for (Annotation annotation : m.getAnnotations()) {
+            Class<? extends Annotation> type = annotation.annotationType();
+            if (type.getName().equals("javax.jws.Oneway")) {
+                return CallType.Asynchronous;
+            }
+        }
             
         Asynchronous async = m.getAnnotation(Asynchronous.class);             
         return async.reliable() ? CallType.Asynchronous : CallType.Unreliable;         

+ 2 - 4
jme3-plugins/src/gltf/java/com/jme3/scene/plugins/gltf/GltfLoader.java

@@ -16,8 +16,6 @@ import com.jme3.texture.Texture;
 import com.jme3.texture.Texture2D;
 import com.jme3.util.IntMap;
 import com.jme3.util.mikktspace.MikktspaceTangentGenerator;
-
-import javax.xml.bind.DatatypeConverter;
 import java.io.*;
 import java.nio.Buffer;
 import java.nio.FloatBuffer;
@@ -543,7 +541,7 @@ public class GltfLoader implements AssetLoader {
         if (uri != null) {
             if (uri.startsWith("data:")) {
                 //base 64 embed data
-                data = DatatypeConverter.parseBase64Binary(uri.substring(uri.indexOf(",") + 1));
+                data = Base64.getDecoder().decode(uri.substring(uri.indexOf(",") + 1));
             } else {
                 //external file let's load it
                 if (!uri.endsWith(".bin")) {
@@ -714,7 +712,7 @@ public class GltfLoader implements AssetLoader {
         } else if (uri.startsWith("data:")) {
             //base64 encoded image
             String[] uriInfo = uri.split(",");
-            byte[] data = DatatypeConverter.parseBase64Binary(uriInfo[1]);
+            byte[] data = Base64.getDecoder().decode(uriInfo[1]);
             String headerInfo = uriInfo[0].split(";")[0];
             String extension = headerInfo.split("/")[1];
             TextureKey key = new TextureKey("image" + sourceIndex + "." + extension, flip);