1#!/bin/bash 2 3set -e 4 5DIR=$(mktemp -d out/perfetto.XXXXXX) 6 7function cleanup { 8 rm -rf "$DIR" 9 echo "Deleted temp working directory $DIR" 10} 11 12#trap cleanup EXIT 13 14function is_mac { 15 ! test -d /proc 16 return $? 17} 18 19tools/gn gen $DIR --args='is_clang=true is_debug=false' 20tools/ninja -C $DIR trace_to_text 21 22if which shasum; then 23 NEW_SHA=$(shasum $DIR/trace_to_text | cut -f1 -d' ') # Mac OS 24else 25 NEW_SHA=$(sha1sum $DIR/trace_to_text | cut -f1 -d' ') # Linux 26fi 27 28if is_mac; then 29 platform=mac 30else 31 platform=linux 32fi 33 34name=trace_to_text-$platform-$NEW_SHA 35 36gsutil cp $DIR/trace_to_text gs://perfetto/$name 37gsutil cp $DIR/trace_to_text gs://chromium-telemetry/binary_dependencies/$name 38gsutil acl ch -u AllUsers:R gs://perfetto/$name 39gsutil acl ch -u AllUsers:R gs://chromium-telemetry/binary_dependencies/$name 40 41echo 'Now run the following command to update tools/traceconv:' 42echo "sed \"s/'$platform': '[^']*',/'$platform': '$NEW_SHA',/\" --in-place tools/traceconv" 43 44