Skip to content

Commit 4ca43c3

Browse files
[google_sign_in] PR 1/4 google_sign_in_ios SPM packaging (flutter#12654)
Creates a Swift Package Manager target so later PRs can add Swift sources without mixing them into the Obj-C target. CocoaPods still builds both as one pod. This is packaging-only: Obj-C sources move to `google_sign_in_ios_objc`, and a placeholder Swift target re-exports that module. Plugin behavior is unchanged. Matches the Obj-C / Swift SPM split already used by `video_player_avfoundation` and `in_app_purchase_storekit`: - `Package.swift`: `google_sign_in_ios` depends on `google_sign_in_ios_objc`; only the Swift product is exported - CocoaPods: combined `source_files` glob plus Swift stdlib xcconfig - Header search path stays `include/google_sign_in_ios` so existing `#import <google_sign_in_ios/...>` keeps working - Tests: `#if canImport(google_sign_in_ios_objc)` for the Obj-C module Bumps `google_sign_in_ios` to **6.3.2**. PR 1/4 of the Obj-C → Swift migration. Follows flutter#12484 (coverage backfill). Part of flutter#119103 ## Pre-Review Checklist **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. [^1]: Regular contributors who have demonstrated familiarity with the repository guidelines only need to comment if the PR is not auto-exempted by repo tooling.
1 parent 80da2cf commit 4ca43c3

16 files changed

Lines changed: 36 additions & 12 deletions

File tree

‎packages/google_sign_in/google_sign_in_ios/CHANGELOG.md‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 6.3.3
2+
3+
* Creates Swift Package Manager target for Swift implementation.
4+
15
## 6.3.2
26

37
* Updates pigeon dev_dependency to ^27.3.2 for analyzer 14 compatibility.

‎packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.swift‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ import Testing
77

88
@testable import google_sign_in_ios
99

10+
#if canImport(google_sign_in_ios_objc)
11+
@testable import google_sign_in_ios_objc
12+
#endif
13+
1014
#if os(OSX)
1115
import FlutterMacOS
1216
#else

‎packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,15 @@ Enables Google Sign-In in Flutter apps.
1212
s.license = { :type => 'BSD', :file => '../LICENSE' }
1313
s.author = { 'Flutter Team' => '[email protected]' }
1414
s.source = { :http => 'https://github.com/flutter/packages/tree/main/packages/google_sign_in/google_sign_in_ios' }
15-
s.source_files = 'google_sign_in_ios/Sources/google_sign_in_ios/**/*.{h,m}'
16-
s.public_header_files = 'google_sign_in_ios/Sources/google_sign_in_ios/include/**/*.h'
15+
# Combine google_sign_in_ios and google_sign_in_ios_objc sources into a single
16+
# pod, unlike SwiftPM, where separate Swift and Objective-C targets are required.
17+
s.source_files = 'google_sign_in_ios/Sources/google_sign_in_ios*/**/*.{h,m,swift}'
18+
s.public_header_files = 'google_sign_in_ios/Sources/google_sign_in_ios_objc/include/**/*.h'
19+
s.swift_version = '5.0'
20+
s.xcconfig = {
21+
'LIBRARY_SEARCH_PATHS' => '$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)/ $(SDKROOT)/usr/lib/swift',
22+
'LD_RUNPATH_SEARCH_PATHS' => '/usr/lib/swift',
23+
}
1724

1825
# GTMSessionFetcher is a GoogleSignIn transitive dependency, added here as a
1926
# direct dependency to ensure a version which defines modules.
@@ -26,10 +33,5 @@ Enables Google Sign-In in Flutter apps.
2633
s.osx.deployment_target = '10.15'
2734
s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES' }
2835

29-
# google_sign_in_ios does not contain Swift files. For some reason, there
30-
# is a "pod lib lint" warning unless swift_version is set. This seems related to
31-
# GoogleSignIn depending a Swift pod (GTMAppAuth).
32-
s.swift_version = '5.0'
33-
3436
s.resource_bundles = {'google_sign_in_ios_privacy' => ['google_sign_in_ios/Sources/google_sign_in_ios/Resources/PrivacyInfo.xcprivacy']}
3537
end

‎packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Package.swift‎

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,21 @@ let package = Package(
2424
.target(
2525
name: "google_sign_in_ios",
2626
dependencies: [
27-
.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")
27+
"google_sign_in_ios_objc"
2828
],
2929
resources: [
3030
.process("Resources")
31+
]
32+
),
33+
.target(
34+
name: "google_sign_in_ios_objc",
35+
dependencies: [
36+
.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")
3137
],
38+
publicHeadersPath: "include",
3239
cSettings: [
3340
.headerSearchPath("include/google_sign_in_ios")
3441
]
35-
)
42+
),
3643
]
3744
)
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Copyright 2013 The Flutter Authors
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#if canImport(google_sign_in_ios_objc)
6+
@_exported import google_sign_in_ios_objc
7+
#endif

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/FLTGoogleSignInPlugin.m renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios_objc/FLTGoogleSignInPlugin.m

File renamed without changes.

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/WrapperProtocolImplementations.m renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios_objc/WrapperProtocolImplementations.m

File renamed without changes.

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/include/google_sign_in_ios/FLTGoogleSignInPlugin.h renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios_objc/include/google_sign_in_ios/FLTGoogleSignInPlugin.h

File renamed without changes.

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/include/google_sign_in_ios/FLTGoogleSignInPlugin_Test.h renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios_objc/include/google_sign_in_ios/FLTGoogleSignInPlugin_Test.h

File renamed without changes.

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/include/google_sign_in_ios/FSIGoogleSignInProtocols.h renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios_objc/include/google_sign_in_ios/FSIGoogleSignInProtocols.h

File renamed without changes.

0 commit comments

Comments
 (0)