diff --git a/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart b/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart index 539f71fcae..efbf90e1d6 100644 --- a/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart +++ b/dev/devicelab/bin/tasks/build_ios_framework_module_test.dart @@ -66,7 +66,7 @@ Future _testBuildIosFramework(Directory projectDir, { bool isModule = fals String content = pubspec.readAsStringSync(); content = content.replaceFirst( '\ndependencies:\n', - '\ndependencies:\n device_info: 0.4.1\n package_info: 0.4.0+9\n', + '\ndependencies:\n device_info: 0.4.1\n package_info: 0.4.0+9\n connectivity: 3.0.3\n', ); pubspec.writeAsStringSync(content, flush: true); await inDirectory(projectDir, () async { @@ -284,6 +284,21 @@ Future _testBuildIosFramework(Directory projectDir, { bool isModule = fals 'device_info', ); await _checkBitcode(pluginFrameworkPath, mode); + if (!await _linksOnFlutter(pluginFrameworkPath)) { + throw TaskResult.failure('$pluginFrameworkPath does not link on Flutter'); + } + + final String transitiveDependencyFrameworkPath = path.join( + outputPath, + mode, + 'Reachability.xcframework', + localXcodeArmDirectoryName, + 'Reachability.framework', + 'Reachability', + ); + if (await _linksOnFlutter(transitiveDependencyFrameworkPath)) { + throw TaskResult.failure('Transitive dependency $transitiveDependencyFrameworkPath unexpectedly links on Flutter'); + } checkFileExists(path.join( outputPath, @@ -407,6 +422,18 @@ Future _testBuildIosFramework(Directory projectDir, { bool isModule = fals mode, 'package_info.xcframework', )); + + checkDirectoryExists(path.join( + cocoapodsOutputPath, + mode, + 'connectivity.xcframework', + )); + + checkDirectoryExists(path.join( + cocoapodsOutputPath, + mode, + 'Reachability.xcframework', + )); } if (File(path.join( @@ -443,3 +470,13 @@ Future _dylibSymbols(String pathToDylib) { 'arm64', ]); } + +Future _linksOnFlutter(String pathToBinary) async { + final String loadCommands = await eval('otool', [ + '-l', + '-arch', + 'arm64', + pathToBinary, + ]); + return loadCommands.contains('Flutter.framework'); +} diff --git a/packages/flutter_tools/bin/podhelper.rb b/packages/flutter_tools/bin/podhelper.rb index 113c062b7a..08c330c4b5 100644 --- a/packages/flutter_tools/bin/podhelper.rb +++ b/packages/flutter_tools/bin/podhelper.rb @@ -33,6 +33,9 @@ end def flutter_additional_ios_build_settings(target) return unless target.platform_name == :ios + # Return if it's not a Flutter plugin (transitive dependency). + return unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' } + # [target.deployment_target] is a [String] formatted as "8.0". inherit_deployment_target = target.deployment_target[/\d+/].to_i < 9 @@ -78,6 +81,9 @@ end def flutter_additional_macos_build_settings(target) return unless target.platform_name == :osx + # Return if it's not a Flutter plugin (transitive dependency). + return unless target.dependencies.any? { |dependency| dependency.name == 'FlutterMacOS' } + # [target.deployment_target] is a [String] formatted as "10.8". deployment_target_major, deployment_target_minor = target.deployment_target.match(/(\d+).?(\d*)/).captures