-
Notifications
You must be signed in to change notification settings - Fork 6k
[web] Environment variable to disable felt snapshot #13187
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -44,24 +44,40 @@ then | |
| ninja -C $HOST_DEBUG_UNOPT_DIR | ||
| fi | ||
|
|
||
| # Invalidate cache if: | ||
| # * SNAPSHOT_PATH is not a file, or | ||
| # * STAMP_PATH is not a file with nonzero size, or | ||
| # * Contents of STAMP_PATH is not our local git HEAD revision, or | ||
| # * pubspec.yaml last modified after pubspec.lock | ||
| # | ||
| # To force invalidate the cache run `felt clean` or `rm .dart_tool/felt.shapshot.stamp` | ||
| if [[ ! -f $SNAPSHOT_PATH || ! -s "$STAMP_PATH" || "$(cat "$STAMP_PATH")" != "$REVISION" || "$WEB_UI_DIR/pubspec.yaml" -nt "$WEB_UI_DIR/pubspec.lock" ]]; then | ||
| echo "Snapshotting the felt tool for faster subsequent runs." | ||
| install_deps() { | ||
| echo "Running \`pub get\` in 'engine/src/flutter/lib/web_ui'" | ||
| (cd "$WEB_UI_DIR"; $DART_SDK_DIR/bin/pub get) | ||
|
|
||
| echo "Running \`pub get\` in 'engine/src/flutter/web_sdk/web_engine_tester'" | ||
| (cd "$FLUTTER_DIR/web_sdk/web_engine_tester"; $DART_SDK_DIR/bin/pub get) | ||
| mkdir -p $DART_TOOL_DIR | ||
| } | ||
|
|
||
| "$DART_SDK_DIR/bin/dart" --snapshot="$SNAPSHOT_PATH" --packages="$WEB_UI_DIR/.packages" "$SCRIPT_PATH" | ||
| echo "$REVISION" > "$STAMP_PATH" | ||
| if [[ "$FELT_USE_SNAPSHOT" == "false" || "$FELT_USE_SNAPSHOT" == "0" ]]; then | ||
| echo "[Snapshot mode: off]" | ||
| # Running without snapshot means there is high likelyhood of local changes. In | ||
| # that case, let's clear the snapshot to avoid any surprises. | ||
| rm -f "$SNAPSHOT_PATH" | ||
| rm -f "$STAMP_PATH" | ||
| install_deps | ||
| $DART_SDK_DIR/bin/dart "$DEV_DIR/felt.dart" $@ | ||
| else | ||
| # Create a new snapshot if any of the following is true: | ||
| # * SNAPSHOT_PATH is not a file, or | ||
| # * STAMP_PATH is not a file with nonzero size, or | ||
| # * Contents of STAMP_PATH is not our local git HEAD revision, or | ||
| # * pubspec.yaml last modified after pubspec.lock | ||
| if [[ ! -f $SNAPSHOT_PATH || ! -s "$STAMP_PATH" || "$(cat "$STAMP_PATH")" != "$REVISION" || "$WEB_UI_DIR/pubspec.yaml" -nt "$WEB_UI_DIR/pubspec.lock" ]]; then | ||
| echo "[Snapshot mode: on] (creating a new snapshot)" | ||
| install_deps | ||
| mkdir -p $DART_TOOL_DIR | ||
|
|
||
| echo "Creating the snapshot" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This message seems redundant given the message above |
||
| "$DART_SDK_DIR/bin/dart" --snapshot="$SNAPSHOT_PATH" --packages="$WEB_UI_DIR/.packages" "$SCRIPT_PATH" | ||
| echo "$REVISION" > "$STAMP_PATH" | ||
| else | ||
| echo "[Snapshot mode: on] (using existing snapshot)" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think the default should be silent.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm still debating this. On the one hand, like you said, the happy path should be silent. On the other hand, my concern is that someone would make changes in felt and forget to turn off snapshotting. Showing the message all the time makes it easier to realize that the snapshot mode is on. I'll make it silent for now and see. If we start making a lot of mistakes, I'll "unsilent" it.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, it depends on how often we'll be making changes to |
||
| fi | ||
|
|
||
| $DART_SDK_DIR/bin/dart --packages="$WEB_UI_DIR/.packages" "$SNAPSHOT_PATH" $@ | ||
| fi | ||
|
|
||
| $DART_SDK_DIR/bin/dart --packages="$WEB_UI_DIR/.packages" "$SNAPSHOT_PATH" $@ | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion: Shall we use "rm -rf"?
"-r" argument deletes recursively, may be we might want to use it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
$SNAPSHOT_PATHand$STAMP_PATHpoint to files, not directories. The recursive flag-ronly has an effect on directories, right?