Browse Source

Refactor resources for SPM and CocoaPods.

Peter Andrews 5 years ago
parent
commit
1298f578a8
46 changed files with 23 additions and 29 deletions
  1. 3 1
      GoogleSignIn.podspec
  2. 0 24
      GoogleSignIn/Resources/GoogleSignIn.bundle/Info.plist
  3. 15 4
      GoogleSignIn/Sources/NSBundle+GID3PAdditions.m
  4. 0 0
      GoogleSignIn/Sources/Resources/Roboto-Bold.ttf
  5. 0 0
      GoogleSignIn/Sources/Resources/google.png
  6. 0 0
      GoogleSignIn/Sources/Resources/google@2x.png
  7. 0 0
      GoogleSignIn/Sources/Resources/google@3x.png
  8. 0 0
      GoogleSignIn/Sources/Strings/ar.lproj/GoogleSignIn.strings
  9. 0 0
      GoogleSignIn/Sources/Strings/ca.lproj/GoogleSignIn.strings
  10. 0 0
      GoogleSignIn/Sources/Strings/cs.lproj/GoogleSignIn.strings
  11. 0 0
      GoogleSignIn/Sources/Strings/da.lproj/GoogleSignIn.strings
  12. 0 0
      GoogleSignIn/Sources/Strings/de.lproj/GoogleSignIn.strings
  13. 0 0
      GoogleSignIn/Sources/Strings/el.lproj/GoogleSignIn.strings
  14. 0 0
      GoogleSignIn/Sources/Strings/en.lproj/GoogleSignIn.strings
  15. 0 0
      GoogleSignIn/Sources/Strings/en_GB.lproj/GoogleSignIn.strings
  16. 0 0
      GoogleSignIn/Sources/Strings/es.lproj/GoogleSignIn.strings
  17. 0 0
      GoogleSignIn/Sources/Strings/es_MX.lproj/GoogleSignIn.strings
  18. 0 0
      GoogleSignIn/Sources/Strings/fi.lproj/GoogleSignIn.strings
  19. 0 0
      GoogleSignIn/Sources/Strings/fr.lproj/GoogleSignIn.strings
  20. 0 0
      GoogleSignIn/Sources/Strings/fr_CA.lproj/GoogleSignIn.strings
  21. 0 0
      GoogleSignIn/Sources/Strings/he.lproj/GoogleSignIn.strings
  22. 0 0
      GoogleSignIn/Sources/Strings/hi.lproj/GoogleSignIn.strings
  23. 0 0
      GoogleSignIn/Sources/Strings/hr.lproj/GoogleSignIn.strings
  24. 0 0
      GoogleSignIn/Sources/Strings/hu.lproj/GoogleSignIn.strings
  25. 0 0
      GoogleSignIn/Sources/Strings/id.lproj/GoogleSignIn.strings
  26. 0 0
      GoogleSignIn/Sources/Strings/it.lproj/GoogleSignIn.strings
  27. 0 0
      GoogleSignIn/Sources/Strings/ja.lproj/GoogleSignIn.strings
  28. 0 0
      GoogleSignIn/Sources/Strings/ko.lproj/GoogleSignIn.strings
  29. 0 0
      GoogleSignIn/Sources/Strings/ms.lproj/GoogleSignIn.strings
  30. 0 0
      GoogleSignIn/Sources/Strings/nb.lproj/GoogleSignIn.strings
  31. 0 0
      GoogleSignIn/Sources/Strings/nl.lproj/GoogleSignIn.strings
  32. 0 0
      GoogleSignIn/Sources/Strings/pl.lproj/GoogleSignIn.strings
  33. 0 0
      GoogleSignIn/Sources/Strings/pt.lproj/GoogleSignIn.strings
  34. 0 0
      GoogleSignIn/Sources/Strings/pt_BR.lproj/GoogleSignIn.strings
  35. 0 0
      GoogleSignIn/Sources/Strings/pt_PT.lproj/GoogleSignIn.strings
  36. 0 0
      GoogleSignIn/Sources/Strings/ro.lproj/GoogleSignIn.strings
  37. 0 0
      GoogleSignIn/Sources/Strings/ru.lproj/GoogleSignIn.strings
  38. 0 0
      GoogleSignIn/Sources/Strings/sk.lproj/GoogleSignIn.strings
  39. 0 0
      GoogleSignIn/Sources/Strings/sv.lproj/GoogleSignIn.strings
  40. 0 0
      GoogleSignIn/Sources/Strings/th.lproj/GoogleSignIn.strings
  41. 0 0
      GoogleSignIn/Sources/Strings/tr.lproj/GoogleSignIn.strings
  42. 0 0
      GoogleSignIn/Sources/Strings/uk.lproj/GoogleSignIn.strings
  43. 0 0
      GoogleSignIn/Sources/Strings/vi.lproj/GoogleSignIn.strings
  44. 0 0
      GoogleSignIn/Sources/Strings/zh_CN.lproj/GoogleSignIn.strings
  45. 0 0
      GoogleSignIn/Sources/Strings/zh_TW.lproj/GoogleSignIn.strings
  46. 5 0
      Package.swift

