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