-
Notifications
You must be signed in to change notification settings - Fork 26.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conditionally bundling assets based on flavor make tests to fail #150296
Comments
Thanks for the detailed report @AngeloAvv
Since you are trying to run Also, /cc @andrewkolos for thoughts on the issue report. |
Thanks for filing this (and thanks for tagging me)! I think it's fair to call this a bug (or surprising behavior at the very least). If |
I looked at the code that builds and writes the asset bundle for @darshankawar would you mind trying to repro this? |
Ok, @andrewkolos this looks weird. I was trying to share with you a repo to reproduce the code, so that's what I did.
I wasn't able to reproduce the bug anymore! So here's what I did.
But if you do the opposite
Looks like the assets files are not updated or something like that every time you switch from one run to another. |
Ah okay, this could be a caching bug. I will take a second look. |
Yeah, it looks like we don't take
|
Using this repo and running the test, it throws the reported error log. stable, master flutter doctor -v
|
Thank you @andrewkolos @darshankawar |
… 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.
… 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.
Steps to reproduce
Expected results
Actual results
Unable to load assets, no matter if you pass or not the flavor parameter.
Also, if you don't configure conditional imports under pubspec.yaml, tests work like a charm:
Code sample
Code sample
Screenshots or Video
No response
Logs
Logs (with flavor argument)
Logs (without flavor argument)
Flutter Doctor output
Doctor output
The text was updated successfully, but these errors were encountered: