Update Android packages cache key

Summary:
Packages are now defined in `scripts/.tests.env`, so the checksum is updated accordingly.

We also throw away the cache if the checksum fails as not doing so may prevent us from picking up new packages due to the filesystem check in `scripts/android-setup.sh`#getAndroidPackages(), as the presence of the `installed-dependencies` file restored from cache will incorrectly flag all deps as being installed.
Closes https://github.com/facebook/react-native/pull/19298

Differential Revision: D8025918

Pulled By: hramos

fbshipit-source-id: 189492baac2fea39280884ea20e376a368e23c2e
This commit is contained in:
Héctor Ramos 2018-05-16 08:49:57 -07:00 committed by Facebook Github Bot
parent 48dccf18b8
commit 8c74864d7b
3 changed files with 8 additions and 6 deletions

View File

@ -22,12 +22,11 @@ aliases:
- &restore-cache-android-packages - &restore-cache-android-packages
keys: keys:
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/android-setup.sh" }} - v1-android-sdkmanager-packages-api-26-alpha-{{ checksum "scripts/.tests.env" }}
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-
- &save-cache-android-packages - &save-cache-android-packages
paths: paths:
- /opt/android/sdk - /opt/android/sdk
key: v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/android-setup.sh" }} key: v1-android-sdkmanager-packages-api-26-alpha-{{ checksum "scripts/.tests.env" }}
- &restore-cache-gradle - &restore-cache-gradle
keys: keys:

View File

@ -7,6 +7,8 @@
export ANDROID_SDK_BUILD_TOOLS_REVISION=26.0.3 export ANDROID_SDK_BUILD_TOOLS_REVISION=26.0.3
# Android API Level we build with # Android API Level we build with
export ANDROID_SDK_BUILD_API_LEVEL="26" export ANDROID_SDK_BUILD_API_LEVEL="26"
# Google APIs for Android level
export ANDROID_GOOGLE_API_LEVEL="23"
# Minimum Android API Level we target # Minimum Android API Level we target
export ANDROID_SDK_TARGET_API_LEVEL="19" export ANDROID_SDK_TARGET_API_LEVEL="19"
# Android Virtual Device name # Android Virtual Device name

View File

@ -16,9 +16,10 @@ function getAndroidPackages {
echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..." echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..."
sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL" sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..." echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..."
sdkmanager "build-tools;android-$ANDROID_SDK_BUILD_TOOLS_REVISION" sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
echo "Installing Google APIs for Android API level $ANDROID_SDK_BUILD_API_LEVEL..." # These moved to "system-images;android-$ANDROID_SDK_BUILD_API_LEVEL;google_apis;x86" starting with API level 25, but there is no ARM version.
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_SDK_BUILD_API_LEVEL" echo "Installing Google APIs $ANDROID_GOOGLE_API_LEVEL..."
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_GOOGLE_API_LEVEL"
echo "Installing Android Support Repository" echo "Installing Android Support Repository"
sdkmanager "extras;android;m2repository" sdkmanager "extras;android;m2repository"
$CI && touch $DEPS $CI && touch $DEPS