1#!/bin/bash 2# 3# This script deploys/publishes a built AOSP Android jars to remote maven 4# 5# Usage: 6# deploy-android.sh <jar path> <android version> <robolectric version> 7# 8# For a tutorial check scripts/README.md 9 10set -ex 11 12function usage() { 13 echo "Usage: ${0} <artifact path> <android-version> <robolectric-sub-version>" 14} 15 16if [[ $# -ne 3 ]]; then 17 usage 18 exit 1 19fi 20 21ARTIFACT_PATH=$1 22ANDROID_VERSION=$2 23ROBOLECTRIC_SUB_VERSION=$3 24 25SCRIPT_DIR=$(cd $(dirname "$0"); pwd) 26 27ROBOLECTRIC_VERSION=${ANDROID_VERSION}-robolectric-${ROBOLECTRIC_SUB_VERSION} 28 29# Final artifact names 30ANDROID_ALL=android-all-${ROBOLECTRIC_VERSION}.jar 31ANDROID_ALL_POM=android-all-${ROBOLECTRIC_VERSION}.pom 32ANDROID_ALL_SRC=android-all-${ROBOLECTRIC_VERSION}-sources.jar 33ANDROID_ALL_DOC=android-all-${ROBOLECTRIC_VERSION}-javadoc.jar 34ANDROID_BUNDLE=android-all-${ROBOLECTRIC_VERSION}-bundle.jar 35 36 37mavenize() { 38 local FILE_NAME_BASE=android-all-${ROBOLECTRIC_VERSION} 39 mvn deploy:deploy-file \ 40 -Dfile=${ARTIFACT_PATH}/${FILE_NAME_BASE}.jar \ 41 -DgroupId=org.robolectric \ 42 -DartifactId=android-all \ 43 -Dversion=${ROBOLECTRIC_VERSION} \ 44 -Dpackaging=jar 45 46 mvn deploy:deploy-file \ 47 -Dfile=${ARTIFACT_PATH}/${FILE_NAME_BASE}-sources.jar \ 48 -DgroupId=org.robolectric \ 49 -DartifactId=android-all \ 50 -Dversion=${ROBOLECTRIC_VERSION} \ 51 -Dpackaging=jar \ 52 -Dclassifier=sources 53 54 mvn deploy:deploy-file \ 55 -Dfile=${ARTIFACT_PATH}/${FILE_NAME_BASE}-javadoc.jar \ 56 -DgroupId=org.robolectric \ 57 -DartifactId=android-all \ 58 -Dversion=${ROBOLECTRIC_VERSION} \ 59 -Dpackaging=jar \ 60 -Dclassifier=javadoc 61} 62 63mavenize 64 65echo "DONE!!" 66