Skip to content

Commit 3cbc736

Browse files
committed
[google_sign_in_ios] Adds Swift Package Manager support
1 parent 45c1997 commit 3cbc736

File tree

21 files changed

+164
-91
lines changed

21 files changed

+164
-91
lines changed

packages/google_sign_in/google_sign_in_ios/CHANGELOG.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
## NEXT
1+
## 5.8.0
22

33
* Updates minimum supported SDK version to Flutter 3.22/Dart 3.4.
4+
* Adds Swift Package Manager compatibility.
45

56
## 5.7.8
67

packages/google_sign_in/google_sign_in_ios/darwin/Assets/.gitkeep

Whitespace-only changes.

packages/google_sign_in/google_sign_in_ios/darwin/Tests/GoogleSignInTests.m

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
@import XCTest;
1313
@import google_sign_in_ios;
14+
#if __has_include(<google_sign_in_ios/google_sign_in_ios-umbrella.h>)
1415
@import google_sign_in_ios.Test;
16+
#endif
1517
@import GoogleSignIn;
1618

1719
// OCMock library doesn't generate a valid modulemap.

packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios.podspec

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ 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 = 'Classes/**/*.{h,m}'
16-
s.public_header_files = 'Classes/**/*.h'
17-
s.module_map = 'Classes/FLTGoogleSignInPlugin.modulemap'
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'
17+
s.module_map = 'google_sign_in_ios/Sources/google_sign_in_ios/include/FLTGoogleSignInPlugin.modulemap'
1818

1919
# AppAuth and GTMSessionFetcher are GoogleSignIn transitive dependencies.
2020
# Depend on versions which defines modules.
21-
s.dependency 'AppAuth', '>= 1.7.4'
21+
s.dependency 'AppAuth', '>= 1.7.6'
2222
s.dependency 'GTMSessionFetcher', '>= 3.4.0'
2323
s.dependency 'GoogleSignIn', '~> 7.1'
2424
s.static_framework = true
@@ -33,5 +33,5 @@ Enables Google Sign-In in Flutter apps.
3333
# GoogleSignIn depending a Swift pod (GTMAppAuth).
3434
s.swift_version = '5.0'
3535

36-
s.resource_bundles = {'google_sign_in_ios_privacy' => ['Resources/PrivacyInfo.xcprivacy']}
36+
s.resource_bundles = {'google_sign_in_ios_privacy' => ['google_sign_in_ios/Sources/google_sign_in_ios/Resources/PrivacyInfo.xcprivacy']}
3737
end
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
// swift-tools-version: 5.9
2+
3+
// Copyright 2013 The Flutter Authors. All rights reserved.
4+
// Use of this source code is governed by a BSD-style license that can be
5+
// found in the LICENSE file.
6+
7+
import PackageDescription
8+
9+
let package = Package(
10+
name: "google_sign_in_ios",
11+
platforms: [
12+
.iOS("12.0"),
13+
.macOS("10.15"),
14+
],
15+
products: [
16+
.library(name: "google-sign-in-ios", targets: ["google_sign_in_ios"])
17+
],
18+
dependencies: [
19+
// AppAuth and GTMSessionFetcher are GoogleSignIn transitive dependencies.
20+
// Depend on versions which define modules.
21+
.package(
22+
url: "https://github.com/openid/AppAuth-iOS.git",
23+
from: "1.7.6"),
24+
.package(
25+
url: "https://github.com/google/gtm-session-fetcher.git",
26+
from: "3.4.0"),
27+
.package(
28+
url: "https://github.com/google/GoogleSignIn-iOS.git",
29+
from: "7.1.0"),
30+
],
31+
targets: [
32+
.target(
33+
name: "google_sign_in_ios",
34+
dependencies: [
35+
.product(name: "GoogleSignIn", package: "GoogleSignIn-iOS")
36+
],
37+
exclude: [
38+
"include/google_sign_in_ios-umbrella.h", "include/FLTGoogleSignInPlugin.modulemap",
39+
],
40+
resources: [
41+
.process("Resources")
42+
],
43+
cSettings: [
44+
.headerSearchPath("include/google_sign_in_ios")
45+
]
46+
)
47+
]
48+
)

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#import "FLTGoogleSignInPlugin.h"
6-
#import "FLTGoogleSignInPlugin_Test.h"
5+
#import "./include/google_sign_in_ios/FLTGoogleSignInPlugin.h"
6+
#import "./include/google_sign_in_ios/FLTGoogleSignInPlugin_Test.h"
77

88
#import <GoogleSignIn/GoogleSignIn.h>
99

packages/google_sign_in/google_sign_in_ios/darwin/Classes/messages.g.m renamed to packages/google_sign_in/google_sign_in_ios/darwin/google_sign_in_ios/Sources/google_sign_in_ios/messages.g.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Autogenerated from Pigeon (v11.0.1), do not edit directly.
55
// See also: https://pub.dev/packages/pigeon
66

