Skip to content

Commit 77d935a

Browse files
godofredocjmagman
andauthored
[flutter_releases] Flutter stable 2.8.1 Framework Cherrypicks (#95375)
* Build Flutter iOS plugins with all valid architectures (#95293) * 'add branch flutter-2.8-candidate.3 to enabled_branches in .ci.yaml' * 'Update Engine revision to 890a5fca2e34db413be624fc83aeea8e61d42ce6 for stable release 2.8.1' Co-authored-by: Jenn Magder <[email protected]>
1 parent 2ef5ad6 commit 77d935a

4 files changed

Lines changed: 70 additions & 14 deletions

File tree

‎.ci.yaml‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
# More information at:
77
# * https://github.com/flutter/cocoon/blob/main/CI_YAML.md
88
enabled_branches:
9+
- flutter-2.8-candidate.3
910
- main
1011
- master
1112
- flutter-\d+\.\d+-candidate\.\d+

‎bin/internal/engine.version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
40a99c595137e4b2f5b2efa8ff343ea23c1e16b8
1+
890a5fca2e34db413be624fc83aeea8e61d42ce6

‎packages/flutter_tools/bin/podhelper.rb‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,6 @@ 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-
3936
# [target.deployment_target] is a [String] formatted as "8.0".
4037
inherit_deployment_target = target.deployment_target[/\d+/].to_i < 9
4138

@@ -52,6 +49,14 @@ def flutter_additional_ios_build_settings(target)
5249
release_framework_dir = File.expand_path(File.join(artifacts_dir, 'ios-release', 'Flutter.xcframework'), __FILE__)
5350

5451
target.build_configurations.each do |build_configuration|
52+
# Build both x86_64 and arm64 simulator archs for all dependencies. If a single plugin does not support arm64 simulators,
53+
# the app and all frameworks will fall back to x86_64. Unfortunately that case is not detectable in this script.
54+
# Therefore all pods must have a x86_64 slice available, or linking a x86_64 app will fail.
55+
build_configuration.build_settings['ONLY_ACTIVE_ARCH'] = 'NO' if build_configuration.type == :debug
56+
57+
# Skip other updates if it's not a Flutter plugin (transitive dependency).
58+
next unless target.dependencies.any? { |dependency| dependency.name == 'Flutter' }
59+
5560
# Profile can't be derived from the CocoaPods build configuration. Use release framework (for linking only).
5661
configuration_engine_dir = build_configuration.type == :debug ? debug_framework_dir : release_framework_dir
5762
Dir.new(configuration_engine_dir).each_child do |xcframework_file|

‎packages/flutter_tools/test/integration.shard/ios_content_validation_test.dart‎

Lines changed: 60 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import 'test_utils.dart';
1616
void main() {
1717
group('iOS app validation', () {
1818
String flutterRoot;
19+
Directory pluginRoot;
1920
String projectRoot;
2021
String flutterBin;
2122
Directory tempDir;
@@ -29,18 +30,20 @@ void main() {
2930
'flutter',
3031
);
3132

33+
// Test a plugin example app to allow plugins validation.
3234
processManager.runSync(<String>[
3335
flutterBin,
3436
...getLocalEngineArguments(),
3537
'create',
3638
'--verbose',
3739
'--platforms=ios',
38-
'-i',
39-
'objc',
40+
'-t',
41+
'plugin',
4042
'hello',
4143
], workingDirectory: tempDir.path);
4244

43-
projectRoot = tempDir.childDirectory('hello').path;
45+
pluginRoot = tempDir.childDirectory('hello');
46+
projectRoot = pluginRoot.childDirectory('example').path;
4447
});
4548

4649
tearDownAll(() {
@@ -56,6 +59,7 @@ void main() {
5659
File outputFlutterFrameworkBinary;
5760
Directory outputAppFramework;
5861
File outputAppFrameworkBinary;
62+
File outputPluginFrameworkBinary;
5963

6064
setUpAll(() {
6165
processManager.runSync(<String>[
@@ -85,11 +89,13 @@ void main() {
8589

8690
outputAppFramework = frameworkDirectory.childDirectory('App.framework');
8791
outputAppFrameworkBinary = outputAppFramework.childFile('App');
92+
93+
outputPluginFrameworkBinary = frameworkDirectory.childDirectory('hello.framework').childFile('hello');
8894
});
8995

9096
testWithoutContext('flutter build ios builds a valid app', () {
91-
// Should only contain Flutter.framework and App.framework.
92-
expect(frameworkDirectory.listSync().length, 2);
97+
expect(outputPluginFrameworkBinary, exists);
98+
9399
expect(outputAppFrameworkBinary, exists);
94100
expect(outputAppFramework.childFile('Info.plist'), exists);
95101

@@ -202,17 +208,61 @@ void main() {
202208
}, skip: !platform.isMacOS || buildMode != BuildMode.release); // [intended] only makes sense on macos.
203209

204210
testWithoutContext('validate obfuscation', () {
205-
final ProcessResult grepResult = processManager.runSync(<String>[
211+
// HelloPlugin class is present in project.
212+
ProcessResult grepResult = processManager.runSync(<String>[
213+
'grep',
214+
'-r',
215+
'HelloPlugin',
216+
pluginRoot.path,
217+
]);
218+
// Matches exits 0.
219+
expect(grepResult.exitCode, 0);
220+
221+
// Not present in binary.
222+
grepResult = processManager.runSync(<String>[
206223
'grep',
207-
'-i',
208-
'hello',
224+
'HelloPlugin',
209225
outputAppFrameworkBinary.path,
210226
]);
211-
expect(grepResult.stdout, isNot(contains('matches')));
227+
// Does not match exits 1.
228+
expect(grepResult.exitCode, 1);
212229
});
213230
});
214231
}
215232

233+
testWithoutContext('builds all plugin architectures for simulator', () {
234+
final ProcessResult buildSimulator = processManager.runSync(
235+
<String>[
236+
flutterBin,
237+
...getLocalEngineArguments(),
238+
'build',
239+
'ios',
240+
'--simulator',
241+
'--verbose',
242+
'--no-codesign',
243+
],
244+
workingDirectory: projectRoot,
245+
);
246+
expect(buildSimulator.exitCode, 0);
247+
248+
final File pluginFrameworkBinary = fileSystem.file(fileSystem.path.join(
249+
projectRoot,
250+
'build',
251+
'ios',
252+
'iphonesimulator',
253+
'Runner.app',
254+
'Frameworks',
255+
'hello.framework',
256+
'hello',
257+
));
258+
expect(pluginFrameworkBinary, exists);
259+
final ProcessResult archs = processManager.runSync(
260+
<String>['file', pluginFrameworkBinary.path],
261+
);
262+
expect(archs.stdout, contains('Mach-O 64-bit dynamically linked shared library x86_64'));
263+
expect(archs.stdout, contains('Mach-O 64-bit dynamically linked shared library arm64'));
264+
});
265+
216266
testWithoutContext('build for simulator with all available architectures', () {
217267
final ProcessResult buildSimulator = processManager.runSync(
218268
<String>[
@@ -250,6 +300,6 @@ void main() {
250300
expect(archs.stdout, contains('Mach-O 64-bit dynamically linked shared library arm64'));
251301
});
252302
}, skip: !platform.isMacOS, // [intended] only makes sense for macos platform.
253-
timeout: const Timeout(Duration(minutes: 5))
303+
timeout: const Timeout(Duration(minutes: 7))
254304
);
255305
}

0 commit comments

Comments
 (0)