+ 3 - 1
GoogleSignIn.podspec

@@ -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}"'

+ 0 - 24
GoogleSignIn/Resources/GoogleSignIn.bundle/Info.plist

@@ -1,24 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-	<key>CFBundleDevelopmentRegion</key>
-	<string>English</string>
-	<key>CFBundleIconFile</key>
-	<string></string>
-	<key>CFBundleIdentifier</key>
-	<string>com.google.${PRODUCT_NAME:rfc1034identifier}</string>
-	<key>CFBundleInfoDictionaryVersion</key>
-	<string>6.0</string>
-	<key>CFBundleName</key>
-	<string>${PRODUCT_NAME}</string>
-	<key>CFBundlePackageType</key>
-	<string>BNDL</string>
-	<key>CFBundleShortVersionString</key>
-	<string>1.0</string>
-	<key>CFBundleVersion</key>
-	<string>1</string>
-	<key>NSPrincipalClass</key>
-	<string></string>
-</dict>
-</plist>

+ 15 - 4
GoogleSignIn/Sources/NSBundle+GID3PAdditions.m

@@ -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 {

+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/Roboto-Bold.ttf → GoogleSignIn/Sources/Resources/Roboto-Bold.ttf


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/google.png → GoogleSignIn/Sources/Resources/google.png


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/google@2x.png → GoogleSignIn/Sources/Resources/google@2x.png


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/google@3x.png → GoogleSignIn/Sources/Resources/google@3x.png


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ar.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ar.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ca.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ca.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/cs.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/cs.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/da.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/da.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/de.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/de.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/el.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/el.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/en.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/en.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/en_GB.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/en_GB.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/es.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/es.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/es_MX.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/es_MX.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/fi.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/fi.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/fr.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/fr.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/fr_CA.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/fr_CA.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/he.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/he.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/hi.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/hi.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/hr.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/hr.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/hu.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/hu.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/id.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/id.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/it.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/it.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ja.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ja.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ko.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ko.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ms.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ms.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/nb.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/nb.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/nl.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/nl.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/pl.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/pl.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/pt.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/pt.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/pt_BR.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/pt_BR.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/pt_PT.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/pt_PT.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ro.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ro.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/ru.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/ru.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/sk.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/sk.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/sv.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/sv.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/th.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/th.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/tr.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/tr.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/uk.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/uk.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/vi.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/vi.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/zh_CN.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/zh_CN.lproj/GoogleSignIn.strings


+ 0 - 0
GoogleSignIn/Resources/GoogleSignIn.bundle/zh_TW.lproj/GoogleSignIn.strings → GoogleSignIn/Sources/Strings/zh_TW.lproj/GoogleSignIn.strings


+ 5 - 0
Package.swift

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