Allow flavors and custom build types in host app#36805
Allow flavors and custom build types in host app#36805blasten merged 5 commits intoflutter:masterfrom
Conversation
|
It looks like this pull request may not have tests. Please make sure to add tests before merging. While there are exceptions to this rule, if this patch modifies code it is probably not an exception. Reviewers: Read the Tree Hygine page and make sure this patch meets those guidelines before LGTMing. /cc @dnfield |
|
@dnfield would it make sense for the bot to also check for |
9298404 to
c64368c
Compare
| @Override | ||
| protected void onCreate(Bundle savedInstanceState) { | ||
| super.onCreate(savedInstanceState); | ||
| setContentView(Flutter.createView(this, getLifecycle(), "route1")); |
There was a problem hiding this comment.
Please don't use the facade classes. Use https://github.com/flutter/flutter/wiki/Experimental:-Add-Flutter-Activity instead.
There was a problem hiding this comment.
Good point on current fragment dependencies on the new embedding.
I think the easiest way to "exercise the engine and VM" which I think is the goal here is to just let MainActivity extend io.flutter.app.FlutterActivity instead of using the facade classes.
cc @matthew-carroll
dev/integration_tests/module_host_with_custom_build/app/build.gradle
Outdated
Show resolved
Hide resolved
dev/devicelab/bin/tasks/module_host_with_custom_build_test.dart
Outdated
Show resolved
Hide resolved
zanderso
left a comment
There was a problem hiding this comment.
lgtm after addressing other reviewers' comments.
|
LGTM |
| if (packageAssets) { | ||
| String mainModuleName = "app" | ||
| try { | ||
| String tmpModuleName = project.rootProject.ext.mainModuleName |
There was a problem hiding this comment.
These days many many projects have a custom name for the app module, actually, many projects have multiple app modules.
So hardcoding the :app completely breaks many projects.
by removing this script, that makes this issue come back again.
We need a way to let developers set their app module name, or it will be better if you can detect it automatically in this script.
Please let me know if I can help!
Thank you!
@blasten @zanderso @xster
There was a problem hiding this comment.
Potentially, we could iterate through all the subprojects and find the one that applies the com.android.application plugin. Is this something you would like to explore?
Description
In add2app scenarios, it is pretty common that the host app may have flavors or custom build types. However, when a Flutter module is added, you can't build the APK anymore. The Flutter project doesn't know about the parent project flavor when merging the assets. As a result you end up with a failure at build time. In the case of custom build types, if you build debug, then the debug APK doesn't have the snapshots since they are under the
assets/flutter_assetsdirectory.This PR reverts #22707 since I'm unable to reproduce issue #19818 in
masterafter reverting it.Related Issues
Fixes all these issues:
#30916
#34089
#36479
#29648
Tests
I added the following tests:
Integration test:
module_host_with_custom_build.dartChecklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze --flutter-repo) does not report any problems on my PR.Breaking Change
Does your PR require Flutter developers to manually update their apps to accommodate your change?