[google_sign_in_ios] Upgrade GoogleSignIn iOS SDK to 7.1 (#6404)

1. Update GoogleSignIn iOS SDK dependency to [7.1](https://github.com/google/GoogleSignIn-iOS/releases/tag/7.1.0), which supports privacy manifests.
1. Update "fetch deps step" to run `pod repo update` every time to avoid missing spec failure. Also added a fetch deps step to the all_packages builds, since those could also use a `pod repo update` but I didn't want to add more logic to those bash scripts.
```
     [!] CocoaPods could not find compatible versions for pod "GoogleSignIn":
       In Podfile:
         google_sign_in_ios (from `Flutter/ephemeral/.symlinks/plugins/google_sign_in_ios/darwin`) was resolved to 0.0.1, which depends on
           GoogleSignIn (~> 7.1)
     None of your spec sources contain a spec satisfying the dependency: `GoogleSignIn (~> 7.1)`.
```
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752192509749702705/+/u/Run_package_tests/download_Dart_and_iOS_deps/stdout

3. Looks like the new versions of [`GTMSessionFetcher`](https://github.com/CocoaPods/Specs/blob/master/Specs/c/e/3/GTMSessionFetcher/3.3.2/GTMSessionFetcher.podspec.json) and [`AppAuth`](https://github.com/CocoaPods/Specs/blob/master/Specs/b/b/9/AppAuth/1.7.3/AppAuth.podspec.json) don't define modules, so there's an error building it statically:
```
     [!] The following Swift pods cannot yet be integrated as static libraries:
     The Swift pod `GTMAppAuth` depends upon `GTMSessionFetcher` and `AppAuth`, which do not define modules. To opt into those targets generating module maps (which is necessary to import them from Swift when building as static libraries), you may set `use_modular_headers!` globally in your Podfile, or specify `:modular_headers => true` for particular dependencies.
```
I filed https://github.com/google/gtm-session-fetcher/issues/384 and https://github.com/openid/AppAuth-iOS/issues/844.

In the meantime, I updated the example apps to `use_frameworks!`, which would be on for Flutter Swift apps, but not Objective-C ones.  We could add something to the tool to detect this case, and suggest `use_frameworks!` be added?  

4.  Even though google_sign_in_ios does not contain Swift files, for some reason, there is a "pod lib lint" warning complaining `swift_version` isn't set. This seems related to `GTMAppAuth` dependency constraint that went from an Objective-C-only to Swift pod.  So I set `swift_version` since it's harmless.

```
- WARN  | swift: The validator used Swift `4.0` by default because no Swift version was specified. To specify a Swift version during validation, add the `swift_versions` attribute in your podspec. Note that usage of a `.swift-version` file is now deprecated.
```
https://logs.chromium.org/logs/flutter/buildbucket/cr-buildbucket/8752100979634945505/+/u/Run_package_tests/validate_iOS_and_macOS_podspecs/stdout

## Issues

* Fixes https://github.com/flutter/flutter/issues/145777
* Fixes https://github.com/flutter/flutter/issues/145866
* See also https://github.com/flutter/flutter/issues/137140
This commit is contained in:
Jenn Magder
2024-04-17 11:03:48 -07:00
committed by GitHub
parent 0dd8de289e
commit 663b4754e2
9 changed files with 65 additions and 15 deletions

View File

@ -2,6 +2,10 @@ tasks:
- name: prepare tool - name: prepare tool
script: .ci/scripts/prepare_tool.sh script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running. infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and iOS deps
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps", "--ios", "--supporting-target-platforms-only"]
infra_step: true
- name: create all_packages app - name: create all_packages app
script: .ci/scripts/create_all_packages_app.sh script: .ci/scripts/create_all_packages_app.sh
infra_step: true # Note infra steps failing prevents "always" from running. infra_step: true # Note infra steps failing prevents "always" from running.

View File

@ -2,6 +2,10 @@ tasks:
- name: prepare tool - name: prepare tool
script: .ci/scripts/prepare_tool.sh script: .ci/scripts/prepare_tool.sh
infra_step: true # Note infra steps failing prevents "always" from running. infra_step: true # Note infra steps failing prevents "always" from running.
- name: download Dart and macOS deps
script: .ci/scripts/tool_runner.sh
args: ["fetch-deps", "--macos", "--supporting-target-platforms-only"]
infra_step: true
- name: create all_packages app - name: create all_packages app
script: .ci/scripts/create_all_packages_app.sh script: .ci/scripts/create_all_packages_app.sh
infra_step: true # Note infra steps failing prevents "always" from running. infra_step: true # Note infra steps failing prevents "always" from running.

View File

@ -1,3 +1,7 @@
## 5.7.6
* Upgrades GoogleSignIn iOS SDK to 7.1.
## 5.7.5 ## 5.7.5
* Pins GoogleSignIn to iOS SDK "7.0.0" while preparing the update to 7.1. * Pins GoogleSignIn to iOS SDK "7.0.0" while preparing the update to 7.1.

View File

@ -15,12 +15,23 @@ Enables Google Sign-In in Flutter apps.
s.source_files = 'Classes/**/*.{h,m}' s.source_files = 'Classes/**/*.{h,m}'
s.public_header_files = 'Classes/**/*.h' s.public_header_files = 'Classes/**/*.h'
s.module_map = 'Classes/FLTGoogleSignInPlugin.modulemap' s.module_map = 'Classes/FLTGoogleSignInPlugin.modulemap'
s.dependency 'GoogleSignIn', '~> 7.0.0'
# AppAuth and GTMSessionFetcher are GoogleSignIn transitive dependencies.
# Depend on versions which defines modules.
s.dependency 'AppAuth', '>= 1.7.4'
s.dependency 'GTMSessionFetcher', '>= 3.4.0'
s.dependency 'GoogleSignIn', '~> 7.1'
s.static_framework = true s.static_framework = true
s.ios.dependency 'Flutter' s.ios.dependency 'Flutter'
s.osx.dependency 'FlutterMacOS' s.osx.dependency 'FlutterMacOS'
s.ios.deployment_target = '12.0' s.ios.deployment_target = '12.0'
s.osx.deployment_target = '10.15' s.osx.deployment_target = '10.15'
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' } s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
# google_sign_in_ios does not contain Swift files. For some reason, there
# is a "pod lib lint" warning unless swift_version is set. This seems related to
# GoogleSignIn depending a Swift pod (GTMAppAuth).
s.swift_version = '5.0'
s.resource_bundles = {'google_sign_in_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']} s.resource_bundles = {'google_sign_in_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
end end

View File

@ -273,7 +273,7 @@
97C146E61CF9000F007C117D /* Project object */ = { 97C146E61CF9000F007C117D /* Project object */ = {
isa = PBXProject; isa = PBXProject;
attributes = { attributes = {
LastUpgradeCheck = 1430; LastUpgradeCheck = 1510;
ORGANIZATIONNAME = "The Flutter Authors"; ORGANIZATIONNAME = "The Flutter Authors";
TargetAttributes = { TargetAttributes = {
97C146ED1CF9000F007C117D = { 97C146ED1CF9000F007C117D = {
@ -386,11 +386,19 @@
); );
inputPaths = ( inputPaths = (
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh", "${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
"${PODS_CONFIGURATION_BUILD_DIR}/AppAuth/AppAuthCore_Privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/GTMAppAuth/GTMAppAuth_Privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/GTMSessionFetcher/GTMSessionFetcher_Core_Privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/GTMSessionFetcher/GTMSessionFetcher_Full_Privacy.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/GoogleSignIn/GoogleSignIn.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/GoogleSignIn/GoogleSignIn.bundle",
"${PODS_CONFIGURATION_BUILD_DIR}/google_sign_in_ios/google_sign_in_ios_privacy.bundle", "${PODS_CONFIGURATION_BUILD_DIR}/google_sign_in_ios/google_sign_in_ios_privacy.bundle",
); );
name = "[CP] Copy Pods Resources"; name = "[CP] Copy Pods Resources";
outputPaths = ( outputPaths = (
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppAuthCore_Privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMAppAuth_Privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMSessionFetcher_Core_Privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMSessionFetcher_Full_Privacy.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle",
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/google_sign_in_ios_privacy.bundle", "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/google_sign_in_ios_privacy.bundle",
); );

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<Scheme <Scheme
LastUpgradeVersion = "1430" LastUpgradeVersion = "1510"
version = "1.3"> version = "1.3">
<BuildAction <BuildAction
parallelizeBuildables = "YES" parallelizeBuildables = "YES"

View File

@ -2,7 +2,7 @@ name: google_sign_in_ios
description: iOS implementation of the google_sign_in plugin. description: iOS implementation of the google_sign_in plugin.
repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios repository: https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22 issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+google_sign_in%22
version: 5.7.5 version: 5.7.6
environment: environment:
sdk: ^3.2.3 sdk: ^3.2.3

View File

@ -11,6 +11,7 @@ import 'common/repository_package.dart';
const int _exitPrecacheFailed = 3; const int _exitPrecacheFailed = 3;
const int _exitNothingRequested = 4; const int _exitNothingRequested = 4;
const int _exitPodUpdateFailed = 5;
/// Download dependencies, both Dart and native. /// Download dependencies, both Dart and native.
/// ///
@ -79,22 +80,28 @@ class FetchDepsCommand extends PackageLoopingCommand {
// `pod install` requires having the platform artifacts precached. See // `pod install` requires having the platform artifacts precached. See
// https://github.com/flutter/flutter/blob/fb7a763c640d247d090cbb373e4b3a0459ac171b/packages/flutter_tools/bin/podhelper.rb#L47 // https://github.com/flutter/flutter/blob/fb7a763c640d247d090cbb373e4b3a0459ac171b/packages/flutter_tools/bin/podhelper.rb#L47
// https://github.com/flutter/flutter/blob/fb7a763c640d247d090cbb373e4b3a0459ac171b/packages/flutter_tools/bin/podhelper.rb#L130 // https://github.com/flutter/flutter/blob/fb7a763c640d247d090cbb373e4b3a0459ac171b/packages/flutter_tools/bin/podhelper.rb#L130
if (getBoolArg(platformIOS)) { final bool precacheIOS = getBoolArg(platformIOS);
final int exitCode = await processRunner.runAndStream( final bool precacheMacOS = getBoolArg(platformMacOS);
if (precacheIOS || precacheMacOS) {
final int precacheExitCode = await processRunner.runAndStream(
flutterCommand, flutterCommand,
<String>['precache', '--ios'], <String>[
'precache',
if (precacheIOS)
'--ios',
if (precacheMacOS)
'--macos',
],
); );
if (exitCode != 0) { if (precacheExitCode != 0) {
throw ToolExit(_exitPrecacheFailed); throw ToolExit(_exitPrecacheFailed);
} }
} final int updateUpdateExitCode = await processRunner.runAndStream(
if (getBoolArg(platformMacOS)) { 'pod',
final int exitCode = await processRunner.runAndStream( <String>['repo', 'update'],
flutterCommand,
<String>['precache', '--macos'],
); );
if (exitCode != 0) { if (updateUpdateExitCode != 0) {
throw ToolExit(_exitPrecacheFailed); throw ToolExit(_exitPodUpdateFailed);
} }
} }
} }

View File

@ -409,6 +409,11 @@ void main() {
<String>['precache', '--ios'], <String>['precache', '--ios'],
null, null,
), ),
const ProcessCall(
'pod',
<String>['repo', 'update'],
null,
),
for (final Directory directory in exampleDirs) for (final Directory directory in exampleDirs)
ProcessCall( ProcessCall(
'flutter', 'flutter',
@ -436,6 +441,7 @@ void main() {
.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] = .mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
<FakeProcessInfo>[ <FakeProcessInfo>[
FakeProcessInfo(MockProcess(), <String>['precache']), FakeProcessInfo(MockProcess(), <String>['precache']),
FakeProcessInfo(MockProcess(), <String>['repo', 'update']),
FakeProcessInfo(MockProcess(exitCode: 1), FakeProcessInfo(MockProcess(exitCode: 1),
<String>['build', 'ios', '--config-only']), <String>['build', 'ios', '--config-only']),
]; ];
@ -516,6 +522,11 @@ void main() {
<String>['precache', '--macos'], <String>['precache', '--macos'],
null, null,
), ),
const ProcessCall(
'pod',
<String>['repo', 'update'],
null,
),
for (final Directory directory in exampleDirs) for (final Directory directory in exampleDirs)
ProcessCall( ProcessCall(
'flutter', 'flutter',
@ -543,6 +554,7 @@ void main() {
.mockProcessesForExecutable[getFlutterCommand(mockPlatform)] = .mockProcessesForExecutable[getFlutterCommand(mockPlatform)] =
<FakeProcessInfo>[ <FakeProcessInfo>[
FakeProcessInfo(MockProcess(), <String>['precache']), FakeProcessInfo(MockProcess(), <String>['precache']),
FakeProcessInfo(MockProcess(), <String>['repo', 'update']),
FakeProcessInfo(MockProcess(exitCode: 1), FakeProcessInfo(MockProcess(exitCode: 1),
<String>['build', 'macos', '--config-only']), <String>['build', 'macos', '--config-only']),
]; ];