[iOS] specify minimum os version for native asset frameworks (#148504)
Fixes https://github.com/flutter/flutter/issues/148501
This commit is contained in:
parent
e6fa865581
commit
454dd7e29c
@ -230,7 +230,9 @@ Future<void> _copyNativeAssetsIOS(
|
|||||||
}
|
}
|
||||||
await lipoDylibs(dylibFile, sources);
|
await lipoDylibs(dylibFile, sources);
|
||||||
await setInstallNameDylib(dylibFile);
|
await setInstallNameDylib(dylibFile);
|
||||||
await createInfoPlist(targetUri.pathSegments.last, frameworkDir);
|
// TODO(knopp): Wire the value once there is a way to configure that in the hook.
|
||||||
|
// https://github.com/dart-lang/native/issues/1133
|
||||||
|
await createInfoPlist(targetUri.pathSegments.last, frameworkDir, minimumIOSVersion: '12.0');
|
||||||
await codesignDylib(codesignIdentity, buildMode, frameworkDir);
|
await codesignDylib(codesignIdentity, buildMode, frameworkDir);
|
||||||
}
|
}
|
||||||
globals.logger.printTrace('Copying native assets done.');
|
globals.logger.printTrace('Copying native assets done.');
|
||||||
|
@ -18,20 +18,23 @@ import '../../../globals.dart' as globals;
|
|||||||
/// The framework must be named [name].framework and the dylib [name].
|
/// The framework must be named [name].framework and the dylib [name].
|
||||||
Future<void> createInfoPlist(
|
Future<void> createInfoPlist(
|
||||||
String name,
|
String name,
|
||||||
Directory target,
|
Directory target, {
|
||||||
) async {
|
String? minimumIOSVersion,
|
||||||
|
}) async {
|
||||||
final File infoPlistFile = target.childFile('Info.plist');
|
final File infoPlistFile = target.childFile('Info.plist');
|
||||||
await infoPlistFile.writeAsString('''
|
final String bundleIdentifier = 'io.flutter.flutter.native_assets.$name'.replaceAll('_', '-');
|
||||||
|
await infoPlistFile.writeAsString(<String>[
|
||||||
|
'''
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
<plist version="1.0">
|
<plist version="1.0">
|
||||||
<dict>
|
<dict>
|
||||||
<key>CFBundleDevelopmentRegion</key>
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
<string>en</string>
|
<string>en</string>
|
||||||
<key>CFBundleExecutable</key>
|
<key>CFBundleExecutable</key>
|
||||||
<string>$name</string>
|
<string>$name</string>
|
||||||
<key>CFBundleIdentifier</key>
|
<key>CFBundleIdentifier</key>
|
||||||
<string>io.flutter.flutter.native_assets.$name</string>
|
<string>$bundleIdentifier</string>
|
||||||
<key>CFBundleInfoDictionaryVersion</key>
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
<string>6.0</string>
|
<string>6.0</string>
|
||||||
<key>CFBundleName</key>
|
<key>CFBundleName</key>
|
||||||
@ -44,9 +47,16 @@ Future<void> createInfoPlist(
|
|||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
<string>1.0</string>
|
<string>1.0</string>
|
||||||
|
''',
|
||||||
|
if (minimumIOSVersion != null)
|
||||||
|
'''
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>$minimumIOSVersion</string>
|
||||||
|
''',
|
||||||
|
'''
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>'''
|
||||||
''');
|
].join());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Combines dylibs from [sources] into a fat binary at [targetFullPath].
|
/// Combines dylibs from [sources] into a fat binary at [targetFullPath].
|
||||||
|
@ -345,6 +345,32 @@ void expectDylibIsBundledMacOS(Directory appDirectory, String buildMode) {
|
|||||||
final Link dylibLink = frameworkDir.childLink(frameworkName);
|
final Link dylibLink = frameworkDir.childLink(frameworkName);
|
||||||
expect(dylibLink, exists);
|
expect(dylibLink, exists);
|
||||||
expect(dylibLink.resolveSymbolicLinksSync(), dylibFile.path);
|
expect(dylibLink.resolveSymbolicLinksSync(), dylibFile.path);
|
||||||
|
final String infoPlist = resourcesDir.childFile('Info.plist').readAsStringSync();
|
||||||
|
expect(infoPlist, '''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>package_with_native_assets</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.flutter.flutter.native-assets.package-with-native-assets</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>package_with_native_assets</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
</dict>
|
||||||
|
</plist>''');
|
||||||
}
|
}
|
||||||
|
|
||||||
void expectDylibIsBundledIos(Directory appDirectory, String buildMode) {
|
void expectDylibIsBundledIos(Directory appDirectory, String buildMode) {
|
||||||
@ -357,6 +383,36 @@ void expectDylibIsBundledIos(Directory appDirectory, String buildMode) {
|
|||||||
.childDirectory('$frameworkName.framework')
|
.childDirectory('$frameworkName.framework')
|
||||||
.childFile(frameworkName);
|
.childFile(frameworkName);
|
||||||
expect(dylib, exists);
|
expect(dylib, exists);
|
||||||
|
final String infoPlist = frameworksFolder
|
||||||
|
.childDirectory('$frameworkName.framework')
|
||||||
|
.childFile('Info.plist').readAsStringSync();
|
||||||
|
expect(infoPlist, '''
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleDevelopmentRegion</key>
|
||||||
|
<string>en</string>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>package_with_native_assets</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>io.flutter.flutter.native-assets.package-with-native-assets</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>package_with_native_assets</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>FMWK</string>
|
||||||
|
<key>CFBundleShortVersionString</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>CFBundleSignature</key>
|
||||||
|
<string>????</string>
|
||||||
|
<key>CFBundleVersion</key>
|
||||||
|
<string>1.0</string>
|
||||||
|
<key>MinimumOSVersion</key>
|
||||||
|
<string>12.0</string>
|
||||||
|
</dict>
|
||||||
|
</plist>''');
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Checks that dylibs are bundled.
|
/// Checks that dylibs are bundled.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user