packages icon indicating copy to clipboard operation
packages copied to clipboard

[google_sign_in_ios] Adds Swift Package Manager support

Open loic-sharma opened this issue 1 year ago • 1 comments

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 https://github.com/flutter/flutter/issues/148021.

Fixes https://github.com/flutter/flutter/issues/146904

Pre-launch Checklist

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

loic-sharma avatar Aug 09 '24 19:08 loic-sharma

From triage: still blocked on upstream issues.

stuartmorgan-g avatar Oct 08 '24 19:10 stuartmorgan-g

AppAuth-iOS 1.7.6 was released with the fix, this PR should be unblocked now: https://github.com/openid/AppAuth-iOS/pull/871

loic-sharma avatar Nov 26 '24 18:11 loic-sharma

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: https://github.com/openid/AppAuth-iOS/pull/888

loic-sharma avatar Nov 27 '24 23:11 loic-sharma

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.

stuartmorgan-g avatar Dec 02 '24 19:12 stuartmorgan-g

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.

Did we find/file an issue for this that we can reference in the comments?

stuartmorgan-g avatar Feb 05 '25 15:02 stuartmorgan-g

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.

Did we find/file an issue for this that we can reference in the comments?

Looks like you can potentially use an unsafeFlag, however, "use of unsafe flags makes the products containing this target ineligible for use by other packages". I wonder if we could use it conditionally only during testing. @loic-sharma might be worth trying out. Perhaps using an environment variable?

https://stackoverflow.com/a/64842804

vashworth avatar Feb 06 '25 15:02 vashworth

It's not clear to me that that SO answer address our (and the questioner's) use case; it's showing suppressing warnings on a target being defined as part of the package, not on a dependency.

Either way though, "I want warnings in my code, but not in code I don't control" is a pretty standard thing to want, and a use case we have a demonstrated need for, so we should request SPM fully (not only via unsafe flags) support it.

stuartmorgan-g avatar Feb 06 '25 15:02 stuartmorgan-g

To clarify, I don't consider this as blocking landing; if we do have a reference we can add, great, if not we can land without it but I think it's important that we (in parallel) provide feedback on ways that SPM doesn't work for us.

stuartmorgan-g avatar Feb 06 '25 15:02 stuartmorgan-g

I did try various configurations of unsafeFlags, cSettings, swiftSettings to suppress dependency warnings. These worked locally on my machine. However, I could not get these suppressions to work in our CI. I was unable to reproduce locally, even if I used the same version of Xcode as our CI... It's not clear to me what's going wrong on our CI.

loic-sharma avatar Feb 06 '25 18:02 loic-sharma