Skip to content

Commit b139559

Browse files
[flutter_releases] Flutter Stable 2.0.4 Framework Cherrypicks (flutter#79486)
* Skip linking on Flutter for CocoaPods transitive dependencies (flutter#78592) * Apply Engine cherrypicks for release 2.0.4 Co-authored-by: Jenn Magder <magder@google.com>
1 parent 4d7946a commit b139559

File tree

3 files changed

+45
-2
lines changed

3 files changed

+45
-2
lines changed

bin/internal/engine.version

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3459eb24361807fb186953a864cf890fa8e9d26a
1+
2dce47073a378673f6ca095e91b8065544c3a881

dev/devicelab/bin/tasks/build_ios_framework_module_test.dart

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
6666
String content = pubspec.readAsStringSync();
6767
content = content.replaceFirst(
6868
'\ndependencies:\n',
69-
'\ndependencies:\n device_info: 0.4.1\n package_info: 0.4.0+9\n',
69+
'\ndependencies:\n device_info: 0.4.1\n package_info: 0.4.0+9\n connectivity: 3.0.3\n',
7070
);
7171
pubspec.writeAsStringSync(content, flush: true);
7272
await inDirectory(projectDir, () async {
@@ -284,6 +284,21 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
284284
'device_info',
285285
);
286286
await _checkBitcode(pluginFrameworkPath, mode);
287+
if (!await _linksOnFlutter(pluginFrameworkPath)) {
288+
throw TaskResult.failure('$pluginFrameworkPath does not link on Flutter');
289+
}
290+
291+
final String transitiveDependencyFrameworkPath = path.join(
292+
outputPath,
293+
mode,
294+
'Reachability.xcframework',
295+
localXcodeArmDirectoryName,
296+
'Reachability.framework',
297+
'Reachability',
298+
);
299+
if (await _linksOnFlutter(transitiveDependencyFrameworkPath)) {
300+
throw TaskResult.failure('Transitive dependency $transitiveDependencyFrameworkPath unexpectedly links on Flutter');
301+
}
287302

288303
checkFileExists(path.join(
289304
outputPath,
@@ -407,6 +422,18 @@ Future<void> _testBuildIosFramework(Directory projectDir, { bool isModule = fals
407422
mode,
408423
'package_info.xcframework',
409424
));
425+
426+
checkDirectoryExists(path.join(
427+
cocoapodsOutputPath,
428+
mode,
429+
'connectivity.xcframework',
430+
));
431+
432+
checkDirectoryExists(path.join(
433+
cocoapodsOutputPath,
434+
mode,
435+
'Reachability.xcframework',
436+
));
410437
}
411438

412439
if (File(path.join(
@@ -443,3 +470,13 @@ Future<String> _dylibSymbols(String pathToDylib) {
443470
'arm64',
444471
]);
445472
}
473+
474+
Future<bool> _linksOnFlutter(String pathToBinary) async {
475+
final String loadCommands = await eval('otool', <String>[
476+
'-l',
477+
'-arch',
478+
'arm64',
479+
pathToBinary,
480+
]);
481+
return loadCommands.contains('Flutter.framework');
482+
}

packages/flutter_tools/bin/podhelper.rb

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ def flutter_macos_podfile_setup
3333
def flutter_additional_ios_build_settings(target)
3434
return unless target.platform_name == :ios
3535

36+
# Return if it's not a Flutter plugin (transitive dependency).
37+
return unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }
38+
3639
# [target.deployment_target] is a [String] formatted as "8.0".
3740
inherit_deployment_target = target.deployment_target[/\d+/].to_i < 9
3841

@@ -75,6 +78,9 @@ def flutter_additional_ios_build_settings(target)
7578
def flutter_additional_macos_build_settings(target)
7679
return unless target.platform_name == :osx
7780

81+
# Return if it's not a Flutter plugin (transitive dependency).
82+
return unless target.dependencies.any? { |dependency| dependency.name == 'FlutterMacOS' }
83+
7884
# [target.deployment_target] is a [String] formatted as "10.8".
7985
deployment_target_major, deployment_target_minor = target.deployment_target.match(/(\d+).?(\d*)/).captures
8086

0 commit comments

Comments
 (0)