Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 92d8b04

Browse files
authored
[macOS] Flavors project throws no flavor specified for creating a project. (#113979)
1 parent b373be8 commit 92d8b04

File tree

2 files changed

+21
-3
lines changed

2 files changed

+21
-3
lines changed

packages/flutter_tools/lib/src/project.dart

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,16 @@ class FlutterProject {
138138
// Don't require iOS build info, this method is only
139139
// used during create as best-effort, use the
140140
// default target bundle identifier.
141-
final String? bundleIdentifier = await ios.productBundleIdentifier(null);
142-
if (bundleIdentifier != null) {
143-
candidates.add(bundleIdentifier);
141+
try {
142+
final String? bundleIdentifier = await ios.productBundleIdentifier(null);
143+
if (bundleIdentifier != null) {
144+
candidates.add(bundleIdentifier);
145+
}
146+
} on ToolExit {
147+
// It's possible that while parsing the build info for the ios project
148+
// that the bundleIdentifier can't be resolve. However, we would like
149+
// skip parsing that id in favor of searching in other place. We can
150+
// consider a tool exit in this case to be non fatal for the program.
144151
}
145152
}
146153
if (android.existsSync()) {

packages/flutter_tools/test/general.shard/project_test.dart

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -509,6 +509,17 @@ apply plugin: 'kotlin-android'
509509
expect(await project.ios.productBundleIdentifier(null), 'io.flutter.someProject.suffix');
510510
});
511511

512+
testWithMocks('Always pass parsing org on ios project with flavors', () async {
513+
final FlutterProject project = await someProject();
514+
addIosProjectFile(project.directory, projectFileContent: () {
515+
return projectFileWithBundleId('io.flutter.someProject', qualifier: "'");
516+
});
517+
project.ios.xcodeProject.createSync();
518+
xcodeProjectInterpreter.xcodeProjectInfo = XcodeProjectInfo(<String>[], <String>[], <String>['free', 'paid'], logger);
519+
520+
expect(await project.organizationNames, <String>[]);
521+
});
522+
512523
testWithMocks('fails with no flavor and defined schemes', () async {
513524
final FlutterProject project = await someProject();
514525
project.ios.xcodeProject.createSync();

0 commit comments

Comments
 (0)