summaryrefslogtreecommitdiffstats
path: root/make
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2012-03-17 21:15:49 +0100
committerSven Gothel <[email protected]>2012-03-17 21:15:49 +0100
commit235f8b1cbff8ed13071d5c19c0be492c0b25cb78 (patch)
tree659845e16bd69372bc7ddc3a42b3aa7130d18df5 /make
parent0cfc7847c58b51c9a26b50d905b592d1fc4c8578 (diff)
Add 'asset' URLConnection; IOUtil uses URLConnection / incr. effeciency; Android ClassLoaderUtil cleanup;
- Add 'asset' URLConnection - Please read API doc 'PiggybackURLConnection' and 'AssetURLConnection' - Solves generic resource handling where platform locations may differ, ie ClassLoader lookup on Android in the 'assets/' subfolder. - New Android 'AssetDexClassLoader' uses 'assets/' folder for findResource(..) - aapt.signed (our APK ant task) - uses 'assets/' folder - adds the 'assetsdir' attribute allowing to copy other assets into the APK - IOUtil uses URLConnection / incr. effeciency - using URLConnection on all getResource(..) since URL is connected anyways for validation and URLConnection can be used by caller right away - String getRelativeOf(URL, String) -> URL getRelativeOf(URL, String) - preserves scheme, authority, etc - simple parentOf handling, more efficient - reusing new 'asset' protocol impl. - Android ClassLoaderUtil cleanup; - Use createClassLoader(..) impl for build-in static jogamp and user APKs, which removes code redundancy Tests: New code path, especially 'assets' are covered by new unit tests, no regressions on Linux.
Diffstat (limited to 'make')
-rw-r--r--make/build-test.xml4
-rw-r--r--make/build.xml10
-rwxr-xr-xmake/gluegen-cpptasks.xml2
-rw-r--r--make/jogamp-androidtasks.xml14
-rw-r--r--make/resources/assets-test/com/jogamp/common/net/data/AssetURLConnectionTest.txt3
-rw-r--r--make/resources/assets-test/com/jogamp/common/net/data/RelativeData.txt3
-rw-r--r--make/resources/assets-test/gluegen-test/info.txt3
-rw-r--r--make/resources/assets/gluegen/info.txt3
-rwxr-xr-x[-rw-r--r--]make/scripts/adb-uninstall-all.sh3
-rwxr-xr-xmake/scripts/runtest.sh18
-rw-r--r--make/scripts/setenv-build-jogl-x86_64.sh7
11 files changed, 62 insertions, 8 deletions
diff --git a/make/build-test.xml b/make/build-test.xml
index 206815f..56c10df 100644
--- a/make/build-test.xml
+++ b/make/build-test.xml
@@ -131,11 +131,15 @@
<fileset dir="${build_t.java}">
<include name="${test.junit.rel}/**/*.class"/>
</fileset>
+ <fileset dir="resources/assets-test">
+ <include name="**" />
+ </fileset>
</jar>
</target>
<target name="android.package" depends="java.build,native.build" if="isAndroid">
<aapt.signed
+ assetsdir="resources/assets-test"
jarbuilddir="${build_t}"
jarbasename="gluegen-test"
nativebuilddir="${build_t.lib}"
diff --git a/make/build.xml b/make/build.xml
index 1eaab32..7e1b6c0 100644
--- a/make/build.xml
+++ b/make/build.xml
@@ -696,6 +696,9 @@
<exclude name="jogamp/common/os/android/**" />
<exclude name="${jogamp.android-launcher.classes}" />
</fileset>
+ <fileset dir="resources/assets">
+ <include name="**" />
+ </fileset>
</jar>
<copy file="Manifest-rt"
@@ -717,6 +720,9 @@
<include name="jogamp/common/**" />
<exclude name="${jogamp.android-launcher.classes}" />
</fileset>
+ <fileset dir="resources/assets">
+ <include name="**" />
+ </fileset>
</jar>
<!-- Copy antlr.jar into build directory for convenience so
@@ -749,6 +755,7 @@
<javac destdir="${classes}"
includeAntRuntime="false"
includes="${jogamp.android-launcher.classes}"
+ excludes="${jogamp.common.classes}"
memoryMaximumSize="${javac.memorymax}"
encoding="UTF-8"
source="${target.sourcelevel}"
@@ -777,6 +784,7 @@
</jar>
<aapt.signed
+ assetsdir="resources/android/assets-launcher"
jarbuilddir="${build}"
jarbasename="jogamp.android-launcher"
nativebuilddir="${build}"
@@ -802,6 +810,7 @@
<target name="android.package" depends="gluegen.cpptasks.detect.os,gluegen.build.check.aapt" if="isAndroid" unless="gluegen.build.skip.aapt" >
<aapt.signed
+ assetsdir="resources/assets"
jarbuilddir="${build}"
jarbasename="gluegen-rt"
nativebuilddir="${gluegen.lib.dir}"
@@ -813,7 +822,6 @@
version.code="${gluegen_int_version}"
version.name="${gluegen.version.plus}"
/>
-
</target>
<target name="base.compile" description="Base compile ensuring valid build results w/o tampering the artifacts.properties"
diff --git a/make/gluegen-cpptasks.xml b/make/gluegen-cpptasks.xml
index 4dc8542..93d9743 100755
--- a/make/gluegen-cpptasks.xml
+++ b/make/gluegen-cpptasks.xml
@@ -44,7 +44,7 @@
<property name="gluegen-cpptasks.file.abs-path" location="${gluegen-cpptasks.file.rel}" />
- <echo message="gluegen-cpptasks.file.abs-path: ${gluegen-cpptasks.file.abs-path}" />
+ <!--echo message="gluegen-cpptasks.file.abs-path: ${gluegen-cpptasks.file.abs-path}" /-->
<import file="${gluegen-cpptasks.file.abs-path}" optional="false" />
</project>
diff --git a/make/jogamp-androidtasks.xml b/make/jogamp-androidtasks.xml
index 5e8405b..5c68e0e 100644
--- a/make/jogamp-androidtasks.xml
+++ b/make/jogamp-androidtasks.xml
@@ -32,6 +32,7 @@
-->
<macrodef name="aapt.signed">
+ <attribute name="assetsdir" default="/non.existing.src.path"/>
<attribute name="jarsrcdir" default="/non.existing.src.path"/>
<attribute name="jarbuilddir" />
<attribute name="jarbasename" />
@@ -73,20 +74,24 @@
<delete file="${m.aapt.release.file.name}" includeEmptyDirs="true" quiet="true" failonerror="false" />
<delete dir="${m.aapt.build.apk}" includeEmptyDirs="true" quiet="true" failonerror="false" />
+ <mkdir dir="${m.aapt.build.apk}/image/assets" />
<mkdir dir="${m.aapt.build.apk}/image/lib/@{android.abi}" />
<mkdir dir="${m.aapt.build.apk}/image/lib/src" />
<mkdir dir="${m.aapt.build.apk}/image/lib/classes" />
- <mkdir dir="${m.aapt.build.apk}/image/lib/assets" />
<copy todir="${m.aapt.build.apk}/image/lib/@{android.abi}">
<fileset dir="@{nativebuilddir}">
<include name="*@{nativebasename}*.${native.library.suffix}" />
</fileset>
</copy>
- <copy todir="${m.aapt.build.apk}/image" failonerror="false" includeEmptyDirs="false">
+ <copy todir="${m.aapt.build.apk}/image/assets" failonerror="false" includeEmptyDirs="false">
<fileset dir="@{jarsrcdir}"
includes="**"
- excludes="**/*.java **/*.class **/*.h **/*.c **/*.m"/>
+ excludes="**/*.java **/*.class **/*.h **/*.c **/*.m **/*.sh"/>
+ </copy>
+ <copy todir="${m.aapt.build.apk}/image/assets" failonerror="false" includeEmptyDirs="false">
+ <fileset dir="@{assetsdir}"
+ includes="**"/>
</copy>
<copy file="@{androidmanifest.path}" tofile="${m.aapt.build.apk}/image/AndroidManifest.xml"/>
@@ -150,8 +155,9 @@
<arg line="-S" />
<arg value="@{androidresources.path}"/>
+ <!-- implicit image layout
<arg line="-A" />
- <arg value="${m.aapt.build.apk}/image/lib/assets"/>
+ <arg value="${m.aapt.build.apk}/image/assets"/> -->
<arg line="-I" />
<arg line="${android.jar}"/>
diff --git a/make/resources/assets-test/com/jogamp/common/net/data/AssetURLConnectionTest.txt b/make/resources/assets-test/com/jogamp/common/net/data/AssetURLConnectionTest.txt
new file mode 100644
index 0000000..97d70a7
--- /dev/null
+++ b/make/resources/assets-test/com/jogamp/common/net/data/AssetURLConnectionTest.txt
@@ -0,0 +1,3 @@
+AssetURLConnectionTest Data Testing Relative Location
+
+This file exists for test purposes.
diff --git a/make/resources/assets-test/com/jogamp/common/net/data/RelativeData.txt b/make/resources/assets-test/com/jogamp/common/net/data/RelativeData.txt
new file mode 100644
index 0000000..ecdf371
--- /dev/null
+++ b/make/resources/assets-test/com/jogamp/common/net/data/RelativeData.txt
@@ -0,0 +1,3 @@
+Relative Data To com/jogamp/common/net/data/AssetURLConnectionTest
+
+This file exists for test purposes.
diff --git a/make/resources/assets-test/gluegen-test/info.txt b/make/resources/assets-test/gluegen-test/info.txt
new file mode 100644
index 0000000..14f7494
--- /dev/null
+++ b/make/resources/assets-test/gluegen-test/info.txt
@@ -0,0 +1,3 @@
+Gluegen Test Asset.
+
+This file exists for test purposes.
diff --git a/make/resources/assets/gluegen/info.txt b/make/resources/assets/gluegen/info.txt
new file mode 100644
index 0000000..50a61b7
--- /dev/null
+++ b/make/resources/assets/gluegen/info.txt
@@ -0,0 +1,3 @@
+Gluegen RT Asset.
+
+This file exists for test purposes.
diff --git a/make/scripts/adb-uninstall-all.sh b/make/scripts/adb-uninstall-all.sh
index 9973ef4..63606a1 100644..100755
--- a/make/scripts/adb-uninstall-all.sh
+++ b/make/scripts/adb-uninstall-all.sh
@@ -1 +1,2 @@
-adb uninstall com.jogamp.common
+adb $* uninstall jogamp.android.launcher
+adb $* uninstall com.jogamp.common
diff --git a/make/scripts/runtest.sh b/make/scripts/runtest.sh
index 547a17f..83c21b9 100755
--- a/make/scripts/runtest.sh
+++ b/make/scripts/runtest.sh
@@ -8,6 +8,11 @@ if [ -z "$builddir" ] ; then
exit 1
fi
+if [ -e /opt-share/apache-ant ] ; then
+ ANT_PATH=/opt-share/apache-ant
+ PATH=$ANT_PATH/bin:$PATH
+ export ANT_PATH
+fi
if [ -z "$ANT_PATH" ] ; then
TMP_ANT_PATH=$(dirname `which ant`)/..
if [ -e $TMP_ANT_PATH/lib/ant.jar ] ; then
@@ -17,6 +22,13 @@ if [ -z "$ANT_PATH" ] ; then
fi
fi
if [ -z "$ANT_PATH" ] ; then
+ if [ -e /usr/share/ant/bin/ant -a -e /usr/share/ant/lib/ant.jar ] ; then
+ ANT_PATH=/usr/share/ant
+ export ANT_PATH
+ echo autosetting ANT_PATH to $ANT_PATH
+ fi
+fi
+if [ -z "$ANT_PATH" ] ; then
echo ANT_PATH does not exist, set it
print_usage
exit
@@ -37,6 +49,7 @@ rm -f $LOG
#D_ARGS="-Djogamp.debug.Lock"
#D_ARGS="-Djogamp.debug.Lock -Djogamp.debug.Lock.TraceLock"
#D_ARGS="-Djogamp.debug.Lock.TraceLock"
+D_ARGS="-Djogamp.debug.IOUtil"
function onetest() {
clazz=$1
@@ -71,5 +84,8 @@ function onetest() {
#onetest com.jogamp.common.util.TestPlatform01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestRunnableTask01 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestIOUtil01 2>&1 | tee -a $LOG
-onetest com.jogamp.common.util.TestTempJarCache 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.util.TestTempJarCache 2>&1 | tee -a $LOG
#onetest com.jogamp.common.util.TestJarUtil 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.AssetURLConnectionUnregisteredTest 2>&1 | tee -a $LOG
+#onetest com.jogamp.common.net.AssetURLConnectionRegisteredTest 2>&1 | tee -a $LOG
+onetest com.jogamp.common.net.URLCompositionTest 2>&1 | tee -a $LOG
diff --git a/make/scripts/setenv-build-jogl-x86_64.sh b/make/scripts/setenv-build-jogl-x86_64.sh
index 4003e8b..d92419b 100644
--- a/make/scripts/setenv-build-jogl-x86_64.sh
+++ b/make/scripts/setenv-build-jogl-x86_64.sh
@@ -15,6 +15,13 @@ if [ -z "$ANT_PATH" ] ; then
fi
fi
if [ -z "$ANT_PATH" ] ; then
+ if [ -e /usr/share/ant/bin/ant -a -e /usr/share/ant/lib/ant.jar ] ; then
+ ANT_PATH=/usr/share/ant
+ export ANT_PATH
+ echo autosetting ANT_PATH to $ANT_PATH
+ fi
+fi
+if [ -z "$ANT_PATH" ] ; then
echo ANT_PATH does not exist, set it
exit
fi