Skip to content

Commit

Permalink
Properly fix license issue in CircleCI (facebook#362)
Browse files Browse the repository at this point in the history
Summary:
Apparently this seems to be the only way to make build work, with the updated licenses. It also follows the same strategy as Travis.

I am using double pipe in `sdkmanager` command execution, to avoid breaking the build, because `sdkmanager` returns exit code 141 in case it meets the requirements requested. (e.g.: `yes | sdkmanager --licenses` returns 141, which in turn breaks the build due to `set -eo pipefail` Bash flags, that CircleCI is using in order to execute any scripts)

For the record, I tried the following solutions, that did not work:
* Add accepted license SHA in Android SDK licenses folder.
* Accept all licenses prior to running the other jobs (with a separate job, working as a dependency to the rest of the Workflow jobs) (`yes | sdkmanager --licenses`)
* Accept all licenses prior to executing any Gradle command (without a separate job) (`yes | sdkmanager --licenses`)
Pull Request resolved: facebook#362

Differential Revision: D13817430

Pulled By: passy

fbshipit-source-id: d8c95fc5b9202306dd50ea103b6e90142e73ef61
  • Loading branch information
pavlospt authored and facebook-github-bot committed Jan 25, 2019
1 parent fb2edd3 commit b8dbbb0
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,6 @@ executors:
TERM: 'dumb'

jobs:
add_accepted_android_sdk_license:
executor: default-executor
docker:
- image: circleci/android:api-28-ndk-r17b
steps:
- run:
name: Add accepted Android SDK license
command: |
mkdir -p "$ANDROID_HOME/licenses/"
echo > "$ANDROID_HOME/licenses/android-sdk-license"
echo -n 24333f8a63b6825ea9c5514f83c2829b004d1fee > "$ANDROID_HOME/licenses/android-sdk-license"
snapshot:
executor: default-executor
docker:
Expand All @@ -28,7 +17,9 @@ jobs:
- checkout
- run:
name: build and deploy
command: ./gradlew :android:assembleRelease && scripts/publish-android-snapshot.sh
command: |
yes | sdkmanager "platforms;android-27" || true
./gradlew :android:assembleRelease && scripts/publish-android-snapshot.sh
release:
executor: default-executor
Expand All @@ -38,13 +29,14 @@ jobs:
- checkout
- run:
name: build and deploy
command: ./gradlew :android:assembleRelease && scripts/publish-android-release.sh
command: |
yes | sdkmanager "platforms;android-27" || true
./gradlew :android:assembleRelease && scripts/publish-android-release.sh
workflows:
version: 2
build-and-deploy:
jobs:
- add_accepted_android_sdk_license
- snapshot:
filters:
branches:
Expand Down

0 comments on commit b8dbbb0

Please sign in to comment.