Teach the flutter tool how to find android output files if the flavor contains uppercase letters#65768
Teach the flutter tool how to find android output files if the flavor contains uppercase letters#65768knaeckeKami wants to merge 0 commit intoflutter:masterfrom
Conversation
|
@knaeckeKami Done, sorry about that. Created #66047. |
|
We're going to see if we can repurpose an existing test to cover this |
|
I think the fix is to apply lowercase in the Dart side, so maybe let's change that as opposed to the .gradle file. |
|
Ok, applying this to the dart side is more complex, i hope i caught all the cases |
blasten
left a comment
There was a problem hiding this comment.
LGTM - Thanks for the update! I saw some tests failed, maybe rebase to retrigger the checks with the latest changes on master.
|
Ah I didn't mean to close this PR. Could you reopen it? I don't have the rights |
|
@knaeckeKami we can't recreate your PR, you need to re-open it through the github UI |
|
it looks like your force push deleted all of the changes |
|
Ok, strange. See #66687 |
|
Yeah, I messed up since I had other changes in flutter that I forgot about, but the force push should have fixed it. But Github now says that there are no new commits in my branch, but it works fine on the new PR, even if it's against the same branch |
Description
This changes the name of the generated output files on android in case a flavor with uppercase letters is used.
Previously, the lowercased flavor name would be used for the apk/aab file. Now, the flavor name is used as-is.
Example: when adding a flavor with the name "aB" to the flutter template project, the name of the generated .aab file is now
app-aB-release.aabinstead ofapp-ab-release.aabBecause of calling .toLowerCase() on the flavor name, the generated apk/aab files would not be found after the Gradle build for users that use a case sensitive file system (typically Linux, but not Windows or Mac OS), and they would get an error message
because the flutter tool looks for a file with the real flavor name in its name, not the lowercased flavor name.
See https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle.dart#L900
Related Issues
fixes #24106 , particularly #24106 (comment)
Tests
I did not add tests. Since this is a change in the gradle file for the android build process, I don't know how I would add a test for this. If tests are required, I would appreciate a pointer on how and where to add them.
Checklist
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
Did any tests fail when you ran them? Please read [Handling breaking changes].
This should not be a breaking change.
If one does not use uppercase letters in flavor names, nothing changes.
Otherwise, for Windows and Mac, this name of the generated file apk will be different, however, since the file systems of these operating systems are not case sensitive, this should not cause problems.
On Linux, this should also not be a breaking change, since using a flavor name with uppercase letters caused the build to fail anyway previously.
Alternatives
If using upper case letters in the output files is not desired, we could also fix the expected file names in
https://github.com/flutter/flutter/blob/master/packages/flutter_tools/lib/src/android/gradle.dart to use the lower case flavor names.