mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
[tools/ios_build_ipa] fallback to CFBundleName if CFBundleDisplayName is absent (#130752)
The display name will fallback to CFBundleName if CFBundleDisplayName is absent. *List which issues are fixed by this PR. You must list at least one issue.* Fixes https://github.com/flutter/flutter/issues/120553 *If you had to change anything in the [flutter/tests] repo, include a link to the migration guide as per the [breaking change policy].*
This commit is contained in:
parent
2dbf594fde
commit
1b07c3d798
@ -378,7 +378,8 @@ class BuildIOSArchiveCommand extends _BuildIOSSubCommand {
|
||||
|
||||
xcodeProjectSettingsMap['Version Number'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleShortVersionStringKey);
|
||||
xcodeProjectSettingsMap['Build Number'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleVersionKey);
|
||||
xcodeProjectSettingsMap['Display Name'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleDisplayNameKey);
|
||||
xcodeProjectSettingsMap['Display Name'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleDisplayNameKey)
|
||||
?? globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleNameKey);
|
||||
xcodeProjectSettingsMap['Deployment Target'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kMinimumOSVersionKey);
|
||||
xcodeProjectSettingsMap['Bundle Identifier'] = globals.plistParser.getValueFromFile<String>(plistPath, PlistParser.kCFBundleIdentifierKey);
|
||||
|
||||
|
@ -30,6 +30,7 @@ class PlistParser {
|
||||
static const String kCFBundleExecutableKey = 'CFBundleExecutable';
|
||||
static const String kCFBundleVersionKey = 'CFBundleVersion';
|
||||
static const String kCFBundleDisplayNameKey = 'CFBundleDisplayName';
|
||||
static const String kCFBundleNameKey = 'CFBundleName';
|
||||
static const String kMinimumOSVersionKey = 'MinimumOSVersion';
|
||||
static const String kNSPrincipalClassKey = 'NSPrincipalClass';
|
||||
|
||||
|
@ -954,6 +954,8 @@ void main() {
|
||||
plistUtils.fileContents[plistPath] = <String,String>{
|
||||
'CFBundleIdentifier': 'io.flutter.someProject',
|
||||
'CFBundleDisplayName': 'Awesome Gallery',
|
||||
// Will not use CFBundleName since CFBundleDisplayName is present.
|
||||
'CFBundleName': 'Awesome Gallery 2',
|
||||
'MinimumOSVersion': '11.0',
|
||||
'CFBundleVersion': '666',
|
||||
'CFBundleShortVersionString': '12.34.56',
|
||||
@ -992,6 +994,62 @@ void main() {
|
||||
PlistParser: () => plistUtils,
|
||||
});
|
||||
|
||||
testUsingContext(
|
||||
'Validate basic Xcode settings with CFBundleDisplayName fallback to CFBundleName', () async {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
fakeProcessManager.addCommands(<FakeCommand>[
|
||||
xattrCommand,
|
||||
setUpFakeXcodeBuildHandler(onRun: () {
|
||||
fileSystem.file(plistPath).createSync(recursive: true);
|
||||
}),
|
||||
exportArchiveCommand(exportOptionsPlist: _exportOptionsPlist),
|
||||
]);
|
||||
|
||||
createMinimalMockProjectFiles();
|
||||
|
||||
plistUtils.fileContents[plistPath] = <String,String>{
|
||||
'CFBundleIdentifier': 'io.flutter.someProject',
|
||||
// Will use CFBundleName since CFBundleDisplayName is absent.
|
||||
'CFBundleName': 'Awesome Gallery',
|
||||
'MinimumOSVersion': '11.0',
|
||||
'CFBundleVersion': '666',
|
||||
'CFBundleShortVersionString': '12.34.56',
|
||||
};
|
||||
|
||||
final BuildCommand command = BuildCommand(
|
||||
androidSdk: FakeAndroidSdk(),
|
||||
buildSystem: TestBuildSystem.all(BuildResult(success: true)),
|
||||
fileSystem: MemoryFileSystem.test(),
|
||||
logger: BufferLogger.test(),
|
||||
osUtils: FakeOperatingSystemUtils(),
|
||||
);
|
||||
await createTestCommandRunner(command).run(
|
||||
<String>['build', 'ipa', '--no-pub']);
|
||||
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
contains(
|
||||
'[✓] App Settings Validation\n'
|
||||
' • Version Number: 12.34.56\n'
|
||||
' • Build Number: 666\n'
|
||||
' • Display Name: Awesome Gallery\n'
|
||||
' • Deployment Target: 11.0\n'
|
||||
' • Bundle Identifier: io.flutter.someProject\n'
|
||||
)
|
||||
);
|
||||
expect(
|
||||
testLogger.statusText,
|
||||
contains('To update the settings, please refer to https://docs.flutter.dev/deployment/ios')
|
||||
);
|
||||
}, overrides: <Type, Generator>{
|
||||
FileSystem: () => fileSystem,
|
||||
ProcessManager: () => fakeProcessManager,
|
||||
Platform: () => macosPlatform,
|
||||
XcodeProjectInterpreter: () => FakeXcodeProjectInterpreterWithBuildSettings(),
|
||||
PlistParser: () => plistUtils,
|
||||
});
|
||||
|
||||
|
||||
testUsingContext(
|
||||
'Validate basic Xcode settings with default bundle identifier prefix', () async {
|
||||
const String plistPath = 'build/ios/archive/Runner.xcarchive/Products/Applications/Runner.app/Info.plist';
|
||||
|
Loading…
Reference in New Issue
Block a user