Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[google_sign_in_ios] Adds Swift Package Manager support #7356

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

loic-sharma
Copy link
Member

Adds Swift Package Manager support to google_sign_in_ios.

This does not migrate the example app's Xcode project to use Swift Package Manager, that's tracked by flutter/flutter#148021.

Fixes flutter/flutter#146904

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@@ -26,17 +26,14 @@ end
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)

# Suppress warnings from transitive dependencies that cause analysis to fail.
pod 'AppAuth', :inhibit_warnings => true
pod 'GTMAppAuth', :inhibit_warnings => true
inhibit_all_warnings!
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines inhibit warnings but also add AppAuth and GTMAppAuth as CocoaPod dependencies:

pod 'AppAuth', :inhibit_warnings => true
pod 'GTMAppAuth', :inhibit_warnings => true

If the SwiftPM feature is enabled, this caused duplicate modules and the build would fail.

This is a temporary workaround. In the future, we'll remove CocoaPod integration from these example apps. That's tracked by flutter/flutter#148021.

name: "google_sign_in_ios",
platforms: [
.iOS("12.0"),
.macOS("10.15")
Copy link
Member Author

@loic-sharma loic-sharma Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bumped up to macOS 10.15. Required to depend on GoogleSignIn (here)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already require 10.15 (which is good, because otherwise this would be very hard to roll out in a non-disruptive way).

],
dependencies: [
// AppAuth and GTMSessionFetcher are GoogleSignIn transitive dependencies.
// Depend on versions which define modules.
Copy link
Member Author

@loic-sharma loic-sharma Aug 9, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This mirrors:

# AppAuth and GTMSessionFetcher are GoogleSignIn transitive dependencies.
# Depend on versions which defines modules.
s.dependency 'AppAuth', '>= 1.7.6'
s.dependency 'GTMSessionFetcher', '>= 3.4.0'
s.dependency 'GoogleSignIn', '~> 7.1'

@loic-sharma loic-sharma force-pushed the spm_google_sign_in branch 7 times, most recently from f36566e to eb4c0d5 Compare August 9, 2024 22:34
@stuartmorgan
Copy link
Contributor

From triage: still blocked on upstream issues.

@loic-sharma
Copy link
Member Author

AppAuth-iOS 1.7.6 was released with the fix, this PR should be unblocked now: openid/AppAuth-iOS#871

@loic-sharma
Copy link
Member Author

This is failing xcode-analyze and native-test because our transitive dependency AppAuth has warnings, and we treat warnings as errors. This isn't a problem when using CocoaPods as we've configured it to ignore these warnings. Unfortunately, SwiftPM doesn't let suppress warnings in our dependencies.

Our options are to either allow packages to opt-out of warnings as errors, or, fix the warnings in the upstream dependency: openid/AppAuth-iOS#888

@stuartmorgan
Copy link
Contributor

stuartmorgan commented Dec 2, 2024

I'm okay with temporarily turning off warnings-as-errors for this package, but we should have a tracking issue with context for turning it back on.

Ideally we should also reference an SPM feature request for the ability to do what we used to do with Cocoapods. Having the ability to use different warning settings for code you control and code you don't is a fairly common feature in build systems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[google_sign_in_ios] Add Swift Package Manager compatibility to google_sign_in_ios
2 participants