blob: 5ac9302ef690ec83deb3c71cf4d7fab55d49b68b [file] [log] [blame]
Jeff Gaston8aa46b32018-09-27 16:14:14 -04001#!/bin/bash
2set -e
3cd $(dirname $0)
4
5echo "IF THIS SCRIPT FIXES YOUR BUILD; OPEN A BUG."
6echo "(in nearly all cases, it should not be necessary to run a clean build)."
7# one case where it is convenient to have a clean build is for double-checking that a build failure isn't due to an incremental build failure
8# another case where it is convenient to have a clean build is for performance testing
9# another case where it is convenient to have a clean build is when you're modifying the build and may have introduced some errors but haven't shared your changes yet (at which point you should have fixed the errors)
10echo
11
12goals="$@"
13
14function usage() {
15 echo "Usage: $0 <tasks>"
16 echo "Runs a clean build of <tasks>"
Jeff Gastonadffce42019-04-02 15:19:40 -040017 echo
18 echo "For example:"
19 echo
20 echo " $0 assembleDebug # or any other arguments you would normally give to ./gradlew"
Jeff Gaston8aa46b32018-09-27 16:14:14 -040021 exit 1
22}
23
24if [ "$goals" == "" ]; then
25 usage
26fi
27
28export OUT_DIR=../../out
29function removeCaches() {
George Mount34ddc312018-10-24 13:53:18 -070030 rm -rf .gradle
31 rm -rf buildSrc/.gradle
32 rm -rf buildSrc/build
Jeff Gaston8aa46b32018-09-27 16:14:14 -040033 rm -f local.properties
George Mount34ddc312018-10-24 13:53:18 -070034 rm -rf ../../out
Jeff Gaston8aa46b32018-09-27 16:14:14 -040035}
36removeCaches
37
38echo running build
39GRADLE_USER_HOME=../../out ./gradlew --no-daemon $goals