# HG changeset patch # Parent 9b541a74af74e286e963e45467c41c1b7a0f8f4d Fix build script to create dalvik comparible runtime. Comment out SharedSecret. Comment out use of closed source PlatformLogger. diff -r 9b541a74af74 buildSrc/android.gradle --- a/buildSrc/android.gradle Fri Nov 08 07:19:50 2013 +0100 +++ b/buildSrc/android.gradle Mon Nov 11 16:17:24 2013 +0100 @@ -183,6 +183,43 @@ logger.quiet("Android Compiler: $compiler") logger.quiet("Android Linker: $linker") +//exclude from build +project(":swing") { + apply plugin: 'java' + + compileJava { + enabled = false + } +} + +project(":fxml") { + apply plugin: 'java' + + compileJava { + enabled = false + } +} + +project(":base") { + afterEvaluate { + compileJava { + options.bootClasspath = "$sdk/platforms/$sdk_target/android.jar" + } + + jfxrtAndroid { + eachFile { + if (it.name.endsWith('.class')) { + RandomAccessFile raf = new RandomAccessFile(it.file.path, "rw"); + raf.seek(7); + raf.writeByte(0x32); //make it jdk6 + raf.close(); + } + } + } + } +} + + project(":graphics") { task compileDalvikLibs(type: JavaCompile, group: "Build") { @@ -216,7 +253,7 @@ if (compileNativeText) { tasks["native"].dependsOn("nativeFontNativeFreetype") } - + sdkAndroid { dependsOn(jarDalvikLibs) doLast { @@ -245,6 +282,11 @@ project(":controls") { afterEvaluate { + sourceSets.main.java { + exclude 'javafx/scene/control/Date*.java' + exclude 'com/sun/javafx/scene/control/skin/Date*.java' + exclude 'com/sun/javafx/scene/control/behavior/Date*.java' + } task compileControlsJavaAndroid(type: JavaCompile, group: "Build", dependsOn: [":graphics:compileJava", ":controls:compileJava"]) { description = "Task compiles controls for Android" classpath = files("modules/base/build/classes/main", @@ -275,7 +317,7 @@ compileJava { enabled = false } - + afterEvaluate { if (!BUILD_CLOSED) { logger.warn("OpenJFX build. Skipping webkit build on Android.") @@ -312,7 +354,7 @@ javahAndroidDvkwebview.dependsOn(compileWebJavaAndroid) jfxrtAndroid { - from "modules/web/build/classes/android" + from "modules/web/build/classes/android" } sdkAndroid { @@ -335,6 +377,17 @@ } +allprojects { + afterEvaluate { + sdkAndroid { + doLast { + ant.jar(update: "true", destfile: "build/android-sdk/rt/lib/ext/jfxrt.jar", + basedir: "build/android-sdk/rt/lib", includes: "*.properties") + } + } + } +} + ANDROID.jfxrtJarExcludes = [ "**/*.hlsl", "com/sun/glass/ui/win", diff -r 9b541a74af74 modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassScene.java --- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassScene.java Fri Nov 08 07:19:50 2013 +0100 +++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassScene.java Mon Nov 11 16:17:24 2013 +0100 @@ -49,12 +49,12 @@ import com.sun.prism.paint.Color; import com.sun.prism.paint.Paint; import sun.misc.JavaSecurityAccess; -import sun.misc.SharedSecrets; +//import sun.misc.SharedSecrets; public abstract class GlassScene implements TKScene { - private static final JavaSecurityAccess javaSecurityAccess = - SharedSecrets.getJavaSecurityAccess(); + private static final JavaSecurityAccess javaSecurityAccess = null; + //SharedSecrets.getJavaSecurityAccess(); private GlassStage stage; @@ -107,16 +107,16 @@ if (accessCtrlCtx != null) { throw new RuntimeException("Scene security context has been already set!"); } - AccessControlContext acc = AccessController.getContext(); + //AccessControlContext acc = AccessController.getContext(); // JDK doesn't provide public APIs to get ACC intersection, // so using this ugly workaround - accessCtrlCtx = javaSecurityAccess.doIntersectionPrivilege( - new PrivilegedAction() { - @Override - public AccessControlContext run() { - return AccessController.getContext(); - } - }, acc, ctx); + accessCtrlCtx = AccessController.getContext();//javaSecurityAccess.doIntersectionPrivilege( +// new PrivilegedAction() { +// @Override +// public AccessControlContext run() { +// return AccessController.getContext(); +// } +// }, acc, ctx); } public void waitForRenderingToComplete() { diff -r 9b541a74af74 modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassStage.java --- a/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassStage.java Fri Nov 08 07:19:50 2013 +0100 +++ b/modules/graphics/src/main/java/com/sun/javafx/tk/quantum/GlassStage.java Mon Nov 11 16:17:24 2013 +0100 @@ -41,12 +41,12 @@ import com.sun.javafx.tk.Toolkit; import sun.misc.JavaSecurityAccess; -import sun.misc.SharedSecrets; +//import sun.misc.SharedSecrets; abstract class GlassStage implements TKStage { - private static final JavaSecurityAccess javaSecurityAccess = - SharedSecrets.getJavaSecurityAccess(); + private static final JavaSecurityAccess javaSecurityAccess = null; + //SharedSecrets.getJavaSecurityAccess(); // A list of all GlassStage objects regardless of visibility. private static final List windows = new ArrayList<>(); @@ -113,16 +113,16 @@ if (accessCtrlCtx != null) { throw new RuntimeException("Stage security context has been already set!"); } - AccessControlContext acc = AccessController.getContext(); + //AccessControlContext acc = AccessController.getContext(); // JDK doesn't provide public APIs to get ACC intersection, // so using this ugly workaround - accessCtrlCtx = javaSecurityAccess.doIntersectionPrivilege( - new PrivilegedAction() { - @Override - public AccessControlContext run() { - return AccessController.getContext(); - } - }, acc, ctx); + accessCtrlCtx = AccessController.getContext();//javaSecurityAccess.doIntersectionPrivilege( +// new PrivilegedAction() { +// @Override +// public AccessControlContext run() { +// return AccessController.getContext(); +// } +// }, acc, ctx); } @Override public void requestFocus() { diff -r 9b541a74af74 modules/graphics/src/main/native-glass/lens/LensLogger.c --- a/modules/graphics/src/main/native-glass/lens/LensLogger.c Fri Nov 08 07:19:50 2013 +0100 +++ b/modules/graphics/src/main/native-glass/lens/LensLogger.c Mon Nov 11 16:17:24 2013 +0100 @@ -66,6 +66,8 @@ const char *lensBacktrace = getenv("LENS_BACKTRACE"); glass_vm = vm; glass_log_level = 0x7fffffff; // Integer.MAX_VALUE, meaning no logging + +#ifndef ANDROID_NDK c_LensLogger = (*env)->FindClass(env, "com/sun/glass/ui/lens/LensLogger"); if (c_LensLogger == NULL) { fprintf(stderr, @@ -202,6 +204,7 @@ } } } // if (lensBacktrace) +#endif } void glass_logf( @@ -275,6 +278,7 @@ // logging level of the message and expect it to do the right thing. // Instead we have seven logging methods and we need to decide which to // call based on the message logging level. +#ifndef ANDROID_NDK if (level >= GLASS_LOG_LEVEL_SEVERE) { m = glass_log_severe; } else if (level >= GLASS_LOG_LEVEL_WARNING) { @@ -291,6 +295,23 @@ m = glass_log_finest; } (*env)->CallVoidMethod(env, glass_logger, m, s); +#else + if (level >= GLASS_LOG_LEVEL_SEVERE) { + GLASS_LOG_SEVERE(buffer); + } else if (level >= GLASS_LOG_LEVEL_WARNING) { + GLASS_LOG_WARNING(buffer); + } else if (level >= GLASS_LOG_LEVEL_INFO) { + GLASS_LOG_INFO(buffer); + } else if (level >= GLASS_LOG_LEVEL_CONFIG) { + GLASS_LOG_CONFIG(buffer); + } else if (level >= GLASS_LOG_LEVEL_FINE) { + GLASS_LOG_FINE(buffer); + } else if (level >= GLASS_LOG_LEVEL_FINER) { + GLASS_LOG_FINER(buffer); + } else { + GLASS_LOG_FINEST(buffer); + } +#endif (*env)->DeleteLocalRef(env, s); if (attachedThread) { // If we attached this thread to the VM in order to make a JNI call