summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2011-07-24 11:37:45 +0200
committerSven Gothel <[email protected]>2011-07-24 11:37:45 +0200
commit869c49c22573147c94b1e6d931c2cff696a54a47 (patch)
tree882779724e74c324de714bbc6f8c2f88e5492862
parent9f45b6f09cbce6c7889e099939656356befa585d (diff)
Android integration / cross-test ; Enhance Platform
- android minor build fix - started dex'ing (gluegen-rt.apk, more to come for full junit tests) - android remote dalvikvm launch works (crosstest-java-android-armv7-rel.sh) - android detection, incl version (reflection) - Platform: - Add JAVA_VM_NAME and JAVA_VM_RUNIME - OSType maybe ANDROID, where the OS name (String) is Linux ! (ok ?)
-rw-r--r--make/build-test.xml59
-rw-r--r--make/build.xml27
-rwxr-xr-xmake/gluegen-cpptasks-base.xml6
-rw-r--r--make/lib/gluegen-cpptasks-android-armv7.xml6
-rw-r--r--make/scripts/crosstest-java-android-armv7-rel.sh46
-rw-r--r--make/scripts/crosstest-java-linux-armv7-rel.sh2
-rw-r--r--make/scripts/crosstest-junit-linux-armv7-rel.sh2
-rwxr-xr-xmake/scripts/make.gluegen.all.android-armv7-cross.sh18
-rw-r--r--src/java/com/jogamp/common/os/AndroidVersion.java97
-rw-r--r--src/java/com/jogamp/common/os/Platform.java37
-rw-r--r--src/java/com/jogamp/common/util/VersionUtil.java14
-rw-r--r--src/java/jogamp/common/os/MachineDescriptionRuntime.java12
-rw-r--r--src/native/common/MachineDescriptionRuntime.c9
13 files changed, 316 insertions, 19 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index ef228c6..e321f23 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -283,6 +283,65 @@
<exec dir="." executable="scp" logError="true" failonerror="true" failifexecutionfails="true">
<arg line="-pr ${env.TARGET_UID}@${env.TARGET_IP}:${env.TARGET_ROOT}/gluegen/make/${results}/* ${results}/"/>
</exec>
+ </target>
+
+ <target name="junit.run.remote.adb" if="isAndroidARMv7">
+ <exec dir="." executable="ssh" logError="true" failonerror="true" failifexecutionfails="true">
+ <arg line="${env.TARGET_UID}@${env.TARGET_IP}"/>
+ <arg line="rsync -aAv --delete --delete-after --exclude 'build-x86*/'"/>
+ <arg line="${env.HOST_UID}@${env.HOST_IP}::${env.HOST_RSYNC_ROOT}/gluegen ${env.TARGET_ROOT}"/>
+ </exec>
+ <for param="test.class.path.m" keepgoing="true">
+ <!-- results in absolute path -->
+ <fileset dir="${build_t.java}">
+ <include name="${test.junit.rel}/**/*Test*"/>
+ <exclude name="**/*$$*"/>
+ </fileset>
+ <sequential>
+ <var name="test.class.path" unset="true"/>
+ <property name="test.class.path" basedir="${build_t.java}" relative="true" location="@{test.class.path.m}"/>
+ <var name="test.class.fqn" unset="true"/>
+ <pathconvert property="test.class.fqn">
+ <fileset file="${build_t.java}${file.separator}${test.class.path}"/>
+ <chainedmapper>
+ <globmapper from="${build_t.java.path}${file.separator}*" to="*"/> <!-- rel. -->
+ <packagemapper from="*.class" to="*"/> <!-- FQCN -->
+ </chainedmapper>
+ </pathconvert>
+ <var name="test.class.result.file" value="${results}/TEST-${test.class.fqn}.xml"/>
+ <echo message="Testing ${test.class.fqn} -- ${test.class.result.file}"/>
+ <apply dir="." executable="/usr/bin/ssh"
+ parallel="false"
+ timeout="${batchtest.timeout}"
+ vmlauncher="false"
+ relative="true"
+ failonerror="false">
+ <arg line="${env.TARGET_UID}@${env.TARGET_IP}"/>
+ <arg value="cd ${env.TARGET_ROOT}/gluegen/make ; "/>
+ <arg value="${system.env.library.path}=${gluegen.lib}${path.separator}${build_t.lib} java"/>
+ <arg value="-Djava.library.path=${gluegen.lib}${path.separator}${build_t.lib}"/>
+ <arg value="-cp ${junit.run.remote.jars}"/>
+ <arg line="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner"/>
+ <srcfile/>
+ <arg line="filtertrace=true"/>
+ <arg line="haltOnError=false"/>
+ <arg line="haltOnFailure=false"/>
+ <arg line="showoutput=true"/>
+ <arg line="outputtoformatters=true"/>
+ <arg line="logfailedtests=true"/>
+ <arg line="logtestlistenerevents=true"/>
+ <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.PlainJUnitResultFormatter"/>
+ <arg line="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${test.class.result.file}"/>
+ <mappedresources>
+ <fileset dir="${build_t.java}" includes="${test.class.path}"/>
+ <packagemapper from="*.class" to="*"/>
+ </mappedresources>
+ </apply>
+ </sequential>
+ </for>
+ <exec dir="." executable="scp" logError="true" failonerror="true" failifexecutionfails="true">
+ <arg line="-pr ${env.TARGET_UID}@${env.TARGET_IP}:${env.TARGET_ROOT}/gluegen/make/${results}/* ${results}/"/>
+ </exec>
</target>
diff --git a/make/build.xml b/make/build.xml
index 28767b5..4a7341f 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -680,12 +680,35 @@
<replacestring from="GLUEGEN_CODEBASE_TAG" to="${gluegen.jnlp.codebase}"/>
</filterchain>
</copy>
-
+ </target>
+
+ <target name="android.package.p1" depends="gluegen.cpptasks.detect.os,gluegen.build.check.java" if="isAndroid">
+ <delete dir="${build}/gluegen-rt.d" includeEmptyDirs="true" quiet="true" failonerror="false" />
+ <delete file="${build}/gluegen-rt.apk" includeEmptyDirs="true" quiet="true" failonerror="false" />
+ <mkdir dir="${build}/gluegen-rt.d" />
+ <exec dir="${build}/gluegen-rt.d" executable="unzip" logError="true" failonerror="true" failifexecutionfails="true">
+ <arg line="../gluegen-rt.jar"/>
+ </exec>
+ <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true">
+ <arg line="--dex"/>
+ <arg line="--output=${build}/gluegen-rt.apk"/>
+ <arg line="${build}/gluegen-rt.d/"/>
+ </exec>
+ </target>
+
+ <target name="android.package" depends="gluegen.cpptasks.detect.os,gluegen.build.check.java" if="isAndroid">
+ <delete file="${build}/gluegen-rt.apk" includeEmptyDirs="true" quiet="true" failonerror="false" />
+ <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true">
+ <arg line="--dex"/>
+ <arg line="--output=${build}/gluegen-rt.apk"/>
+ <arg line="${build}/gluegen-rt.jar"/>
+ </exec>
</target>
<target name="base.compile" depends="init, gluegen.build.java, gluegen.build.c, tag.build" />
- <target name="all" description="Release build" depends="init, base.compile, junit.compile, developer-zip-archive" />
+ <target name="all.no_junit" description="Release build" depends="init, base.compile, android.package, developer-zip-archive" />
+ <target name="all" description="Release build" depends="init, base.compile, junit.compile, android.package, developer-zip-archive" />
<target name="all.debug" description="Debug build" depends="init.debug, base.compile, junit.compile, developer-zip-archive" />
diff --git a/make/gluegen-cpptasks-base.xml b/make/gluegen-cpptasks-base.xml
index 6659897..8e0eb0c 100755
--- a/make/gluegen-cpptasks-base.xml
+++ b/make/gluegen-cpptasks-base.xml
@@ -391,7 +391,11 @@
<property name="os.and.arch" value="linux-armv7" />
</target>
- <target name="gluegen.cpptasks.detect.os.linux" depends="gluegen.cpptasks.detect.os.linux.amd64,gluegen.cpptasks.detect.os.linux.ia64,gluegen.cpptasks.detect.os.linux.x86,gluegen.cpptasks.detect.os.linux.armv7" unless="gluegen.cpptasks.detected.os.2" />
+ <target name="gluegen.cpptasks.detect.os.android.armv7" unless="gluegen.cpptasks.detected.os.2" if="isAndroidARMv7">
+ <property name="os.and.arch" value="android-armv7" />
+ </target>
+
+ <target name="gluegen.cpptasks.detect.os.linux" depends="gluegen.cpptasks.detect.os.linux.amd64,gluegen.cpptasks.detect.os.linux.ia64,gluegen.cpptasks.detect.os.linux.x86,gluegen.cpptasks.detect.os.linux.armv7,gluegen.cpptasks.detect.os.android.armv7" unless="gluegen.cpptasks.detected.os.2" />
<target name="gluegen.cpptasks.detect.os.osx" unless="gluegen.cpptasks.detected.os.2" if="isOSX">
<property name="native.library.suffix" value="*lib" />
diff --git a/make/lib/gluegen-cpptasks-android-armv7.xml b/make/lib/gluegen-cpptasks-android-armv7.xml
index 17cb5c9..90db706 100644
--- a/make/lib/gluegen-cpptasks-android-armv7.xml
+++ b/make/lib/gluegen-cpptasks-android-armv7.xml
@@ -26,7 +26,6 @@
<compilerarg value="${env.TARGET_TOOL_PATH}/libexec/gcc/${env.TARGET_ARCH}/${env.GCC_VERSION}" />
<compilerarg value="-march=armv7-a" />
<compilerarg value="-fpic" />
- <compilerarg value="-DANDROID" />
<compilerarg value="${env.NDK_INCLUDE}" />
<compilerarg value="-I${env.TARGET_TOOL_PATH}/lib/gcc/${env.TARGET_ARCH}/${env.GCC_VERSION}/include" /> <!--inclides stdarg.h -->
<compilerarg value="-Wl,--demangle" />
@@ -37,7 +36,6 @@
<compilerarg value="-Wl,-z,nocopyreloc" />
<compilerarg value="${env.TARGET_OS_PATH}/lib/libc.so" />
<compilerarg value="${env.TARGET_OS_PATH}/lib/libdl.so" />
-<!-- <compilerarg value="${env.TARGET_OS_PATH}/lib/libstdc++.so" /> -->
<compilerarg value="${env.TARGET_OS_PATH}/lib/libm.so" />
<!-- <compilerarg value="${env.TARGET_OS_PATH}/lib/crtbegin_dynamic.o" /> -->
<compilerarg value="-Wl,--no-undefined" />
@@ -45,7 +43,11 @@
<compilerarg value="${env.TARGET_TOOL_PATH}/lib/gcc/${env.TARGET_ARCH}/${env.GCC_VERSION}/${env.TARGET_CPU_NAME}/libgcc.a" />
<compilerarg value="${env.TARGET_OS_PATH}/lib/crtend_android.o" />
<defineset>
+ <define name="__unix__"/>
<define name="ANDROID" />
+ <define name="_DEBUG" if="c.compiler.use-debug"/>
+ <define name="DEBUG" if="c.compiler.use-debug"/>
+ <define name="NDEBUG" unless="c.compiler.use-debug"/>
</defineset>
</compiler>
diff --git a/make/scripts/crosstest-java-android-armv7-rel.sh b/make/scripts/crosstest-java-android-armv7-rel.sh
new file mode 100644
index 0000000..27f209a
--- /dev/null
+++ b/make/scripts/crosstest-java-android-armv7-rel.sh
@@ -0,0 +1,46 @@
+export HOST_UID=sven
+export HOST_IP=192.168.0.52
+export HOST_RSYNC_ROOT=PROJECTS/JOGL
+
+export TARGET_UID=jogamp
+export TARGET_IP=beagle02
+export TARGET_ROOT=/projects
+
+export BUILD_DIR=../build-android-armv7
+
+if [ -e /opt-linux-x86/android-sdk-linux_x86 ] ; then
+ export ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86
+ export PATH=$ANDROID_SDK_HOME/platform-tools:$PATH
+fi
+
+#
+# orig android
+# LD_LIBRARY_PATH /system/lib
+# export BOOTCLASSPATH /system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar:/system/framework/core-junit.jar
+#
+
+#TSTCLASS=com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
+TSTCLASS=com.jogamp.common.GlueGenVersion
+
+LOGFILE=`basename $0 .sh`.log
+
+# -Djava.class.path=lib/junit.jar:/usr/share/ant/lib/ant.jar:/usr/share/ant/lib/ant-junit.jar:$BUILD_DIR/gluegen.jar:$BUILD_DIR/test/build/gluegen-test.jar \
+# -Djava.library.path=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$BUILD_DIR/test/build/natives \
+
+adb shell "\
+rsync -av --delete --delete-after --exclude 'build-x86*/' $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
+cd $TARGET_ROOT/gluegen/make ; \
+export LD_LIBRARY_PATH=/system/lib:$TARGET_ROOT/gluegen/make/$BUILD_DIR/obj:$TARGET_ROOT/gluegen/make/$BUILD_DIR/test/build/natives ; \
+export BOOTCLASSPATH=/system/framework/core.jar:/system/framework/bouncycastle.jar:/system/framework/ext.jar:/system/framework/framework.jar:/system/framework/android.policy.jar:/system/framework/services.jar ; \
+dalvikvm \
+ -Xjnigreflimit:2000 \
+ -Djava.class.path=$BUILD_DIR/gluegen-rt.apk \
+ -Djogamp.debug.JNILibLoader=true \
+ -Djogamp.debug.NativeLibrary=true \
+ -Djogamp.debug.NativeLibrary.Lookup=true \
+ -Djogamp.debug.ProcAddressHelper=true \
+ com.android.internal.util.WithFramework \
+ $TSTCLASS \
+" 2>&1 | tee $LOGFILE
+
+adb pull $TARGET_ROOT/gluegen/make/$LOGFILE .
diff --git a/make/scripts/crosstest-java-linux-armv7-rel.sh b/make/scripts/crosstest-java-linux-armv7-rel.sh
index f7161b9..efeb0ea 100644
--- a/make/scripts/crosstest-java-linux-armv7-rel.sh
+++ b/make/scripts/crosstest-java-linux-armv7-rel.sh
@@ -13,7 +13,7 @@ TSTCLASS=com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
LOGFILE=`basename $0 .sh`.log
ssh $TARGET_UID@$TARGET_IP "\
-rsync -aAv --delete --delete-after --exclude 'build*/' $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
+rsync -aAv --delete --delete-after --exclude 'build-x86*/' $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
cd $TARGET_ROOT/gluegen/make ;
LD_LIBRARY_PATH=$BUILD_DIR/obj:$BUILD_DIR/test/build/natives \
java \
diff --git a/make/scripts/crosstest-junit-linux-armv7-rel.sh b/make/scripts/crosstest-junit-linux-armv7-rel.sh
index 4c71b5d..519824b 100644
--- a/make/scripts/crosstest-junit-linux-armv7-rel.sh
+++ b/make/scripts/crosstest-junit-linux-armv7-rel.sh
@@ -13,7 +13,7 @@ TSTCLASS=com.jogamp.gluegen.test.junit.generation.Test1p2ProcAddressEmitter
LOGFILE=`basename $0 .sh`.log
ssh $TARGET_UID@$TARGET_IP "\
-rsync -aAv --delete --delete-after --exclude 'build*/' $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
+rsync -aAv --delete --delete-after --exclude 'build-x86*/' $HOST_UID@$HOST_IP::$HOST_RSYNC_ROOT/gluegen $TARGET_ROOT ; \
cd $TARGET_ROOT/gluegen/make ;
LD_LIBRARY_PATH=$BUILD_DIR/obj:$BUILD_DIR/test/build/natives \
java \
diff --git a/make/scripts/make.gluegen.all.android-armv7-cross.sh b/make/scripts/make.gluegen.all.android-armv7-cross.sh
index 0865634..21f4263 100755
--- a/make/scripts/make.gluegen.all.android-armv7-cross.sh
+++ b/make/scripts/make.gluegen.all.android-armv7-cross.sh
@@ -1,12 +1,26 @@
#! /bin/sh
+export HOST_UID=sven
+export HOST_IP=192.168.0.52
+export HOST_RSYNC_ROOT=PROJECTS/JOGL
+
+export TARGET_UID=jogamp
+export TARGET_IP=beagle01
+export TARGET_ROOT=projects-cross
+export TARGET_ANT_HOME=/usr/share/ant
+
if [ -z "$NDK_ROOT" ] ; then
- NDK_ROOT=/usr/local/android-ndk-r6
+ NDK_ROOT=/opt-linux-x86/android-ndk-r6
fi
export NDK_ROOT
NDK_TOOLCHAIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/linux-x86/arm-linux-androideabi
-export PATH="$NDK_TOOLCHAIN/bin:$PATH"
+if [ -z "$ANDROID_SDK_HOME" ] ; then
+ ANDROID_SDK_HOME=/opt-linux-x86/android-sdk-linux_x86
+fi
+export ANDROID_SDK_HOME
+
+export PATH="$NDK_TOOLCHAIN/bin:$ANDROID_SDK_HOME/platform-tools:$PATH"
ANDROID_VERSION=9
export GCC_VERSION=4.4.3
diff --git a/src/java/com/jogamp/common/os/AndroidVersion.java b/src/java/com/jogamp/common/os/AndroidVersion.java
new file mode 100644
index 0000000..b5a7cfa
--- /dev/null
+++ b/src/java/com/jogamp/common/os/AndroidVersion.java
@@ -0,0 +1,97 @@
+package com.jogamp.common.os;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Modifier;
+import java.util.HashMap;
+import java.util.Map;
+
+import com.jogamp.common.util.ReflectionUtil;
+
+public class AndroidVersion {
+ public static final boolean isAvailable;
+
+ /** All SDK version map, where SDK_INT is the key to the current running version */
+ public static final Map<Integer, String> VERSION_CODES;
+
+ /** Development codename, or the string "REL" for official release */
+ public static final String CODENAME;
+
+ /** internal build value used by the underlying source control. */
+ public static final String INCREMENTAL;
+
+ /** official build version string */
+ public static final String RELEASE;
+
+ /** SDK Version number, key to VERSION_CODES */
+ public static final int SDK_INT;
+
+ /** SDK Version string */
+ public static final String SDK_NAME;
+
+ static final String androidBuildVersion = "android.os.Build$VERSION";
+ static final String androidBuildVersionCodes = "android.os.Build$VERSION_CODES";
+
+ static {
+ final ClassLoader cl = AndroidVersion.class.getClassLoader();
+ Class abvClass = null;
+ Object abvObject= null;
+ Class abvcClass = null;
+ Object abvcObject= null;
+ try {
+ abvClass = ReflectionUtil.getClass(androidBuildVersion, true, cl);
+ abvObject = abvClass.newInstance();
+ abvcClass = ReflectionUtil.getClass(androidBuildVersionCodes, true, cl);
+ abvcObject = abvcClass.newInstance();
+ } catch (Exception e) { e.printStackTrace(); /* n/a */ }
+ isAvailable = null != abvObject ;
+ if(isAvailable) {
+ CODENAME = getString(abvClass, abvObject, "CODENAME");
+ INCREMENTAL = getString(abvClass, abvObject, "INCREMENTAL");
+ RELEASE = getString(abvClass, abvObject, "RELEASE");
+ SDK_INT = getInt(abvClass, abvObject, "SDK_INT");
+ VERSION_CODES = getVersionCodes(abvcClass, abvcObject);
+ String sdk_name = VERSION_CODES.get(new Integer(SDK_INT));
+ SDK_NAME = ( null != sdk_name ) ? sdk_name : "SDK_"+SDK_INT ;
+ } else {
+ CODENAME = null;
+ INCREMENTAL = null;
+ RELEASE = null;
+ SDK_INT = -1;
+ VERSION_CODES = new HashMap<Integer, String>();
+ SDK_NAME = null;
+ }
+ }
+
+ private static final Map<Integer, String> getVersionCodes(Class cls, Object obj) {
+ HashMap<Integer, String> map = new HashMap<Integer, String>();
+ Field[] fields = cls.getFields();
+ for(int i=0; i<fields.length; i++) {
+ try {
+ final int version = fields[i].getInt(obj);
+ final String version_name = fields[i].getName();
+ // System.err.println(i+": "+version+": "+version_name);
+ map.put(new Integer(version), version_name);
+ } catch (Exception e) { e.printStackTrace(); /* n/a */ }
+ }
+ return map;
+ }
+
+ private static final String getString(Class cls, Object obj, String name) {
+ try {
+ Field f = cls.getField(name);
+ return (String) f.get(obj);
+ } catch (Exception e) { e.printStackTrace(); /* n/a */ }
+ return null;
+ }
+
+ private static final int getInt(Class cls, Object obj, String name) {
+ try {
+ Field f = cls.getField(name);
+ return f.getInt(obj);
+ } catch (Exception e) { e.printStackTrace(); /* n/a */ }
+ return -1;
+ }
+
+ // android.os.Build.VERSION
+}
diff --git a/src/java/com/jogamp/common/os/Platform.java b/src/java/com/jogamp/common/os/Platform.java
index 4db5b09..6c23f07 100644
--- a/src/java/com/jogamp/common/os/Platform.java
+++ b/src/java/com/jogamp/common/os/Platform.java
@@ -54,6 +54,8 @@ public class Platform {
public static final String ARCH_lower;
public static final String JAVA_VENDOR;
public static final String JAVA_VENDOR_URL;
+ public static final String JAVA_VM_NAME;
+ public static final String JAVA_RUNTIME_NAME;
public static final String JAVA_VERSION;
public static final String NEWLINE;
@@ -142,7 +144,8 @@ public class Platform {
JAVA_VENDOR_URL = System.getProperty("java.vendor.url");
JAVA_VERSION = System.getProperty("java.version");
NEWLINE = System.getProperty("line.separator");
-
+ JAVA_VM_NAME = System.getProperty("java.vm.name");
+ JAVA_RUNTIME_NAME = getJavaRuntimeNameImpl();
JAVA_SE = initIsJavaSE();
LITTLE_ENDIAN = queryIsLittleEndianImpl();
@@ -227,6 +230,9 @@ public class Platform {
}
private static OSType getOSTypeImpl() throws RuntimeException {
+ if ( AndroidVersion.isAvailable ) {
+ return OSType.ANDROID;
+ }
if ( OS_lower.startsWith("linux") ) {
return OSType.LINUX;
}
@@ -254,15 +260,18 @@ public class Platform {
}
throw new RuntimeException("Please port OS detection to your platform (" + OS_lower + "/" + ARCH_lower + ")");
}
-
- private static boolean initIsJavaSE() {
+
+ private static String getJavaRuntimeNameImpl() {
// the fast path, check property Java SE instead of traversing through the ClassLoader
- String java_runtime_name = (String) AccessController.doPrivileged(new PrivilegedAction() {
+ return (String) AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return System.getProperty("java.runtime.name");
}
});
- if(java_runtime_name.indexOf("Java SE") != -1) {
+ }
+
+ private static boolean initIsJavaSE() {
+ if(JAVA_RUNTIME_NAME.indexOf("Java SE") != -1) {
return true;
}
@@ -294,8 +303,9 @@ public class Platform {
/**
* Returns the OS name.
+ * <p>In case of {@link OSType#ANDROID}, see {@link #getOSType()}, the OS name is Linux</p>
*/
- public static String getOS() {
+ public static String getOSName() {
return OS;
}
@@ -316,6 +326,7 @@ public class Platform {
/**
* Returns the OS type.
+ * <p>In case of {@link OSType#ANDROID} the OS name, see {@link #getOSName()}, is Linux</p>
*/
public static OSType getOSType() {
return OS_TYPE;
@@ -343,6 +354,20 @@ public class Platform {
}
/**
+ * Returns the JAVA VM name.
+ */
+ public static String getJavaVMName() {
+ return JAVA_VM_NAME;
+ }
+
+ /**
+ * Returns the JAVA runtime name.
+ */
+ public static String getJavaRuntimeName() {
+ return JAVA_RUNTIME_NAME;
+ }
+
+ /**
* Returns the JAVA vendor url.
*/
public static String getJavaVendorURL() {
diff --git a/src/java/com/jogamp/common/util/VersionUtil.java b/src/java/com/jogamp/common/util/VersionUtil.java
index 1589755..b8b7932 100644
--- a/src/java/com/jogamp/common/util/VersionUtil.java
+++ b/src/java/com/jogamp/common/util/VersionUtil.java
@@ -28,6 +28,7 @@
package com.jogamp.common.util;
+import com.jogamp.common.os.AndroidVersion;
import com.jogamp.common.os.Platform;
import java.io.IOException;
@@ -53,16 +54,21 @@ public class VersionUtil {
sb.append(SEPERATOR).append(Platform.getNewline());
// environment
- sb.append("Platform: ").append(Platform.getOS()).append(' ').append(Platform.getOSVersion()).append(" (os), ");
+ sb.append("Platform: ").append(Platform.getOSType()).append(" / ").append(Platform.getOSName()).append(' ').append(Platform.getOSVersion()).append(" (os), ");
sb.append(Platform.getArch()).append(" (arch) ").append(Runtime.getRuntime().availableProcessors()).append(" cores");
sb.append(Platform.getNewline());
+ if( Platform.OSType.ANDROID == Platform.getOSType() && AndroidVersion.isAvailable) {
+ sb.append("Platform: Android Version: ").append(AndroidVersion.CODENAME).append(", ");
+ sb.append(AndroidVersion.RELEASE).append(" [").append(AndroidVersion.RELEASE).append("], SDK: ").append(AndroidVersion.SDK_INT).append(", ").append(AndroidVersion.SDK_NAME);
+ sb.append(Platform.getNewline());
+ }
Platform.getMachineDescription().toString(sb).append(Platform.getNewline());
// JVM/JRE
- sb.append("Platform: Java ").append(Platform.getJavaVersion()).append(", ").append(System.getProperty("java.vm.name")).append(", ");
- sb.append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()).append(", is JavaSE: ").append(Platform.isJavaSE());
-
+ sb.append("Platform: Java Version: ").append(Platform.getJavaVersion()).append(", VM: ").append(Platform.getJavaVMName());
+ sb.append(", Runtime: ").append(Platform.getJavaRuntimeName()).append(Platform.getNewline());
+ sb.append("Platform: Java Vendor: ").append(Platform.getJavaVendor()).append(", ").append(Platform.getJavaVendorURL()).append(", is JavaSE: ").append(Platform.isJavaSE());
sb.append(Platform.getNewline()).append(SEPERATOR);
return sb;
diff --git a/src/java/jogamp/common/os/MachineDescriptionRuntime.java b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
index bf49105..0438d30 100644
--- a/src/java/jogamp/common/os/MachineDescriptionRuntime.java
+++ b/src/java/jogamp/common/os/MachineDescriptionRuntime.java
@@ -28,6 +28,7 @@
package jogamp.common.os;
+import com.jogamp.common.os.AndroidVersion;
import com.jogamp.common.os.MachineDescription;
import com.jogamp.common.os.NativeLibrary;
import com.jogamp.common.os.Platform;
@@ -118,6 +119,17 @@ public class MachineDescriptionRuntime {
getAlignmentPointerImpl());
}
+ public static boolean isAndroid() {
+ try {
+ NativeLibrary.ensureNativeLibLoaded();
+ return isAndroidImpl();
+ } catch (UnsatisfiedLinkError err) {
+ return AndroidVersion.isAvailable;
+ }
+ }
+
+ private static native boolean isAndroidImpl();
+
private static native int getPointerSizeInBytesImpl();
private static native long getPageSizeInBytesImpl();
diff --git a/src/native/common/MachineDescriptionRuntime.c b/src/native/common/MachineDescriptionRuntime.c
index a8a69ee..1d5286b 100644
--- a/src/native/common/MachineDescriptionRuntime.c
+++ b/src/native/common/MachineDescriptionRuntime.c
@@ -13,6 +13,15 @@
#include <gluegen_stdint.h>
+JNIEXPORT jboolean JNICALL
+Java_jogamp_common_os_MachineDescriptionRuntime_isAndroidImpl(JNIEnv *env, jclass _unused) {
+#if defined(ANDROID)
+ return JNI_TRUE;
+#else
+ return JNI_FALSE;
+#endif
+}
+
JNIEXPORT jint JNICALL
Java_jogamp_common_os_MachineDescriptionRuntime_getPointerSizeInBytesImpl(JNIEnv *env, jclass _unused) {
return sizeof(void *);