-
-
Notifications
You must be signed in to change notification settings - Fork 646
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the Android SDK to the linux CI and turn on Android tests.
This installs and caches the Android SDK on linux CI runs. The debug.keystore used to be installed along with the SDK - but I had to recreate it for the CI. That directory is cached so it should only run once or if a layer changes. The Android tests will now be run in the contrib shard. In 3531 I maintained the '-a' flag as a way to skip running Android tests, even now that it is moved to contrib. I did that because since the OSX CI is not container based it would have to redownload the entire SDK each run. So Android tests (and the install-android-sdk script) are only being run on the Linux CI. Testing Done: This is all that is left to land: A travis run with just the RB passed at: https://travis-ci.org/pantsbuild/pants/builds/116972583 Bugs closed: 10, 937, 2993, 3006, 3012 Reviewed at https://rbcommons.com/s/twitter/r/3538/
- Loading branch information
Showing
2 changed files
with
61 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/usr/bin/env bash | ||
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
# Install the Android SDK for the Pants Android contrib module. | ||
|
||
# SDK_INSTALL_LOCATION and ANDROID_HOME set in travis.yaml. | ||
ANDROID_SDK_URL="http://dl.google.com/android/android-sdk_r24.4.1-linux.tgz" | ||
SDK_FILE=$(basename "$ANDROID_SDK_URL") | ||
|
||
# The debug.keystore has a well-known definition and location. | ||
KEYSTORE_LOCATION="$HOME"/.android | ||
|
||
# Add SDKs as needed. | ||
declare -a SDK_MODULES=(android-19 \ | ||
android-20 \ | ||
android-21 \ | ||
android-22 \ | ||
build-tools-19.1.0 \ | ||
extra-android-support \ | ||
extra-google-m2repository \ | ||
extra-android-m2repository \ | ||
platform-tools) | ||
|
||
mkdir -p "$SDK_INSTALL_LOCATION" | ||
mkdir -p "$KEYSTORE_LOCATION" | ||
|
||
|
||
function join { local IFS="$1"; shift; echo "$*"; } | ||
MODULE_LIST=$(join , ${SDK_MODULES[@]}) | ||
|
||
echo "Downloading $ANDROID_SDK_URL..." | ||
SDK_ARCHIVE_LOCATION="$SDK_INSTALL_LOCATION"/"$SDK_FILE" | ||
|
||
wget -nc "$ANDROID_SDK_URL" -O "$SDK_ARCHIVE_LOCATION" | ||
tar -C "$SDK_INSTALL_LOCATION" -xf "$SDK_ARCHIVE_LOCATION" | ||
|
||
# Spamming 'y' was failing non-deterministically so sleep between echos. | ||
( sleep 5 && while [ 1 ]; do sleep 1; echo y; done ) | \ | ||
"$ANDROID_HOME"/tools/android update sdk -u --all --filter "$MODULE_LIST" | ||
|
||
# Generate well known debug.keystore if the SDK hasn't created it. | ||
DEBUG_KEYSTORE="$KEYSTORE_LOCATION"/debug.keystore | ||
if [[ ! -f "$DEBUG_KEYSTORE" ]]; then | ||
keytool -genkey -v -keystore "$KEYSTORE_LOCATION"/debug.keystore -alias androiddebugkey -storepass android \ | ||
-keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "CN=Android Debug,O=Android,C=US" | ||
fi |