Update android sdk build tools

Update the android sdk build tools from 27.0.3 to 28.0.1, bringing
in d8 which is replacing dx.

This needs an update of the Docker image, so run scripts/update-docker.sh
to update it.
This commit is contained in:
Fredrik Fornwall 2018-07-26 12:21:43 +02:00
parent 8025f606e9
commit 047754e8fa
8 changed files with 59 additions and 23 deletions

View File

@ -259,7 +259,7 @@ termux_step_setup_variables() {
: "${TERMUX_ANDROID_HOME:="/data/data/com.termux/files/home"}"
: "${TERMUX_DEBUG:=""}"
: "${TERMUX_PKG_API_LEVEL:="21"}"
: "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="27.0.3"}"
: "${TERMUX_ANDROID_BUILD_TOOLS_VERSION:="28.0.1"}"
: "${TERMUX_NDK_VERSION:="17"}"
if [ "x86_64" = "$TERMUX_ARCH" ] || [ "aarch64" = "$TERMUX_ARCH" ]; then
@ -284,7 +284,7 @@ termux_step_setup_variables() {
# We do not put all of build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/ into PATH
# to avoid stuff like arm-linux-androideabi-ld there to conflict with ones from
# the standalone toolchain.
TERMUX_DX=$ANDROID_HOME/build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/dx
TERMUX_D8=$ANDROID_HOME/build-tools/$TERMUX_ANDROID_BUILD_TOOLS_VERSION/d8
TERMUX_COMMON_CACHEDIR="$TERMUX_TOPDIR/_cache"
TERMUX_DEBDIR="$TERMUX_SCRIPTDIR/debs"

View File

@ -1,6 +1,7 @@
TERMUX_PKG_HOMEPAGE=https://github.com/fornwall/apksigner
TERMUX_PKG_DESCRIPTION="APK signing tool"
TERMUX_PKG_VERSION=0.7
TERMUX_PKG_REVISION=1
TERMUX_PKG_SHA256=340560c4f75af3501f037452bcf184fa48fd18bc877a4cce9a51a3fa047b4b38
TERMUX_PKG_SRCURL=https://github.com/fornwall/apksigner/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_BUILD_IN_SRC=yes
@ -9,11 +10,21 @@ TERMUX_PKG_PLATFORM_INDEPENDENT=true
termux_step_make () {
mkdir -p $TERMUX_PREFIX/share/{dex,man/man1}
./gradlew
$TERMUX_DX --dex --output $TERMUX_PREFIX/share/dex/apksigner.dex ./build/libs/src-all.jar
echo '#!/bin/sh' > $TERMUX_PREFIX/bin/apksigner
echo "dalvikvm -cp $TERMUX_PREFIX/share/dex/apksigner.dex net.fornwall.apksigner.Main \$@" >> $TERMUX_PREFIX/bin/apksigner
chmod +x $TERMUX_PREFIX/bin/apksigner
cp apksigner.1 $TERMUX_PREFIX/share/man/man1/
./gradlew
$TERMUX_D8 \
--classpath $ANDROID_HOME/platforms/android-$TERMUX_PKG_API_LEVEL/android.jar \
--release \
--min-api $TERMUX_PKG_API_LEVEL \
--output $TERMUX_PKG_TMPDIR \
./build/libs/src-all.jar
cd $TERMUX_PKG_TMPDIR
jar cf apksigner.jar classes.dex
mv apksigner.jar $TERMUX_PREFIX/share/dex/apksigner.jar
echo '#!/bin/sh' > $TERMUX_PREFIX/bin/apksigner
echo "dalvikvm -cp $TERMUX_PREFIX/share/dex/apksigner.jar net.fornwall.apksigner.Main \$@" >> $TERMUX_PREFIX/bin/apksigner
chmod +x $TERMUX_PREFIX/bin/apksigner
}

View File

@ -20,10 +20,16 @@ termux_step_make_install () {
# Dex the rewritten jar file:
mkdir -p $TERMUX_PREFIX/share/dex
$TERMUX_DX --dex \
--output $TERMUX_PREFIX/share/dex/dx.dex \
$TERMUX_D8 \
--release \
--min-api 21 \
--output $TERMUX_PKG_TMPDIR \
$REWRITTEN_DX
cd $TERMUX_PKG_TMPDIR
jar cf dx.jar classes.dex
mv dx.jar $TERMUX_PREFIX/share/dex/dx.jar
install $TERMUX_PKG_BUILDER_DIR/dx $TERMUX_PREFIX/bin/dx
perl -p -i -e "s%\@TERMUX_PREFIX\@%${TERMUX_PREFIX}%g" $TERMUX_PREFIX/bin/dx
}

View File

@ -2,5 +2,5 @@
exec dalvikvm \
-Xmx256m \
-cp @TERMUX_PREFIX@/share/dex/dx.dex \
-cp @TERMUX_PREFIX@/share/dex/dx.jar \
dx.dx.command.Main $@

View File

@ -4,6 +4,7 @@ TERMUX_PKG_VERSION=4.6.2
_date=201611241400
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=http://eclipse.mirror.wearetriple.com/eclipse/downloads/drops${TERMUX_PKG_VERSION:0:1}/R-${TERMUX_PKG_VERSION}-${_date}/ecj-${TERMUX_PKG_VERSION}.jar
# http://www.eclipse.org/downloads/download.php?file=/eclipse/downloads/drops4/R-4.7.2-201711300510/ecj-4.7.2.jar
TERMUX_PKG_SHA256=9953dc2be829732e1b939106a71de018f660891220dbca559a5c7bff84883e51
TERMUX_PKG_PLATFORM_INDEPENDENT=true
@ -12,19 +13,37 @@ termux_step_extract_package () {
}
termux_step_make () {
RAW_JAR=$TERMUX_PKG_CACHEDIR/ecj-${TERMUX_PKG_VERSION}.jar
if [ ! -f $RAW_JAR ]; then
termux_download $TERMUX_PKG_SRCURL $RAW_JAR \
$TERMUX_PKG_SHA256
fi
local RAW_JAR=$TERMUX_PKG_CACHEDIR/ecj-${TERMUX_PKG_VERSION}.jar
termux_download $TERMUX_PKG_SRCURL \
$RAW_JAR \
$TERMUX_PKG_SHA256
mkdir -p $TERMUX_PREFIX/share/{dex,java}
$TERMUX_DX \
--dex \
--output=$TERMUX_PREFIX/share/dex/ecj.jar \
mkdir -p $TERMUX_PREFIX/share/{dex,java}
$TERMUX_D8 \
--release \
--min-api 21 \
--output $TERMUX_PKG_TMPDIR \
$RAW_JAR
# Package classes.dex into jar:
cd $TERMUX_PKG_TMPDIR
jar cf ecj.jar classes.dex
# Add needed properties file to jar file:
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/batch/messages.properties
jar uf ecj.jar org/eclipse/jdt/internal/compiler/batch/messages.properties
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/problem/messages.properties
jar uf ecj.jar org/eclipse/jdt/internal/compiler/problem/messages.properties
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/messages.properties
jar uf ecj.jar org/eclipse/jdt/internal/compiler/messages.properties
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/readableNames.props
jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/readableNames.props
for i in `seq 1 24`; do
jar xf $RAW_JAR org/eclipse/jdt/internal/compiler/parser/parser$i.rsc
jar uf ecj.jar org/eclipse/jdt/internal/compiler/parser/parser$i.rsc
done
# Move into place:
mv ecj.jar $TERMUX_PREFIX/share/dex/ecj.jar
rm -rf android-jar
mkdir android-jar
cd android-jar

View File

@ -35,7 +35,7 @@ check_package() { # path
export TERMUX_ARCH=aarch64
export TERMUX_NDK_VERSION=17
TERMUX_ANDROID_BUILD_TOOLS_VERSION=27.0.3
TERMUX_ANDROID_BUILD_TOOLS_VERSION=28.0.1
echo '['

View File

@ -6,7 +6,7 @@ check_package() { # path
TERMUX_PKG_REVISION=0
TERMUX_ARCH=aarch64
TERMUX_NDK_VERSION=17
TERMUX_ANDROID_BUILD_TOOLS_VERSION=27.0.3
TERMUX_ANDROID_BUILD_TOOLS_VERSION=28.0.1
. $path/build.sh
if [ "$TERMUX_PKG_REVISION" != "0" ] || [ "$TERMUX_PKG_VERSION" != "${TERMUX_PKG_VERSION/-/}" ]; then
TERMUX_PKG_VERSION+="-$TERMUX_PKG_REVISION"

View File

@ -38,4 +38,4 @@ fi
yes | $ANDROID_HOME/tools/bin/sdkmanager --licenses
# The android-21 platform is used in the ecj package:
$ANDROID_HOME/tools/bin/sdkmanager "build-tools;27.0.3" "platforms;android-27" "platforms;android-21"
$ANDROID_HOME/tools/bin/sdkmanager "build-tools;28.0.1" "platforms;android-27" "platforms;android-21"