Fix android build and enable snapshots

Summary:
Fix some long-standing issues with the android build on Travis (and elsewhere)
and enable automatic publishing of snapshots.

Reviewed By: emilsjolander

Differential Revision: D5044001

fbshipit-source-id: f00be07f33c8018573af0b98233068ebd93360b4
This commit is contained in:
Pascal Hartig
2017-05-11 03:39:09 -07:00
committed by Facebook Github Bot
parent 181101c92d
commit ffcd2cfc8a
4 changed files with 68 additions and 32 deletions

24
scripts/publish-snapshot.sh Executable file
View File

@@ -0,0 +1,24 @@
#!/usr/bin/env bash
#
# Deploy a SNAPSHOT JAR after every successful CI run To Sonatype.
#
set -e
BASEDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )"
IS_SNAPSHOT="$(grep 'VERSION_NAME=[0-9\.]\+-SNAPSHOT' "$BASEDIR/gradle.properties")"
if [ "$TRAVIS_REPO_SLUG" != "facebook/yoga" ]; then
echo >&2 "Skipping repository. Expected project to be 'facebook/yoga', but was '$TRAVIS_REPO_SLUG'."
exit
elif [ "$TRAVIS_BRANCH" != "master" ]; then
echo >&2 "Skipping build. Expected branch name to be 'master', but was '$TRAVIS_BRANCH'."
exit
elif [ "$TRAVIS_PULL_REQUEST" != "false" ]; then
echo >&2 "Skipping build. Only considering non-PR builds, but URL was '$TRAVIS_PULL_REQUEST'."
exit
elif [ "$IS_SNAPSHOT" == "" ]; then
echo >&2 "Skipping build. Given build doesn't appear to be a SNAPSHOT release."
else
env TERMINAL=dumb "$BASEDIR/gradlew" uploadArchives
fi