Skip to content

Conversation

@flutteractionsbot
Copy link

@flutteractionsbot flutteractionsbot commented Jun 21, 2024

This pull request is created by automatic cherry pick workflow
Please fill in the form below, and a flutter domain expert will evaluate this cherry pick request.

Issue Link:

What is the link to the issue this cherry-pick is addressing?

#150296

Changelog Description:

Explain this cherry pick in one line that is accessible to most Flutter developers. See best practices for examples.

Fixed bug in flutter test where --flavor wasn't considered when validating cached assets, causing the flavor-conditional asset bundling feature to not work as expected.

Impact Description:

What is the impact (ex. visual jank on Samsung phones, app crash, cannot ship an iOS app)? Does it impact development (ex. flutter doctor crashes when Android Studio is installed), or the shipping production app (the app crashes on launch)

For users of flavor-conditional asset bundling that used --flavor in flutter test, this could result in tests incorrectly passing or failing depending on which --flavor value they used since their last flutter clean.

Workaround:

Is there a workaround for this issue?

flutter clean between flutter test runs (if --flavor is being used and any tests depend on the flavor-conditional asset bundling feature).

Risk:

What is the risk level of this cherry-pick?

  • Low
  • Medium
  • High

Test Coverage:

Are you confident that your fix is well-tested by automated tests?

  • Yes
  • No

Validation Steps:

What are the steps to validate that this fix works?

Attempt to repro with these steps provided by the original issue reporter.

… cached asset bundle (flutter#150461)

Fixes flutter#150296

**Context.** `flutter test` has its own code path for writing flutter app [assets](https://docs.flutter.dev/ui/assets/assets-and-images). flutter#132985 introduced [flavor-conditional asset bundling ](https://docs.flutter.dev/deployment/flavors#conditionally-bundling-assets-based-on-flavor), which lets users control which assets get bundled based on `--flavor`. `--flavor` is supported in `flutter test`.

**Bug and fix.** `--flavor` isn't considered when deciding whether we need to rebuild this asset bundle:

https://github.com/flutter/flutter/blob/5e448f4ce57723ac0792ae822ebac69df3188ba1/packages/flutter_tools/lib/src/commands/test.dart#L709

This PR address this by writing the value of `--flavor` to a file in the build directory and checking that when validating the cached asset bundle.
@flutteractionsbot flutteractionsbot added the cp: review Cherry-picks in the review queue label Jun 21, 2024
@flutteractionsbot
Copy link
Author

@andrewkolos please fill out the PR description above, afterwards the release team will review this request.

@github-actions github-actions bot added the tool Affects the "flutter" command-line tool. See also t: labels. label Jun 21, 2024
@itsjustkevin itsjustkevin added the autosubmit Merge PR when tree becomes green via auto submit App label Jul 1, 2024
@auto-submit auto-submit bot merged commit 37c6548 into flutter:flutter-3.22-candidate.0 Jul 1, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 18, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Jul 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

autosubmit Merge PR when tree becomes green via auto submit App cp: review Cherry-picks in the review queue tool Affects the "flutter" command-line tool. See also t: labels.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants