blob: a5a0e8e306a8393b15fbeba3c97199df6d2588e4 [file] [log] [blame]
# This script requires the use of `gsed`. If you do not have this installed, please run
# `brew install gnu-sed` from your Mac. This script will take several minutes to complete,
# and for that reason it should be ran once per quarter instead of once per montly release.
# We can update the Perfetto UI code as needed as critical commits or bug fixes are landed.
# Contains a path to this script, relative to the directory it was called from.
# The directory that this script is located in.
# The devtools root directory is assumed to be the parent of this directory.
pushd $DEVTOOLS_DIR/third_party/packages/perfetto_ui_compiled/lib
echo "UPDATE_PERFETTO: Moving DevTools-Perfetto integration files to a temp directory"
mkdir _tmp
mv dist/devtools/* _tmp/
echo "UPDATE_PERFETTO: Deleting existing Perfetto build"
rm -rf dist/
# Example usage: ./ -b /Users/me/path/to/perfetto/out/ui/ui/dist
if [[ $1 = '-b' ]]; then
echo "UPDATE_PERFETTO: Using Perfetto build from $2"
cp -R $2 ./
echo "UPDATE_PERFETTO: Cloning Perfetto from HEAD"
mkdir _perfetto
cd _perfetto
git clone
cd perfetto
echo "UPDATE_PERFETTO: Installing build deps and building the Perfetto UI"
tools/install-build-deps --ui
cp -R out/ui/ui/dist ../../
cd ../../
echo "UPDATE_PERFETTO: Deleting unnecessary js source map files"
find ./ -name '*' -exec rm {} \;
echo "UPDATE_PERFETTO: Deleting unnecessary Catapult files"
find ./ -name 'traceconv.wasm' -exec rm {} \;
find ./ -name 'traceconv_bundle.js' -exec rm {} \;
find ./ -name 'catapult_trace_viewer.*' -exec rm {} \;
echo "UPDATE_PERFETTO: Deleting unnecessary PNG files"
find ./ -name 'rec_*.png' -exec rm {} \;
echo "UPDATE_PERFETTO: Moving DevTools-Perfetto integration files back from _tmp/"
mkdir dist/devtools
mv _tmp/* dist/devtools/
echo "UPDATE_PERFETTO: Updating index.html headers to include DevTools-Perfetto integration files"
gsed -i "s/<\/head>/ <link id=\"devtools-style\" rel=\"stylesheet\" href=\"devtools\/devtools_dark.css\">\n<\/head>/g" dist/index.html
gsed -i "s/<\/head>/ <script src=\"devtools\/devtools_theme_handler.js\"><\/script>\n<\/head>/g" dist/index.html
echo "UPDATE_PERFETTO: Cleaning up temporary directories"
rm -rf _tmp
rm -rf _perfetto
# TODO(kenz): we should verify that every file name under dist/ is included in devtools_app/pubspec.yaml until
# is resolved.
# Verify that all the perfetto assets are included in the devtools_app pubspec.yaml, and that the assets
# paths are updated to the new version number.
dart ./tool/update_perfetto_assets.dart