diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart b/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart index b4e64debde..578908565b 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/ios/native_assets.dart @@ -230,7 +230,9 @@ Future _copyNativeAssetsIOS( } await lipoDylibs(dylibFile, sources); 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); } globals.logger.printTrace('Copying native assets done.'); diff --git a/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets_host.dart b/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets_host.dart index b564ce75c2..dcc3a76508 100644 --- a/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets_host.dart +++ b/packages/flutter_tools/lib/src/isolated/native_assets/macos/native_assets_host.dart @@ -18,20 +18,23 @@ import '../../../globals.dart' as globals; /// The framework must be named [name].framework and the dylib [name]. Future createInfoPlist( String name, - Directory target, -) async { + Directory target, { + String? minimumIOSVersion, +}) async { final File infoPlistFile = target.childFile('Info.plist'); - await infoPlistFile.writeAsString(''' + final String bundleIdentifier = 'io.flutter.flutter.native_assets.$name'.replaceAll('_', '-'); + await infoPlistFile.writeAsString([ + ''' CFBundleDevelopmentRegion - en + en CFBundleExecutable $name CFBundleIdentifier - io.flutter.flutter.native_assets.$name + $bundleIdentifier CFBundleInfoDictionaryVersion 6.0 CFBundleName @@ -44,9 +47,16 @@ Future createInfoPlist( ???? CFBundleVersion 1.0 +''', + if (minimumIOSVersion != null) + ''' + MinimumOSVersion + $minimumIOSVersion +''', + ''' - - '''); +''' + ].join()); } /// Combines dylibs from [sources] into a fat binary at [targetFullPath]. diff --git a/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart b/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart index ca79c2473a..9168aead50 100644 --- a/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart +++ b/packages/flutter_tools/test/integration.shard/isolated/native_assets_test.dart @@ -345,6 +345,32 @@ void expectDylibIsBundledMacOS(Directory appDirectory, String buildMode) { final Link dylibLink = frameworkDir.childLink(frameworkName); expect(dylibLink, exists); expect(dylibLink.resolveSymbolicLinksSync(), dylibFile.path); + final String infoPlist = resourcesDir.childFile('Info.plist').readAsStringSync(); + expect(infoPlist, ''' + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + package_with_native_assets + CFBundleIdentifier + io.flutter.flutter.native-assets.package-with-native-assets + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + package_with_native_assets + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + +'''); } void expectDylibIsBundledIos(Directory appDirectory, String buildMode) { @@ -357,6 +383,36 @@ void expectDylibIsBundledIos(Directory appDirectory, String buildMode) { .childDirectory('$frameworkName.framework') .childFile(frameworkName); expect(dylib, exists); + final String infoPlist = frameworksFolder + .childDirectory('$frameworkName.framework') + .childFile('Info.plist').readAsStringSync(); + expect(infoPlist, ''' + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + package_with_native_assets + CFBundleIdentifier + io.flutter.flutter.native-assets.package-with-native-assets + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + package_with_native_assets + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + MinimumOSVersion + 12.0 + +'''); } /// Checks that dylibs are bundled.