Do not codesign transitive dependency iOS pod resource bundles (#111714)

This commit is contained in:
Jenn Magder
2022-09-16 11:02:12 -07:00
committed by GitHub
parent c36f1f9842
commit 7714a8d034
2 changed files with 41 additions and 14 deletions

View File

@@ -18,6 +18,15 @@ import 'package:path/path.dart' as path;
/// adding Flutter to an existing iOS app.
Future<void> main() async {
await task(() async {
// Update pod repo.
await eval(
'pod',
<String>['repo', 'update'],
environment: <String, String>{
'LANG': 'en_US.UTF-8',
},
);
// this variable cannot be `late`, as we reference it in the `finally` block
// which may execute before this field has been initialized
String? simulatorDeviceId;
@@ -157,11 +166,12 @@ Future<void> main() async {
String content = await pubspec.readAsString();
content = content.replaceFirst(
'\ndependencies:\n',
// One framework, one Dart-only, and one that does not support iOS.
// One framework, one Dart-only, one that does not support iOS, and one with a resource bundle.
'''
dependencies:
url_launcher: 6.0.20
android_alarm_manager: 0.4.5+11
google_sign_in_ios: 5.5.0
$dartPluginName:
path: ../$dartPluginName
''',
@@ -201,6 +211,8 @@ dependencies:
}
checkFileExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'url_launcher_ios.framework', 'url_launcher_ios'));
// Resources should be embedded.
checkDirectoryExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'GoogleSignIn.framework', 'GoogleSignIn.bundle'));
checkFileExists(path.join(ephemeralIOSHostApp.path, 'Frameworks', 'Flutter.framework', 'Flutter'));
// Android-only, no embedded framework.
@@ -297,7 +309,7 @@ end
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${objectiveCBuildDirectory.path}',
'BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
@@ -306,27 +318,33 @@ end
);
});
final bool existingAppBuilt = exists(File(path.join(
final String hostAppDirectory = path.join(
objectiveCBuildDirectory.path,
'Debug-iphoneos',
'Host.app',
);
final bool existingAppBuilt = exists(File(path.join(
hostAppDirectory,
'Host',
)));
if (!existingAppBuilt) {
return TaskResult.failure('Failed to build existing Objective-C app .app');
}
checkFileExists(path.join(
objectiveCBuildDirectory.path,
'Host.app',
final String hostFrameworksDirectory = path.join(
hostAppDirectory,
'Frameworks',
);
checkFileExists(path.join(
hostFrameworksDirectory,
'Flutter.framework',
'Flutter',
));
checkFileExists(path.join(
objectiveCBuildDirectory.path,
'Host.app',
'Frameworks',
hostFrameworksDirectory,
'App.framework',
'flutter_assets',
'isolate_snapshot_data',
@@ -335,9 +353,7 @@ end
section('Check the NOTICE file is correct');
final String licenseFilePath = path.join(
objectiveCBuildDirectory.path,
'Host.app',
'Frameworks',
hostFrameworksDirectory,
'App.framework',
'flutter_assets',
'NOTICES.Z',
@@ -524,7 +540,7 @@ end
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${objectiveCBuildDirectory.path}',
'BUILD_DIR=${objectiveCBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
canFail: true,
@@ -570,7 +586,7 @@ end
'CODE_SIGNING_REQUIRED=NO',
'CODE_SIGN_IDENTITY=-',
'EXPANDED_CODE_SIGN_IDENTITY=-',
'CONFIGURATION_BUILD_DIR=${swiftBuildDirectory.path}',
'BUILD_DIR=${swiftBuildDirectory.path}',
'COMPILER_INDEX_STORE_ENABLE=NO',
],
environment: <String, String> {
@@ -581,6 +597,7 @@ end
final bool existingSwiftAppBuilt = exists(File(path.join(
swiftBuildDirectory.path,
'Debug-iphoneos',
'Host.app',
'Host',
)));