7-
#import "messages.g.h"
7+
#import "./include/google_sign_in_ios/messages.g.h"
88

99
#if TARGET_OS_OSX
1010
#import <FlutterMacOS/FlutterMacOS.h>

packages/google_sign_in/google_sign_in_ios/example/ios/Podfile

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,17 +26,14 @@ end
2626
require File.expand_path(File.join('packages', 'flutter_tools', 'bin', 'podhelper'), flutter_root)
2727

2828
# Suppress warnings from transitive dependencies that cause analysis to fail.
29-
pod 'AppAuth', :inhibit_warnings => true
30-
pod 'GTMAppAuth', :inhibit_warnings => true
29+
inhibit_all_warnings!
3130

3231
flutter_ios_podfile_setup
3332

3433
target 'Runner' do
3534
flutter_install_all_ios_pods File.dirname(File.realpath(__FILE__))
3635
target 'RunnerTests' do
3736
inherit! :search_paths
38-
39-
pod 'OCMock','3.5'
4037
end
4138
end
4239

packages/google_sign_in/google_sign_in_ios/example/ios/Runner.xcodeproj/project.pbxproj

Lines changed: 28 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10+
40A6CE2A2D499A7800DE3915 /* OCMock in Frameworks */ = {isa = PBXBuildFile; productRef = 40A6CE292D499A7800DE3915 /* OCMock */; };
1011
5C6F5A6E1EC3B4CB008D64B5 /* GeneratedPluginRegistrant.m in Sources */ = {isa = PBXBuildFile; fileRef = 5C6F5A6D1EC3B4CB008D64B5 /* GeneratedPluginRegistrant.m */; };
12+
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
1113
78A36DA12AF5761E00CBFD43 /* GoogleService-Info.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7A303C2D1E89D76400B1F19E /* GoogleService-Info.plist */; };
1214
7ACDFB0E1E8944C400BE2D00 /* AppFrameworkInfo.plist in Resources */ = {isa = PBXBuildFile; fileRef = 7ACDFB0D1E8944C400BE2D00 /* AppFrameworkInfo.plist */; };
1315
978B8F6F1D3862AE00F588F7 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 7AFFD8EE1D35381100E5BB4D /* AppDelegate.m */; };
@@ -19,7 +21,6 @@
1921
C56D3B06A42F3B35C1F47A43 /* libPods-RunnerTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 18AD6475292B9C45B529DDC9 /* libPods-RunnerTests.a */; };
2022
F76AC1A52666D0540040C8BC /* GoogleSignInTests.m in Sources */ = {isa = PBXBuildFile; fileRef = F76AC1A42666D0540040C8BC /* GoogleSignInTests.m */; };
2123
F76AC1B32666D0610040C8BC /* GoogleSignInUITests.m in Sources */ = {isa = PBXBuildFile; fileRef = F76AC1B22666D0610040C8BC /* GoogleSignInUITests.m */; };
22-
78A318202AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage in Frameworks */ = {isa = PBXBuildFile; productRef = 78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */; };
2324
/* End PBXBuildFile section */
2425

2526
/* Begin PBXContainerItemProxy section */
@@ -96,6 +97,7 @@
9697
isa = PBXFrameworksBuildPhase;
9798
buildActionMask = 2147483647;
9899
files = (
100+
40A6CE2A2D499A7800DE3915 /* OCMock in Frameworks */,
99101
C56D3B06A42F3B35C1F47A43 /* libPods-RunnerTests.a in Frameworks */,
100102
);
101103
runOnlyForDeploymentPostprocessing = 0;
@@ -211,9 +213,6 @@
211213

