Skip to content

Commit

Permalink
Update Android packages cache key
Browse files Browse the repository at this point in the history
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 facebook#19298

Differential Revision: D8025918

Pulled By: hramos

fbshipit-source-id: 189492baac2fea39280884ea20e376a368e23c2e
  • Loading branch information
hramos authored and facebook-github-bot committed May 16, 2018
1 parent 48dccf1 commit 8c74864
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 2 additions & 3 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,11 @@ aliases:

- &restore-cache-android-packages
keys:
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-{{ checksum "scripts/android-setup.sh" }}
- v1-android-sdkmanager-packages-{{ arch }}-api-26-alpha-
- v1-android-sdkmanager-packages-api-26-alpha-{{ checksum "scripts/.tests.env" }}
- &save-cache-android-packages
paths:
- /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
keys:
Expand Down
2 changes: 2 additions & 0 deletions scripts/.tests.env
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
export ANDROID_SDK_BUILD_TOOLS_REVISION=26.0.3
# Android API Level we build with
export ANDROID_SDK_BUILD_API_LEVEL="26"
# Google APIs for Android level
export ANDROID_GOOGLE_API_LEVEL="23"
# Minimum Android API Level we target
export ANDROID_SDK_TARGET_API_LEVEL="19"
# Android Virtual Device name
Expand Down
7 changes: 4 additions & 3 deletions scripts/android-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,10 @@ function getAndroidPackages {
echo "Installing target SDK for Android API level $ANDROID_SDK_TARGET_API_LEVEL..."
sdkmanager "platforms;android-$ANDROID_SDK_TARGET_API_LEVEL"
echo "Installing SDK build tools, revision $ANDROID_SDK_BUILD_TOOLS_REVISION..."
sdkmanager "build-tools;android-$ANDROID_SDK_BUILD_TOOLS_REVISION"
echo "Installing Google APIs for Android API level $ANDROID_SDK_BUILD_API_LEVEL..."
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_SDK_BUILD_API_LEVEL"
sdkmanager "build-tools;$ANDROID_SDK_BUILD_TOOLS_REVISION"
# 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.
echo "Installing Google APIs $ANDROID_GOOGLE_API_LEVEL..."
sdkmanager "add-ons;addon-google_apis-google-$ANDROID_GOOGLE_API_LEVEL"
echo "Installing Android Support Repository"
sdkmanager "extras;android;m2repository"
$CI && touch $DEPS
Expand Down

0 comments on commit 8c74864

Please sign in to comment.