|
44 | 44 | ninja -C $HOST_DEBUG_UNOPT_DIR |
45 | 45 | fi |
46 | 46 |
|
47 | | -# Invalidate cache if: |
48 | | -# * SNAPSHOT_PATH is not a file, or |
49 | | -# * STAMP_PATH is not a file with nonzero size, or |
50 | | -# * Contents of STAMP_PATH is not our local git HEAD revision, or |
51 | | -# * pubspec.yaml last modified after pubspec.lock |
52 | | -# |
53 | | -# To force invalidate the cache run `felt clean` or `rm .dart_tool/felt.shapshot.stamp` |
54 | | -if [[ ! -f $SNAPSHOT_PATH || ! -s "$STAMP_PATH" || "$(cat "$STAMP_PATH")" != "$REVISION" || "$WEB_UI_DIR/pubspec.yaml" -nt "$WEB_UI_DIR/pubspec.lock" ]]; then |
55 | | - echo "Snapshotting the felt tool for faster subsequent runs." |
| 47 | +install_deps() { |
56 | 48 | echo "Running \`pub get\` in 'engine/src/flutter/lib/web_ui'" |
57 | 49 | (cd "$WEB_UI_DIR"; $DART_SDK_DIR/bin/pub get) |
58 | 50 |
|
59 | 51 | echo "Running \`pub get\` in 'engine/src/flutter/web_sdk/web_engine_tester'" |
60 | 52 | (cd "$FLUTTER_DIR/web_sdk/web_engine_tester"; $DART_SDK_DIR/bin/pub get) |
61 | | - mkdir -p $DART_TOOL_DIR |
| 53 | +} |
62 | 54 |
|
63 | | - "$DART_SDK_DIR/bin/dart" --snapshot="$SNAPSHOT_PATH" --packages="$WEB_UI_DIR/.packages" "$SCRIPT_PATH" |
64 | | - echo "$REVISION" > "$STAMP_PATH" |
| 55 | +if [[ "$FELT_USE_SNAPSHOT" == "false" || "$FELT_USE_SNAPSHOT" == "0" ]]; then |
| 56 | + echo "[Snapshot mode: off]" |
| 57 | + # Running without snapshot means there is high likelyhood of local changes. In |
| 58 | + # that case, let's clear the snapshot to avoid any surprises. |
| 59 | + rm -f "$SNAPSHOT_PATH" |
| 60 | + rm -f "$STAMP_PATH" |
| 61 | + install_deps |
| 62 | + $DART_SDK_DIR/bin/dart "$DEV_DIR/felt.dart" $@ |
| 63 | +else |
| 64 | + # Create a new snapshot if any of the following is true: |
| 65 | + # * SNAPSHOT_PATH is not a file, or |
| 66 | + # * STAMP_PATH is not a file with nonzero size, or |
| 67 | + # * Contents of STAMP_PATH is not our local git HEAD revision, or |
| 68 | + # * pubspec.yaml last modified after pubspec.lock |
| 69 | + if [[ ! -f $SNAPSHOT_PATH || ! -s "$STAMP_PATH" || "$(cat "$STAMP_PATH")" != "$REVISION" || "$WEB_UI_DIR/pubspec.yaml" -nt "$WEB_UI_DIR/pubspec.lock" ]]; then |
| 70 | + echo "[Snapshot mode: on] (creating a new snapshot)" |
| 71 | + install_deps |
| 72 | + mkdir -p $DART_TOOL_DIR |
| 73 | + |
| 74 | + "$DART_SDK_DIR/bin/dart" --snapshot="$SNAPSHOT_PATH" --packages="$WEB_UI_DIR/.packages" "$SCRIPT_PATH" |
| 75 | + echo "$REVISION" > "$STAMP_PATH" |
| 76 | + fi |
| 77 | + |
| 78 | + $DART_SDK_DIR/bin/dart --packages="$WEB_UI_DIR/.packages" "$SNAPSHOT_PATH" $@ |
65 | 79 | fi |
66 | 80 |
|
67 | | -$DART_SDK_DIR/bin/dart --packages="$WEB_UI_DIR/.packages" "$SNAPSHOT_PATH" $@ |
|
0 commit comments