212214
/* Begin PBXNativeTarget section */
213215
97C146ED1CF9000F007C117D /* Runner */ = {
214-
packageProductDependencies = (
215-
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
216-
);
217216
isa = PBXNativeTarget;
218217
buildConfigurationList = 97C147051CF9000F007C117D /* Build configuration list for PBXNativeTarget "Runner" */;
219218
buildPhases = (
@@ -223,14 +222,16 @@
223222
97C146EB1CF9000F007C117D /* Frameworks */,
224223
97C146EC1CF9000F007C117D /* Resources */,
225224
9705A1C41CF9048500538489 /* Embed Frameworks */,
226-
532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */,
227225
3B06AD1E1E4923F5004D2608 /* Thin Binary */,
228226
);
229227
buildRules = (
230228
);
231229
dependencies = (
232230
);
233231
name = Runner;
232+
packageProductDependencies = (
233+
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */,
234+
);
234235
productName = Runner;
235236
productReference = 97C146EE1CF9000F007C117D /* Runner.app */;
236237
productType = "com.apple.product-type.application";
@@ -276,9 +277,6 @@
276277

277278
/* Begin PBXProject section */
278279
97C146E61CF9000F007C117D /* Project object */ = {
279-
packageReferences = (
280-
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
281-
);
282280
isa = PBXProject;
283281
attributes = {
284282
LastUpgradeCheck = 1510;
@@ -308,6 +306,10 @@
308306
Base,
309307
);
310308
mainGroup = 97C146E51CF9000F007C117D;
309+
packageReferences = (
310+
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */,
311+
40A6CE282D499A7800DE3915 /* XCRemoteSwiftPackageReference "ocmock" */,
312+
);
311313
productRefGroup = 97C146EF1CF9000F007C117D /* Products */;
312314
projectDirPath = "";
313315
projectRoot = "";
@@ -387,34 +389,6 @@
387389
shellPath = /bin/sh;
388390
shellScript = "/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" embed\n/bin/sh \"$FLUTTER_ROOT/packages/flutter_tools/bin/xcode_backend.sh\" thin\n";
389391
};
390-
532EA9D341340B1DCD08293D /* [CP] Copy Pods Resources */ = {
391-
isa = PBXShellScriptBuildPhase;
392-
buildActionMask = 2147483647;
393-
files = (
394-
);
395-
inputPaths = (
396-
"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh",
397-
"${PODS_CONFIGURATION_BUILD_DIR}/AppAuth/AppAuthCore_Privacy.bundle",
398-
"${PODS_CONFIGURATION_BUILD_DIR}/GTMAppAuth/GTMAppAuth_Privacy.bundle",
399-
"${PODS_CONFIGURATION_BUILD_DIR}/GTMSessionFetcher/GTMSessionFetcher_Core_Privacy.bundle",
400-
"${PODS_CONFIGURATION_BUILD_DIR}/GTMSessionFetcher/GTMSessionFetcher_Full_Privacy.bundle",
401-
"${PODS_CONFIGURATION_BUILD_DIR}/GoogleSignIn/GoogleSignIn.bundle",
402-
"${PODS_CONFIGURATION_BUILD_DIR}/google_sign_in_ios/google_sign_in_ios_privacy.bundle",
403-
);
404-
name = "[CP] Copy Pods Resources";
405-
outputPaths = (
406-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/AppAuthCore_Privacy.bundle",
407-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMAppAuth_Privacy.bundle",
408-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMSessionFetcher_Core_Privacy.bundle",
409-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GTMSessionFetcher_Full_Privacy.bundle",
410-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/GoogleSignIn.bundle",
411-
"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/google_sign_in_ios_privacy.bundle",
412-
);
413-
runOnlyForDeploymentPostprocessing = 0;
414-
shellPath = /bin/sh;
415-
shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-Runner/Pods-Runner-resources.sh\"\n";
416-
showEnvVarsInLog = 0;
417-
};
418392
9740EEB61CF901F6004384FC /* Run Script */ = {
419393
isa = PBXShellScriptBuildPhase;
420394
alwaysOutOfDate = 1;
@@ -774,13 +748,31 @@
774748
defaultConfigurationName = Release;
775749
};
776750
/* End XCConfigurationList section */
751+
777752
/* Begin XCLocalSwiftPackageReference section */
778753
781AD8BC2B33823900A9FFBB /* XCLocalSwiftPackageReference "Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage" */ = {
779754
isa = XCLocalSwiftPackageReference;
780755
relativePath = Flutter/ephemeral/Packages/FlutterGeneratedPluginSwiftPackage;
781756
};
782757
/* End XCLocalSwiftPackageReference section */
758+
759+
/* Begin XCRemoteSwiftPackageReference section */
760+
40A6CE282D499A7800DE3915 /* XCRemoteSwiftPackageReference "ocmock" */ = {
761+
isa = XCRemoteSwiftPackageReference;
762+
repositoryURL = "https://github.com/erikdoe/ocmock";
763+
requirement = {
764+
kind = revision;
765+
revision = fe1661a3efed11831a6452f4b1a0c5e6ddc08c3d;
766+
};
767+
};
768+
/* End XCRemoteSwiftPackageReference section */
769+
783770
/* Begin XCSwiftPackageProductDependency section */
771+
40A6CE292D499A7800DE3915 /* OCMock */ = {
772+
isa = XCSwiftPackageProductDependency;
773+
package = 40A6CE282D499A7800DE3915 /* XCRemoteSwiftPackageReference "ocmock" */;
774+
productName = OCMock;
775+
};
784776
78A3181F2AECB46A00862997 /* FlutterGeneratedPluginSwiftPackage */ = {
785777
isa = XCSwiftPackageProductDependency;
786778
productName = FlutterGeneratedPluginSwiftPackage;

packages/google_sign_in/google_sign_in_ios/example/macos/Podfile

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ target 'Runner' do
3333
target 'RunnerTests' do
3434
inherit! :search_paths
3535
end
36-
37-
pod 'OCMock','3.5'
3836
end
3937

4038
post_install do |installer|

0 commit comments

Comments
 (0)