Browse Source

dx: Rewrite classes to not be under com.android

Fixes #1801.
android-5
Fredrik Fornwall 7 years ago
parent
commit
56e3efbc26
  1. 18
      packages/dx/build.sh
  2. 2
      packages/dx/dx

18
packages/dx/build.sh

@ -1,13 +1,29 @@
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_REVISION=1
TERMUX_PKG_PLATFORM_INDEPENDENT=true
termux_step_make_install () {
# Rewrite packages to avoid using com.android.* classes which may clash with
# classes in the Android runtime on devices (see #1801):
local JARJAR=$TERMUX_PKG_CACHEDIR/jarjar.jar
local RULEFILE=$TERMUX_PKG_TMPDIR/jarjar-rule.txt
local REWRITTEN_DX=$TERMUX_PKG_TMPDIR/dx-rewritten.jar
termux_download \
http://central.maven.org/maven2/com/googlecode/jarjar/jarjar/1.3/jarjar-1.3.jar \
$JARJAR \
4225c8ee1bf3079c4b07c76fe03c3e28809a22204db6249c9417efa4f804b3a7
echo 'rule com.android.** dx.@1' > $RULEFILE
java -jar $JARJAR process $RULEFILE \
$ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar \
$REWRITTEN_DX
# Dex the rewritten jar file:
mkdir -p $TERMUX_PREFIX/share/dex
$TERMUX_DX --dex \
--output $TERMUX_PREFIX/share/dex/dx.dex \
$ANDROID_HOME/build-tools/${TERMUX_PKG_VERSION}/lib/dx.jar
$REWRITTEN_DX
install $TERMUX_PKG_BUILDER_DIR/dx $TERMUX_PREFIX/bin/dx
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/dx

2
packages/dx/dx

@ -3,4 +3,4 @@
exec dalvikvm \
-Xmx256m \
-cp @TERMUX_PREFIX@/share/dex/dx.dex \
com.android.dx.command.Main $@
dx.dx.command.Main $@

Loading…
Cancel
Save