Upgrade dependencies and build system

This commit switches to use official Google NDK version 16 with packages
created/installed using android-crew-staging tool derived from CrystaX
project.

Change-Id: I248fef2a871e44375512dcbf15a5f3166c0ab5de
diff --git a/.jenkins.d/00-deps.sh b/.jenkins.d/00-deps.sh
index 056626b..1673813 100755
--- a/.jenkins.d/00-deps.sh
+++ b/.jenkins.d/00-deps.sh
@@ -2,9 +2,5 @@
 set -e
 set -x
 
-echo -en 'travis_fold:start:deps\r'
-
-sudo apt-get install -y build-essential git openjdk-7-jdk unzip
+sudo apt-get install -y build-essential git openjdk-8-jdk unzip ruby ruby-rugged
 sudo apt-get install -y lib32stdc++6 lib32z1 lib32z1-dev
-
-echo -en 'travis_fold:end:deps\r'
diff --git a/.jenkins.d/10-get-ndk.sh b/.jenkins.d/10-get-ndk.sh
deleted file mode 100755
index c1cfe24..0000000
--- a/.jenkins.d/10-get-ndk.sh
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env bash
-set -e
-set -x
-
-CRYSTAX_NDK_VERSION=10.3.1
-
-URL=https://www.crystax.net/download/
-NDK=crystax-ndk-$CRYSTAX_NDK_VERSION
-
-NDK_FILE="$NDK-linux-x86_64.tar.xz"
-
-if [ ! -f downloads/$NDK_FILE ]; then
-    mkdir downloads || true
-    cd downloads
-    wget --no-check-certificate $URL$NDK_FILE
-    cd ..
-fi
-
-if [ ! -d $NDK ]; then
-    export XZ_DEFAULTS=--memlimit=300MiB
-    echo -en 'travis_fold:start:NDK\r'
-
-    # To save space
-    EXCLUDES="toolchains/*-clang3.6 toolchains/*-3.6 \
-            toolchains/*-clang3.7 \
-            toolchains/*-3.7 \
-            toolchains/*-4.9 \
-            sources/cxx-stl/gabi++ \
-            sources/cxx-stl/llvm-libc++ \
-            sources/cxx-stl/llvm-libc++abi \
-            sources/cxx-stl/stlport \
-            sources/cxx-stl/llvm-libc++ \
-            sources/cxx-stl/gnu-libstdc++/4.9 \
-            sources/icu \
-            sources/boost/*/libs/*/gnu-4.9 \
-            sources/boost/*/libs/*/llvm-3.6 \
-            sources/boost/*/libs/*/llvm-3.7 \
-            sources/objc \
-            sources/python"
-
-    pv -f downloads/$NDK_FILE | tar xJf - $(for i in $EXCLUDES; do echo "--exclude $i"; done | xargs)
-    echo -en 'travis_fold:end:NDK\r'
-fi
-
-echo ndk.dir=`pwd`/$NDK >> local.properties
-
-cd crystax-ndk-$CRYSTAX_NDK_VERSION/sources
-curl -L -o openssl.tar.gz https://github.com/named-data-mobile/crystax-prebuilt-openssl/archive/crystax-$CRYSTAX_NDK_VERSION.tar.gz
-tar zx --strip-components 1 -C openssl -f openssl.tar.gz
-rm openssl.tar.gz
-cd ../..
diff --git a/.jenkins.d/10-get-sdk.sh b/.jenkins.d/10-get-sdk.sh
index 87418ba..2780c32 100755
--- a/.jenkins.d/10-get-sdk.sh
+++ b/.jenkins.d/10-get-sdk.sh
@@ -2,22 +2,20 @@
 set -e
 set -x
 
-SDK_VERSION=24.4.1
-BUILD_TOOLS_VERSION=26.0.0
-COMPILE_SDK_VERSION=26
-
 SDK=android-sdk-linux
 
-export ANDROID_HOME=`pwd`/$SDK
-export PATH=${PATH}:${ANDROID_HOME}/tools:${ANDROID_HOME}/platform-tools
+mkdir -p $SDK
+cd $SDK
+wget -q https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip
+unzip sdk-tools-linux-3859397.zip
+rm sdk-tools-linux-3859397.zip
 
-if [ ! -d $SDK ]; then
-    wget -nv http://dl.google.com/android/android-sdk_r$SDK_VERSION-linux.tgz
-    tar zxf android-sdk_r$SDK_VERSION-linux.tgz
-    rm android-sdk_r$SDK_VERSION-linux.tgz
+export ANDROID_HOME=`pwd`
+export PATH=${PATH}:${ANDROID_HOME}/tools/bin:${ANDROID_HOME}/platform-tools
 
-    echo "y" | android update sdk --filter platform-tools,build-tools-$BUILD_TOOLS_VERSION,android-$COMPILE_SDK_VERSION,extra-android-support,extra-android-m2repository,extra-google-m2repository --no-ui --all --force
-    echo "y" | android update sdk --filter "android-19" --no-ui --all --force
-fi
+echo "y" | sdkmanager "platform-tools"
+sdkmanager "platforms;android-26" "build-tools;26.0.3"
+
+cd ..
 
 echo sdk.dir=`pwd`/$SDK >> local.properties
diff --git a/.jenkins.d/20-get-ndk.sh b/.jenkins.d/20-get-ndk.sh
new file mode 100755
index 0000000..6548c94
--- /dev/null
+++ b/.jenkins.d/20-get-ndk.sh
@@ -0,0 +1,26 @@
+#!/usr/bin/env bash
+set -e
+set -x
+
+android-sdk-linux/tools/bin/sdkmanager "ndk-bundle"
+git clone https://github.com/cawka/android-crew-staging.git android-sdk-linux/ndk-bundle/crew.dir
+
+if [[ ! -z $GEM_PATH ]]; then
+    # Hack for unset GEM_PATH in crew tool
+    ORIG_RUBY=`which ruby`
+    echo '#!/usr/bin/env bash' > ruby
+    echo "export GEM_HOME=$GEM_HOME" >> ruby
+    echo "export GEM_PATH=$GEM_PATH" >> ruby
+    echo "exec $ORIG_RUBY \$@" >> ruby
+    chmod 755 ruby
+
+    export CREW_TOOLS_DIR=`pwd`
+    export PATH=`pwd`:$PATH
+fi
+
+export CREW_OWNER=cawka
+# export CREW_DOWNLOAD_BASE=http://irl.cs.ucla.edu/~cawka/android-crew-staging/staging/
+
+android-sdk-linux/ndk-bundle/crew.dir/crew install target/sqlite:3.18.0 target/openssl:1.0.2m target/boost:1.65.1
+
+echo ndk.dir=`pwd`/android-sdk-linux/ndk-bundle >> local.properties