Unverified Commit 6a4dd4cf authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Skip linking on Flutter for CocoaPods transitive dependencies (#78592)

parent 197b440e
......@@ -66,7 +66,7 @@ Future<void> _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<void> _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<void> _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<String> _dylibSymbols(String pathToDylib) {
'arm64',
]);
}
Future<bool> _linksOnFlutter(String pathToBinary) async {
final String loadCommands = await eval('otool', <String>[
'-l',
'-arch',
'arm64',
pathToBinary,
]);
return loadCommands.contains('Flutter.framework');
}
......@@ -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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment