xref: /aosp_15_r20/platform_testing/libraries/sts-common-util/autorepro/plugin/extract-and-gradle.sh (revision dd0948b35e70be4c0246aabd6c72554a5eb8b22a)
1#!/bin/bash
2
3# Because the build environment is not passed to this script, please `m autorepro`.
4
5# usage:
6# $ m autorepro && ./extract-and-gradle.sh *commands*
7
8# publish to local; useful for testing examples:
9# $ m autorepro && ./extract-and-gradle.sh publishToMavenLocal
10
11# build only:
12# $ m autorepro && ./extract-and-gradle.sh assemble
13
14# build and test:
15# $ m autorepro && ./extract-and-gradle.sh build
16
17# Exit on error
18set -e
19
20if [ -z "${ANDROID_HOST_OUT}" ]; then
21  echo "ANDROID_HOST_OUT is not set. Did you source and lunch?"
22  exit 1
23fi
24
25AUTOREPRO_OUT=/tmp/autorepro
26
27# Remove output directory.
28# This breaks incremental compile but in practice the difference is negligible.
29rm -rf $AUTOREPRO_OUT
30
31# -q quiet
32# -o overwrite without prompting
33# -d output directory
34unzip -q -o $ANDROID_HOST_OUT/autorepro/autorepro.zip -d $AUTOREPRO_OUT
35
36cd $AUTOREPRO_OUT
37./gradlew $@
38