diff options
author | Sven Gothel <[email protected]> | 2019-12-26 04:26:32 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-26 04:26:32 +0100 |
commit | 1390bc236de531646aaa4525a17de1a533b1fa06 (patch) | |
tree | 8766f44afe2adc5883f04be138dc08a9de80f219 | |
parent | faa37334e2912e02cb58e738570a127cc6402b37 (diff) |
Bug 1417 - Android: Use d8 for dex'ing w/ implicit Java8 desugaring (macro: aapt.signed)
The new SDK d8 dex'ing tool performs Java8 desugaring, hence allows using Java8 code style.
We use d8 instead of dx in the 'aapt.signed' macro of 'jogamp-androidtasks.xml'.
For the proper desugaring, we pass 'android-min.jar and 'target.rt.jar' Android and Java8
system runtime jar-files to d8's classpath.
Macro 'aapt.signed' also receives the new optional element 'd8-classpaths'
to allows caller to pass further required jar-files to the d8 classpath.
See build-test.xml.
-rw-r--r-- | make/build-test.xml | 10 | ||||
-rw-r--r-- | make/jogamp-androidtasks.xml | 26 |
2 files changed, 31 insertions, 5 deletions
diff --git a/make/build-test.xml b/make/build-test.xml index 5d7d75d..a83333d 100644 --- a/make/build-test.xml +++ b/make/build-test.xml @@ -209,8 +209,14 @@ androidmanifest.path="resources/android/AndroidManifest-Test.xml" androidresources.path="resources/android/res" version.code="${jogamp.version.int}" - version.name="${jogamp.version}" - /> + version.name="${jogamp.version}"> + <d8-classpaths> + <arg line="--classpath ${junit.jar}"/> + <arg line="--classpath ${semver.jar}"/> + <arg line="--classpath ${gluegen.jar}"/> + <arg line="--classpath ${gluegen-test-util.jar}"/> + </d8-classpaths> + </aapt.signed> </target> <target name="c.configure" depends="gluegen.cpptasks.detect.os,gluegen.cpptasks.setup.compiler"> diff --git a/make/jogamp-androidtasks.xml b/make/jogamp-androidtasks.xml index 172da7b..3289a2b 100644 --- a/make/jogamp-androidtasks.xml +++ b/make/jogamp-androidtasks.xml @@ -65,6 +65,7 @@ <attribute name="keystore.alias" default="${android.keystore.alias}" /> <attribute name="keystore.storepass" default="${android.keystore.storepass}" /> <attribute name="keystore.keypass" default="${android.keystore.keypass}" /> + <element name="d8-classpaths" implicit="no" optional="true" /> <sequential> <var name="m.aapt.apkbasename0" unset="true"/> @@ -171,13 +172,32 @@ <pathelement path="${android.jar}"/> </classpath> </javac> + <zip destfile="${m.aapt.build.apk}/temp/classes.zip" level="0"> + <fileset dir="${m.aapt.build.apk}/temp/classes"/> + </zip> <echo>aapt.signed ${m.aapt.apkbasename}: dex'ing</echo> - <exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> - <arg line="--dex"/> - <arg line="--output=${m.aapt.dex.file}"/> + <!-- exec dir="." executable="dx" logError="true" failonerror="true" failifexecutionfails="true"> + <arg line="- -dex"/> + <arg line="- -output=${m.aapt.dex.file}"/> + <arg line="- -min-sdk-version=${android.api.level.min}"/> <arg line="@{jarbuilddir}/@{jarbasename}.jar"/> <arg line="${m.aapt.build.apk}/temp/classes"/> + </exec --> + <exec dir="." executable="d8" logError="true" failonerror="true" failifexecutionfails="true"> + <arg line="--output ${m.aapt.build.apk}/image"/> + + <arg line="--classpath ${android-min.jar}"/> + <arg line="--classpath ${target.rt.jar}"/> + <d8-classpaths/> + + <arg line="--min-api ${android.api.level.min}"/> + + <arg line="--release"/> + <!-- arg line="- -debug"/ --> + + <arg line="@{jarbuilddir}/@{jarbasename}.jar"/> + <arg line="${m.aapt.build.apk}/temp/classes.zip"/> </exec> <echo>aapt.signed ${m.aapt.apkbasename}: packaging</echo> |