blob: b5d5079d29899513725c427aaaab24c30e249091 [file] [log] [blame]
Jeff Gastonc58f3152021-04-09 12:45:53 -04001#!/bin/bash
2set -e
3
4echo "Starting $0 at $(date)"
5
6cd "$(dirname $0)"
7
8CHECKOUT_DIR="$(cd ../../.. && pwd)"
9OUT_DIR="$CHECKOUT_DIR/out"
10if [ "$DIST_DIR" == "" ]; then
11 DIST_DIR="$OUT_DIR/dist"
12fi
Jeff Gastone18bf2a2021-05-11 12:31:42 -040013# move OUT_DIR and DIST_DIR into subdirectories so that if diagnose-build-failure deletes them, it doesn't interfere with any files generated by buildbot code
14export OUT_DIR="$OUT_DIR/incremental"
15mkdir -p "$OUT_DIR"
16export DIST_DIR="$DIST_DIR/incremental"
17mkdir -p "$DIST_DIR"
Jeff Gastonc58f3152021-04-09 12:45:53 -040018
19function hashOutDir() {
20 hashFile=out.hashes
21 echo "hashing out dir and saving into $DIST_DIR/$hashFile"
22 # We hash files in parallel for more performance (-P <number>)
23 # We limit the number of files hashed by any one process (-n <number>) to lower the risk of one
24 # process having to do much more work than the others.
25 # We do allow each process to hash multiple files (also -n <number>) to avoid spawning too many processes
26 # It would be nice to copy all files, but that takes a while
27 time (cd $OUT_DIR && find -type f | grep -v "$hashFile" | xargs --no-run-if-empty -P 32 -n 64 sha1sum > $DIST_DIR/$hashFile)
28 echo "done hashing out dir"
29}
30hashOutDir
31
32# Run Gradle
33impl/build.sh buildOnServer checkExternalLicenses listTaskOutputs validateAllProperties \
34 --profile "$@"
35
36# Parse performance profile reports (generated with the --profile option above) and re-export the metrics in an easily machine-readable format for tracking
37impl/parse_profile_htmls.sh
38
39echo "Completing $0 at $(date)"