Skip to content

Commit

Permalink
Refactor resources for SPM and CocoaPods.
Browse files Browse the repository at this point in the history
  • Loading branch information
petea committed May 6, 2021
1 parent 9915628 commit 1298f57
Show file tree
Hide file tree
Showing 46 changed files with 23 additions and 29 deletions.
4 changes: 3 additions & 1 deletion GoogleSignIn.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ The Google Sign-In SDK allows users to sign in with their Google account from th
s.dependency 'AppAuth', '~> 1.4'
s.dependency 'GTMAppAuth', '~> 1.0'
s.dependency 'GTMSessionFetcher/Core', '~> 1.1'
s.resources = 'GoogleSignIn/Resources/GoogleSignIn.bundle'
s.resource_bundle = {
'GoogleSignIn' => ['GoogleSignIn/Sources/{Resources,Strings}/*']
}
s.pod_target_xcconfig = {
'GCC_PREPROCESSOR_DEFINITIONS' => 'GID_SDK_VERSION=' + s.version.to_s,
'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
Expand Down
24 changes: 0 additions & 24 deletions GoogleSignIn/Resources/GoogleSignIn.bundle/Info.plist

This file was deleted.

19 changes: 15 additions & 4 deletions GoogleSignIn/Sources/NSBundle+GID3PAdditions.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,24 @@

NS_ASSUME_NONNULL_BEGIN

#if SWIFT_PACKAGE
NSString *const GoogleSignInBundleName = @"GoogleSignIn_GoogleSignIn";
#else
NSString *const GoogleSignInBundleName = @"GoogleSignIn";
#endif

@implementation NSBundle (GID3PAdditions)

+ (nullable NSBundle *)gid_frameworkBundle {
NSString* mainBundlePath = [[NSBundle mainBundle] resourcePath];
NSString* frameworkBundlePath = [mainBundlePath
stringByAppendingPathComponent:@"GoogleSignIn.bundle"];
return [NSBundle bundleWithPath:frameworkBundlePath];
// Look for the resource bundle in the main bundle.
NSString *path = [[NSBundle mainBundle] pathForResource:GoogleSignInBundleName
ofType:@"bundle"];
if (!path) {
// If we can't find the resource bundle in the main bundle, use the framework bundle instead.
NSString *path = [[NSBundle mainBundle] pathForResource:GoogleSignInBundleName
ofType:@"framework"];
}
return [NSBundle bundleWithPath:path];
}

+ (void)gid_registerFonts {
Expand Down
File renamed without changes
5 changes: 5 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ let googleSignInVersion = "6.0.0"

let package = Package(
name: "GoogleSignIn",
defaultLocalization: "en",
platforms: [.iOS(.v9)],
products: [
.library(
Expand Down Expand Up @@ -59,6 +60,10 @@ let package = Package(
.product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
],
path: "GoogleSignIn/Sources",
resources: [
.process("Resources"),
.process("Strings"),
],
publicHeadersPath: "Public",
cSettings: [
.headerSearchPath("../../"),
Expand Down

0 comments on commit 1298f57

Please sign in to comment.