blob: 11c73b8d21e5b2b207cc2545bca4378ca0a15d2a [file] [log] [blame]
#!/usr/bin/env bash
#
set -x
# generate_patches.sh [systems]
#
# Convenience script to generate patches for JsInterop under Dartium. Do not call from build steps or tests
# - call fremontcutbuilder and dartdomgenerator instead. Do not add 'real'
# functionality here - change the python code instead.
#
# I find it essential to generate all the systems so I know if I am breaking
# other systems. My habit is to run:
#
# ./go.sh
#
# 1. After running go.sh libraries in sdk/lib may change.
# 2. Build Dartium.
# 3. Run this script and sdk/lib/js/dartium/cached_patches will be created.
# 4. Rebuild Dartium.
# 5. Commit files in sdk/lib
#
# NOTE: If the Dart files generated from the IDLs may cause major changes which
# could cause the patch files to fail (missing classes, etc). If this
# happens delete the contents of the sdk/lib/js/dartium/cached_patches.dart
# build Dartium, run this script and build Dartium again with the newly
# generated patches.
if [[ "$1" != "" ]] ; then
DARTIUM="$1"
else
LOCATION_DARTIUM="../../../out/Release"
DARTIUM="$LOCATION_DARTIUM"
fi
DART_APP_LOCATION="file://"$PWD"/generate_app/generate_cached_patches.html"
DARTIUM_ARGS=" --user-data-dir=out --disable-web-security --no-sandbox --enable-blink-features=dartGenCachedPatches"
CACHED_PATCHES_FILE=""$PWD"/../../sdk/lib/js/dartium/cached_patches.dart"
cmd=""$DARTIUM"/chrome "$DARTIUM_ARGS" "$DART_APP_LOCATION" |
(sed -n '/START_OF_CACHED_PATCHES/,/END_OF_CACHED_PATCHES/p') > "$CACHED_PATCHES_FILE""
reset && eval "${cmd}"