Jeff Gaston | c58f315 | 2021-04-09 12:45:53 -0400 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | set -e |
| 3 | |
| 4 | echo "Starting $0 at $(date)" |
| 5 | |
| 6 | cd "$(dirname $0)" |
| 7 | |
| 8 | CHECKOUT_DIR="$(cd ../../.. && pwd)" |
| 9 | OUT_DIR="$CHECKOUT_DIR/out" |
| 10 | if [ "$DIST_DIR" == "" ]; then |
| 11 | DIST_DIR="$OUT_DIR/dist" |
| 12 | fi |
Jeff Gaston | e18bf2a | 2021-05-11 12:31:42 -0400 | [diff] [blame] | 13 | # 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 |
| 14 | export OUT_DIR="$OUT_DIR/incremental" |
| 15 | mkdir -p "$OUT_DIR" |
| 16 | export DIST_DIR="$DIST_DIR/incremental" |
| 17 | mkdir -p "$DIST_DIR" |
Jeff Gaston | c58f315 | 2021-04-09 12:45:53 -0400 | [diff] [blame] | 18 | |
| 19 | function 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 | } |
| 30 | hashOutDir |
| 31 | |
| 32 | # Run Gradle |
| 33 | impl/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 |
| 37 | impl/parse_profile_htmls.sh |
| 38 | |
| 39 | echo "Completing $0 at $(date)" |