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