Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
1fcb076e
Unverified
Commit
1fcb076e
authored
Feb 04, 2022
by
Michael Tamm
Committed by
GitHub
Feb 04, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] Fix bundle file not found when flavor contains upperc… (#92660)
parent
4b82d47b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
1 deletion
+45
-1
gradle.dart
packages/flutter_tools/lib/src/android/gradle.dart
+5
-0
build_info.dart
packages/flutter_tools/lib/src/build_info.dart
+12
-1
gradle_find_bundle_test.dart
...s/test/general.shard/android/gradle_find_bundle_test.dart
+28
-0
No files found.
packages/flutter_tools/lib/src/android/gradle.dart
View file @
1fcb076e
...
...
@@ -873,6 +873,11 @@ File findBundleFile(FlutterProject project, BuildInfo buildInfo, Logger logger,
getBundleDirectory(project)
.childDirectory('
$
{
buildInfo
.
lowerCasedFlavor
}
$
{
camelCase
(
'_
${buildInfo.modeName}
'
)}
')
.childFile('
app
-
$
{
buildInfo
.
lowerCasedFlavor
}-
$
{
buildInfo
.
modeName
}.
aab
'));
// The Android Gradle plugin 4.1.0 does only lowercase the first character of flavor name.
fileCandidates.add(getBundleDirectory(project)
.childDirectory('
$
{
buildInfo
.
uncapitalizedFlavor
}
$
{
camelCase
(
'_
${buildInfo.modeName}
'
)}
')
.childFile('
app
-
$
{
buildInfo
.
uncapitalizedFlavor
}-
$
{
buildInfo
.
modeName
}.
aab
'));
}
for (final File bundleFile in fileCandidates) {
if (bundleFile.existsSync()) {
...
...
packages/flutter_tools/lib/src/build_info.dart
View file @
1fcb076e
...
...
@@ -193,10 +193,14 @@ class BuildInfo {
String
get
modeName
=>
getModeName
(
mode
);
String
get
friendlyModeName
=>
getFriendlyModeName
(
mode
);
/// the flavor name in the output files is lower-cased (see flutter.gradle),
/// the flavor name in the output
apk
files is lower-cased (see flutter.gradle),
/// so the lower cased flavor name is used to compute the output file name
String
?
get
lowerCasedFlavor
=>
flavor
?.
toLowerCase
();
/// the flavor name in the output bundle files has the first character lower-cased,
/// so the uncapitalized flavor name is used to compute the output file name
String
?
get
uncapitalizedFlavor
=>
_uncapitalize
(
flavor
);
/// Convert to a structured string encoded structure appropriate for usage
/// in build system [Environment.defines].
///
...
...
@@ -1008,3 +1012,10 @@ String getNameForHostPlatformArch(HostPlatform platform) {
return
'x64'
;
}
}
String
?
_uncapitalize
(
String
?
s
)
{
if
(
s
==
null
||
s
.
isEmpty
)
{
return
s
;
}
return
s
.
substring
(
0
,
1
).
toLowerCase
()
+
s
.
substring
(
1
);
}
packages/flutter_tools/test/general.shard/android/gradle_find_bundle_test.dart
View file @
1fcb076e
...
...
@@ -305,6 +305,34 @@ void main() {
expect
(
bundle
.
path
,
'/build/app/outputs/bundle/foo_barDebug/app-foo_bar-debug.aab'
);
});
testWithoutContext
(
'Finds app bundle when flavor contains underscores and uppercase letters in release mode - Gradle 4.1'
,
()
{
final
FlutterProject
project
=
generateFakeAppBundle
(
'foo_BarRelease'
,
'app-foo_Bar-release.aab'
,
fileSystem
);
final
File
bundle
=
findBundleFile
(
project
,
const
BuildInfo
(
BuildMode
.
release
,
'Foo_Bar'
,
treeShakeIcons:
false
),
BufferLogger
.
test
(),
TestUsage
(),
);
expect
(
bundle
,
isNotNull
);
expect
(
bundle
.
path
,
'/build/app/outputs/bundle/foo_BarRelease/app-foo_Bar-release.aab'
);
});
testWithoutContext
(
'Finds app bundle when flavor contains underscores and uppercase letters in debug mode - Gradle 4.1'
,
()
{
final
FlutterProject
project
=
generateFakeAppBundle
(
'foo_BarDebug'
,
'app-foo_Bar-debug.aab'
,
fileSystem
);
final
File
bundle
=
findBundleFile
(
project
,
const
BuildInfo
(
BuildMode
.
debug
,
'Foo_Bar'
,
treeShakeIcons:
false
),
BufferLogger
.
test
(),
TestUsage
(),
);
expect
(
bundle
,
isNotNull
);
expect
(
bundle
.
path
,
'/build/app/outputs/bundle/foo_BarDebug/app-foo_Bar-debug.aab'
);
});
testWithoutContext
(
'AAB not found'
,
()
{
final
FlutterProject
project
=
FlutterProject
.
fromDirectoryTest
(
fileSystem
.
currentDirectory
);
final
TestUsage
testUsage
=
TestUsage
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment