Update SDK build tools to 24.0.1
[termux-packages] / packages / dx / build.sh
index 411b7a2..a225d13 100755 (executable)
@@ -1,15 +1,22 @@
 TERMUX_PKG_HOMEPAGE=http://developer.android.com/tools/help/index.html
 TERMUX_PKG_DESCRIPTION="Command which takes in class files and reformulates them for usage on Android"
 TERMUX_PKG_VERSION=$TERMUX_ANDROID_BUILD_TOOLS_VERSION
-TERMUX_PKG_BUILD_REVISION=1
 TERMUX_PKG_PLATFORM_INDEPENDENT=true
 
 termux_step_make_install () {
+       # As of build tools 24 the dx tool is implemented using java 8, but
+       # as dx itself does not support java 8 (class file format 52)
+       # we go the .class -> jill -> jack route.
+       local DX_JACK=$TERMUX_PKG_TMPDIR/dx.jack
+       java -jar $TERMUX_JILL \
+               --output=$DX_JACK \
+               $ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar
+       java -jar $TERMUX_JACK \
+               --output-dex $TERMUX_PKG_TMPDIR \
+               --import $DX_JACK
+
         mkdir -p $TERMUX_PREFIX/share/dex
-        $TERMUX_DX \
-                --dex \
-                --output=$TERMUX_PREFIX/share/dex/dx.jar \
-                $ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar
+       mv $TERMUX_PKG_TMPDIR/classes.dex $TERMUX_PREFIX/share/dex/dx.dex
 
        install $TERMUX_PKG_BUILDER_DIR/dx $TERMUX_PREFIX/bin/dx
        perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/dx