Browse Source

Remove Functions ObjC (#9333)

Paul Beusterien 4 years ago
parent
commit
74fa16f236
75 changed files with 110 additions and 4293 deletions
  1. 0 1
      .github/workflows/combine.yml
  2. 13 34
      .github/workflows/functions.yml
  3. 2 2
      .github/workflows/prerelease.yml
  4. 1 1
      .github/workflows/release.yml
  5. 1 1
      .github/workflows/spectesting.yml
  6. 2 2
      CoreOnly/Sources/Firebase.h
  7. 4 0
      CoreOnly/Tests/FirebasePodTest/Podfile
  8. 1 2
      FirebaseCombineSwift.podspec
  9. 1 1
      FirebaseCombineSwift/Sources/Functions/HTTPSCallable+Combine.swift
  10. 0 3
      FirebaseCombineSwift/Tests/Unit/FirebaseCombine-unit-Bridging-Header.h
  11. 26 44
      FirebaseFunctions.podspec
  12. 0 0
      FirebaseFunctions/Sources/Codable/Callable+Codable.swift
  13. 0 69
      FirebaseFunctions/Sources/FIRFunctions+Internal.h
  14. 0 355
      FirebaseFunctions/Sources/FIRFunctions.m
  15. 0 42
      FirebaseFunctions/Sources/FIRFunctionsComponent.h
  16. 0 127
      FirebaseFunctions/Sources/FIRFunctionsComponent.m
  17. 0 30
      FirebaseFunctions/Sources/FIRFunctions_Private.h
  18. 0 46
      FirebaseFunctions/Sources/FIRHTTPSCallable+Internal.h
  19. 0 75
      FirebaseFunctions/Sources/FIRHTTPSCallable.m
  20. 0 53
      FirebaseFunctions/Sources/FUNContext.h
  21. 0 126
      FirebaseFunctions/Sources/FUNContext.m
  22. 0 44
      FirebaseFunctions/Sources/FUNError.h
  23. 0 196
      FirebaseFunctions/Sources/FUNError.m
  24. 0 33
      FirebaseFunctions/Sources/FUNSerializer.h
  25. 0 239
      FirebaseFunctions/Sources/FUNSerializer.m
  26. 0 38
      FirebaseFunctions/Sources/FUNUsageValidation.h
  27. 0 28
      FirebaseFunctions/Sources/FUNUsageValidation.m
  28. 1 1
      FirebaseFunctions/Sources/Functions.swift
  29. 0 0
      FirebaseFunctions/Sources/FunctionsComponent.swift
  30. 0 0
      FirebaseFunctions/Sources/FunctionsContext.swift
  31. 1 1
      FirebaseFunctions/Sources/FunctionsError.swift
  32. 0 0
      FirebaseFunctions/Sources/FunctionsSerializer.swift
  33. 2 2
      FirebaseFunctions/Sources/HTTPSCallable.swift
  34. 0 94
      FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h
  35. 0 104
      FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h
  36. 0 96
      FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h
  37. 0 19
      FirebaseFunctions/Sources/Public/FirebaseFunctions/FirebaseFunctions.h
  38. 1 1
      FirebaseFunctions/Tests/CombineUnit/HTTPSCallableTests.swift
  39. 0 244
      FirebaseFunctions/Tests/Integration/FIRIntegrationTests.m
  40. 1 1
      FirebaseFunctions/Tests/Integration/IntegrationTests.swift
  41. 1 3
      FirebaseFunctions/Tests/ObjCIntegration/FIRFunctions+Internal.h
  42. 2 2
      FirebaseFunctions/Tests/ObjCIntegration/FIRIntegrationTests.m
  43. 0 33
      FirebaseFunctions/Tests/SwiftIntegration/APITests.swift
  44. 0 482
      FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift
  45. 1 1
      FirebaseFunctions/Tests/Unit/ContextProviderTests.swift
  46. 0 256
      FirebaseFunctions/Tests/Unit/FIRFunctionsTests.m
  47. 0 192
      FirebaseFunctions/Tests/Unit/FUNContextProviderTests.m
  48. 0 240
      FirebaseFunctions/Tests/Unit/FUNSerializerTests.m
  49. 0 2
      FirebaseFunctions/Tests/Unit/FunctionsAPITests.swift
  50. 1 1
      FirebaseFunctions/Tests/Unit/FunctionsTests.swift
  51. 1 1
      FirebaseFunctions/Tests/Unit/SerializerTests.swift
  52. 0 57
      FirebaseFunctionsSwift.podspec
  53. 0 3
      FirebaseFunctionsSwift/CHANGELOG.md
  54. 0 142
      FirebaseFunctionsSwift/Tests/Unit/FunctionsAPITests.swift
  55. 0 60
      FirebaseFunctionsTestingSupport.podspec
  56. 0 36
      FirebaseTestingSupport/Functions/Sources/FIRFunctionsFake.m
  57. 0 32
      FirebaseTestingSupport/Functions/Sources/FIRHTTPSCallableFake.m
  58. 0 72
      FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctions+Testing.h
  59. 0 38
      FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctionsFake.h
  60. 0 49
      FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRHTTPSCallable+Testing.h
  61. 0 29
      FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRHTTPSCallableFake.h
  62. 12 67
      Package.swift
  63. 0 1
      ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift
  64. 4 0
      ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift
  65. 0 2
      SwiftPMTests/objc-import-test/objc-header.m
  66. 1 1
      SwiftPMTests/swift-test/main.swift
  67. 1 1
      scripts/health_metrics/file_patterns.json
  68. 2 0
      scripts/localize_podfile.swift
  69. 9 9
      scripts/spm_test_schemes/FirebaseFunctionsIntegration.xcscheme
  70. 9 9
      scripts/spm_test_schemes/FirebaseFunctionsObjCIntegration.xcscheme
  71. 9 9
      scripts/spm_test_schemes/FirebaseFunctionsUnit.xcscheme
  72. 0 77
      scripts/spm_test_schemes/FunctionsIntegration.xcscheme
  73. 0 77
      scripts/spm_test_schemes/FunctionsSwiftIntegration.xcscheme
  74. 0 77
      scripts/spm_test_schemes/FunctionsUnit.xcscheme
  75. 0 77
      scripts/spm_test_schemes/FunctionsUnitSwift.xcscheme

+ 0 - 1
.github/workflows/combine.yml

@@ -22,7 +22,6 @@ on:
 
     # Podspecs
     - 'FirebaseCombineSwift.podspec'
-    - 'FirebaseFunctionsTestingSupport.podspec'
 
     # This workflow
     - '.github/workflows/combine.yml'

+ 13 - 34
.github/workflows/functions.yml

@@ -32,7 +32,6 @@ jobs:
       matrix:
         # TODO: The --skip-tests might be removable with Xcode 13.2+
         target: [ios, tvos, macos --skip-tests, watchos]
-        podspec: [ 'FirebaseFunctions.podspec', 'FirebaseFunctionsSwift.podspec']
     steps:
     - uses: actions/checkout@v2
     - name: Setup Bundler
@@ -41,9 +40,9 @@ jobs:
       run: FirebaseFunctions/Backend/start.sh synchronous
     - name: Build and test
       run: |
-        scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb ${{ matrix.podspec }} --platforms=${{ matrix.target }}
+        scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb FirebaseFunctions.podspec --platforms=${{ matrix.target }}
 
-  spm:
+  spm-integration:
     # Don't run on private repo unless it is a PR.
     if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
     runs-on: macos-11
@@ -56,28 +55,24 @@ jobs:
         cache_key: ${{ matrix.os }}
     - name: Initialize xcodebuild
       run: scripts/setup_spm_tests.sh
-    - name: iOS Unit Tests
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsUnit iOS spm
     - name: Integration Test Server
       run: FirebaseFunctions/Backend/start.sh synchronous
-    - name: iOS Swift Integration Tests (Objective C library)
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsSwiftIntegration iOS spm
+    - name: Functions Unit Tests
+      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsUnit iOS spm
     - name: iOS Swift Integration Tests (including Swift library)
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsSwiftIntegration iOS spm
+      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsIntegration iOS spm
     - name: iOS ObjC Integration Tests (using Swift library)
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsSwiftObjCIntegration iOS spm
-    - name: iOS Objective C Integration Tests
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsIntegration iOS spm
+      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsObjCIntegration iOS spm
     - name: Combine Unit Tests
       run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsCombineUnit iOS spm
 
-  spm-cron:
+  spm-unit:
     # Don't run on private repo.
-    if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
+    if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
     runs-on: macos-11
     strategy:
       matrix:
-        target: [tvOS, macOS, catalyst, watchOS]
+        target: [iOS, tvOS, macOS, catalyst, watchOS]
     steps:
     - uses: actions/checkout@v2
     - uses: mikehardy/buildcache-action@50738c6c77de7f34e66b870e4f8ede333b69d077
@@ -86,24 +81,8 @@ jobs:
     - name: Initialize xcodebuild
       run: scripts/setup_spm_tests.sh
     - name: Unit Tests
-      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FunctionsUnit ${{ matrix.target }} spm
-
-  catalyst:
-    # Don't run on private repo unless it is a PR.
-    if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
-
-    runs-on: macos-11
-    steps:
-    - uses: actions/checkout@v2
-    - uses: mikehardy/buildcache-action@50738c6c77de7f34e66b870e4f8ede333b69d077
-      with:
-        cache_key: ${{ matrix.os }}
-    - name: Setup Bundler
-      run: scripts/setup_bundler.sh
-    - name: Setup project and Build for Catalyst
-      run: scripts/test_catalyst.sh FirebaseFunctions test FirebaseFunctions-Unit-unit
+      run: scripts/third_party/travis/retry.sh ./scripts/build.sh FirebaseFunctionsUnit ${{ matrix.target }} spm
 
-# Restore when FirebaseUI works with Firebase 7 (#6646)
   quickstart:
     # Don't run on private repo unless it is a PR.
     if: (github.repository == 'Firebase/firebase-ios-sdk' && github.event_name == 'schedule') || github.event_name == 'pull_request'
@@ -131,7 +110,8 @@ jobs:
 
   functions-cron-only:
     # Don't run on private repo.
-    if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
+# TODO: Uncomment below
+#    if: github.event_name == 'schedule' && github.repository == 'Firebase/firebase-ios-sdk'
 
     runs-on: macos-11
     strategy:
@@ -139,7 +119,6 @@ jobs:
         target: [ios, tvos, macos]
         flags: [
           '--use-static-frameworks',
-          '--use-libraries --skip-tests'
         ]
     needs: pod-lib-lint
     steps:
@@ -151,4 +130,4 @@ jobs:
     - name: PodLibLint Functions Cron
       run: |
         scripts/third_party/travis/retry.sh scripts/pod_lib_lint.rb \
-          FirebaseFunctions.podspec --platforms=${{ matrix.target }} ${{ matrix.flags }}
+          FirebaseFunctions.podspec --platforms=${{ matrix.target }} --use-static-frameworks

+ 2 - 2
.github/workflows/prerelease.yml

@@ -44,7 +44,7 @@ jobs:
         cd scripts/create_spec_repo/
         swift build
         pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
-        BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" --exclude-pods "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" "FirebaseFunctionsTestingSupport"
+        BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" --exclude-pods "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift"
     - name: Clean Artifacts
       if: ${{ always() }}
       run: |
@@ -97,7 +97,7 @@ jobs:
         cd scripts/create_spec_repo/
         swift build
         pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/Firebase/SpecsTesting.git
-        BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" "FirebaseFunctionsTestingSupport" --keep-repo --include-pods "${updated_podspecs[@]}"
+        BOT_TOKEN="${botaccess}" .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --sdk-repo-name SpecsTesting --github-account Firebase --pod-sources 'https://${BOT_TOKEN}@github.com/Firebase/SpecsTesting' "https://github.com/firebase/SpecsDev.git" "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" --keep-repo --include-pods "${updated_podspecs[@]}"
 
   abtesting_quickstart:
     # Don't run on private repo unless it is a PR.

+ 1 - 1
.github/workflows/release.yml

@@ -45,7 +45,7 @@ jobs:
         cd scripts/create_spec_repo/
         swift build
         pod repo add --silent "${local_repo}" https://"$botaccess"@github.com/FirebasePrivate/SpecsTesting.git
-        BOT_TOKEN="${botaccess}"  .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting' "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" --exclude-pods "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift" "FirebaseFunctionsTestingSupport"
+        BOT_TOKEN="${botaccess}"  .build/debug/spec-repo-builder --sdk-repo "${local_sdk_repo_dir}" --local-spec-repo-name "${local_repo}" --pod-sources 'https://${BOT_TOKEN}@github.com/FirebasePrivate/SpecsTesting' "https://github.com/firebase/SpecsStaging.git" "https://cdn.cocoapods.org/" --exclude-pods "FirebaseFirestoreTestingSupport" "FirebaseAuthTestingSupport" "FirebaseCombineSwift"
     - name: Clean Artifacts
       if: ${{ always() }}
       run: |

+ 1 - 1
.github/workflows/spectesting.yml

@@ -37,7 +37,7 @@ jobs:
         # the workflow.
         # If multiple podspecs need to be excluded, escaping space is required
         # to split podspecs, e.g. get_updated_files.sh ... -e Firebase.podspec\ FirebaseABTesting.podspec
-        ./scripts/health_metrics/get_updated_files.sh -p output.json -e Firebase.podspec\ FirebaseFunctionsSwift.podspec
+        ./scripts/health_metrics/get_updated_files.sh -p output.json -e Firebase.podspec\ FirebaseFunctions.podspec
         echo "::set-output name=matrix::{\"include\":$( cat output.json )}"
         # `podspecs` is to help determine if specs_testing job should be run.
         echo "::set-output name=podspecs::$(cat output.json)"

+ 2 - 2
CoreOnly/Sources/Firebase.h

@@ -50,8 +50,8 @@
     #import <FirebaseFirestore/FirebaseFirestore.h>
   #endif
 
-  #if __has_include(<FirebaseFunctions/FirebaseFunctions.h>)
-    #import <FirebaseFunctions/FirebaseFunctions.h>
+  #if __has_include("FirebaseFunctions-umbrella.h")
+@import FirebaseFunctions;
   #endif
 
   #if __has_include(<FirebaseInAppMessaging/FirebaseInAppMessaging.h>)

+ 4 - 0
CoreOnly/Tests/FirebasePodTest/Podfile

@@ -32,7 +32,11 @@ target 'FirebasePodTest' do
   pod 'FirebaseStorageSwift', :path => '../../../'
 
   # Get dependent pods from the repo also
+  pod 'FirebaseAppCheckInterop', :path => '../../../'
+  pod 'FirebaseAuthInterop', :path => '../../../'
+  pod 'FirebaseMessagingInterop', :path => '../../../'
   pod 'FirebaseCoreDiagnostics', :path => '../../../'
+  pod 'FirebaseCoreInternal', :path => '../../../'
 
   pod 'FirebaseAnalytics' # Analytics is not open source
 end

+ 1 - 2
FirebaseCombineSwift.podspec

@@ -53,7 +53,7 @@ for internal testing only. It should not be published.
 
   s.dependency 'FirebaseCore', '~> 8.0'
   s.dependency 'FirebaseAuth', '~> 8.0'
-  s.dependency 'FirebaseFunctions', '~> 8.0'
+  s.dependency 'FirebaseFunctions', '~> 8.12'
   s.dependency 'FirebaseFirestore', '~> 8.0'
   s.dependency 'FirebaseStorage', '~> 8.0'
   s.dependency 'FirebaseStorageSwift', '~> 8.0-beta'
@@ -82,7 +82,6 @@ for internal testing only. It should not be published.
     }
     unit_tests.dependency 'OCMock'
     unit_tests.dependency 'FirebaseAuthTestingSupport'
-    unit_tests.dependency 'FirebaseFunctionsTestingSupport'
     unit_tests.dependency 'FirebaseFirestoreTestingSupport'
   end
 

+ 1 - 1
FirebaseCombineSwift/Sources/Functions/HTTPSCallable+Combine.swift

@@ -15,7 +15,7 @@
 #if canImport(Combine) && swift(>=5.0)
 
   import Combine
-  import FirebaseFunctionsSwift
+  import FirebaseFunctions
 
   @available(swift 5.0)
   @available(iOS 13.0, macOS 10.15, macCatalyst 13.0, tvOS 13.0, *)

+ 0 - 3
FirebaseCombineSwift/Tests/Unit/FirebaseCombine-unit-Bridging-Header.h

@@ -21,9 +21,6 @@
 // Firebase Core
 #import "FirebaseCore/Internal/FirebaseCoreInternal.h"
 
-// Firebase Functions
-#import "FirebaseFunctions/Sources/FIRFunctions+Internal.h"
-
 // Firebase Auth
 #import <FirebaseAuth/FIRAuth.h>
 #import <FirebaseAuth/FirebaseAuth.h>

+ 26 - 44
FirebaseFunctions.podspec

@@ -10,63 +10,45 @@ Cloud Functions for Firebase.
   s.homepage         = 'https://developers.google.com/'
   s.license          = { :type => 'Apache', :file => 'LICENSE' }
   s.authors          = 'Google, Inc.'
+
   s.source           = {
-    :git => 'https://github.com/firebase/firebase-ios-sdk.git',
+    :git => 'https://github.com/Firebase/firebase-ios-sdk.git',
     :tag => 'CocoaPods-' + s.version.to_s
   }
 
-  s.ios.deployment_target = '10.0'
-  s.osx.deployment_target = '10.12'
-  s.tvos.deployment_target = '10.0'
-  s.watchos.deployment_target = '6.0'
+  s.swift_version    = '5.3'
+
+  ios_deployment_target = '10.0'
+  osx_deployment_target = '10.12'
+  tvos_deployment_target = '10.0'
+  watchos_deployment_target = '6.0'
+
+  s.ios.deployment_target = ios_deployment_target
+  s.osx.deployment_target = osx_deployment_target
+  s.tvos.deployment_target = tvos_deployment_target
+  s.watchos.deployment_target = watchos_deployment_target
 
   s.cocoapods_version = '>= 1.4.0'
   s.prefix_header_file = false
 
   s.source_files = [
-    'FirebaseFunctions/Sources/**/*',
-    'FirebaseAuth/Interop/*.h',
-    'FirebaseAppCheck/Interop/*.h',
-    'FirebaseCore/Internal/*.h',
-    'FirebaseMessaging/Interop/FIRMessagingInterop.h',
+    'FirebaseFunctions/Sources/**/*.swift',
   ]
-  s.public_header_files = 'FirebaseFunctions/Sources/Public/FirebaseFunctions/*.h'
 
-  s.dependency 'FirebaseCore', '~> 8.0'
+  s.dependency 'FirebaseCore', '~> 8.12'
+  s.dependency 'FirebaseCoreInternal', '~> 8.12'
+  s.dependency 'FirebaseAppCheckInterop', '~> 8.12'
+  s.dependency 'FirebaseAuthInterop', '~> 8.12'
+  s.dependency 'FirebaseMessagingInterop', '~> 8.12'
+  s.dependency 'FirebaseSharedSwift', '~> 8.12'
   s.dependency 'GTMSessionFetcher/Core', '~> 1.5'
 
-  s.pod_target_xcconfig = {
-    'GCC_C_LANGUAGE_STANDARD' => 'c99',
-    'HEADER_SEARCH_PATHS' => '"${PODS_TARGET_SRCROOT}"'
-  }
-
-  s.test_spec 'unit' do |unit_tests|
-    unit_tests.scheme = { :code_coverage => true }
-    unit_tests.source_files = [
-      'FirebaseFunctions/Tests/Unit/*.[mh]',
-      'FirebaseFunctions/Tests/SwiftUnit/**/*',
-      'SharedTestUtilities/FIRAuthInteropFake*',
-      'SharedTestUtilities/FIRMessagingInteropFake*',
-      'SharedTestUtilities/AppCheckFake/*.[mh]',
-  ]
-  end
-
   s.test_spec 'integration' do |int_tests|
-    int_tests.scheme = { :code_coverage => true }
-    int_tests.source_files = 'FirebaseFunctions/Tests/Integration/*.[mh]',
-                             'SharedTestUtilities/FIRAuthInteropFake*',
-                             'SharedTestUtilities/FIRMessagingInteropFake*'
-  end
-
-  # Using environment variable because of the dependency on the unpublished
-  # FirebaseFunctionsTestingSupport.
-  if ENV['POD_LIB_LINT_ONLY'] && ENV['POD_LIB_LINT_ONLY'] == '1' then
-    s.test_spec 'swift-integration' do |swift_int|
-      swift_int.platforms = {:ios => '15.0', :osx => '12.0', :tvos => '15.0', :watchos => '8.0'}
-      swift_int.scheme = { :code_coverage => true }
-      swift_int.dependency 'FirebaseFunctionsTestingSupport'
-      swift_int.source_files = 'FirebaseFunctions/Tests/SwiftIntegration/*',
-                               'FirebaseTestingSupport/Functions/Sources/*'
-    end
+    int_tests.platforms = {
+      :ios => ios_deployment_target,
+      :osx => osx_deployment_target,
+      :tvos => tvos_deployment_target
+    }
+    int_tests.source_files = 'FirebaseFunctions/Tests/Integration/*.swift'
   end
 end

+ 0 - 0
FirebaseFunctionsSwift/Sources/Codable/Callable+Codable.swift → FirebaseFunctions/Sources/Codable/Callable+Codable.swift


+ 0 - 69
FirebaseFunctions/Sources/FIRFunctions+Internal.h

@@ -1,69 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
-
-@protocol FIRAppCheckInterop;
-@protocol FIRAuthInterop;
-@protocol FIRMessagingInterop;
-@class FIRHTTPSCallableResult;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRFunctions (Internal)
-
-/**
- * Calls an http trigger endpoint.
- * @param name The name of the http trigger.
- * @param data Parameters to pass to the function. Can be anything encodable as JSON.
- * @param completion The block to call when the request is complete.
- */
-- (void)callFunction:(NSString *)name
-          withObject:(nullable id)data
-             timeout:(NSTimeInterval)timeout
-          completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                               NSError *_Nullable error))completion;
-
-/**
- * Constructs the url for an http trigger. This is exposed only for testing.
- * @param name The name of the endpoint.
- */
-- (NSString *)URLWithName:(NSString *)name;
-
-/**
- * Sets the functions client to send requests to localhost instead of Firebase.
- * For testing only.
- */
-- (void)useLocalhost;
-
-/**
- * Internal initializer for the Cloud Functions client.
- * @param projectID The project ID for the Firebase project.
- * @param region The region for the http trigger, such as "us-central1".
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
- * @param auth The auth provider to use (optional).
- * @param messaging The messaging interop to use (optional).
- */
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 355
FirebaseFunctions/Sources/FIRFunctions.m

@@ -1,355 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseCore/Internal/FirebaseCoreInternal.h"
-
-#import "FirebaseFunctions/Sources/FIRFunctions+Internal.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
-
-#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
-#import "FirebaseAuth/Interop/FIRAuthInterop.h"
-#import "FirebaseFunctions/Sources/FIRFunctionsComponent.h"
-#import "FirebaseMessaging/Interop/FIRMessagingInterop.h"
-
-#import "FirebaseFunctions/Sources/FIRHTTPSCallable+Internal.h"
-#import "FirebaseFunctions/Sources/FUNContext.h"
-#import "FirebaseFunctions/Sources/FUNError.h"
-#import "FirebaseFunctions/Sources/FUNSerializer.h"
-#import "FirebaseFunctions/Sources/FUNUsageValidation.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h"
-
-#if SWIFT_PACKAGE
-@import GTMSessionFetcherCore;
-#else
-#import <GTMSessionFetcher/GTMSessionFetcherService.h>
-#endif
-
-NS_ASSUME_NONNULL_BEGIN
-
-NSString *const kFUNAppCheckTokenHeader = @"X-Firebase-AppCheck";
-NSString *const kFUNFCMTokenHeader = @"Firebase-Instance-ID-Token";
-NSString *const kFUNDefaultRegion = @"us-central1";
-
-@interface FIRFunctions () {
-  // The network client to use for http requests.
-  GTMSessionFetcherService *_fetcherService;
-  // The projectID to use for all function references.
-  NSString *_projectID;
-  // The region to use for all function references.
-  NSString *_region;
-  // The custom domain to use for all functions references (optional).
-  NSString *_customDomain;
-  // A serializer to encode/decode data and return values.
-  FUNSerializer *_serializer;
-  // A factory for getting the metadata to include with function calls.
-  FUNContextProvider *_contextProvider;
-  // For testing only. If this is set, functions will be called against it instead of Firebase.
-  NSString *_emulatorOrigin;
-}
-
-// Re-declare this initializer here in order to attribute it as the designated initializer.
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck
-                   fetcherService:(GTMSessionFetcherService *)fetcherService
-    NS_DESIGNATED_INITIALIZER;
-
-@end
-
-@implementation FIRFunctions
-
-+ (instancetype)functions {
-  return [self functionsForApp:[FIRApp defaultApp] region:kFUNDefaultRegion customDomain:nil];
-}
-
-+ (instancetype)functionsForApp:(FIRApp *)app {
-  return [self functionsForApp:app region:kFUNDefaultRegion customDomain:nil];
-}
-
-+ (instancetype)functionsForRegion:(NSString *)region {
-  return [self functionsForApp:[FIRApp defaultApp] region:region customDomain:nil];
-}
-
-+ (instancetype)functionsForCustomDomain:(NSString *)customDomain {
-  return [self functionsForApp:[FIRApp defaultApp]
-                        region:kFUNDefaultRegion
-                  customDomain:customDomain];
-}
-
-+ (instancetype)functionsForApp:(FIRApp *)app region:(NSString *)region {
-  return [self functionsForApp:app region:region customDomain:nil];
-}
-
-+ (instancetype)functionsForApp:(FIRApp *)app customDomain:(NSString *)customDomain {
-  return [self functionsForApp:app region:kFUNDefaultRegion customDomain:customDomain];
-}
-
-+ (instancetype)functionsForApp:(FIRApp *)app
-                         region:(NSString *)region
-                   customDomain:(nullable NSString *)customDomain {
-  id<FIRFunctionsProvider> provider = FIR_COMPONENT(FIRFunctionsProvider, app.container);
-  return [provider functionsForApp:app region:region customDomain:customDomain type:[self class]];
-}
-
-- (instancetype)initWithApp:(FIRApp *)app
-                     region:(NSString *)region
-               customDomain:(nullable NSString *)customDomain {
-  return [self initWithProjectID:app.options.projectID
-                          region:region
-                    customDomain:customDomain
-                            auth:FIR_COMPONENT(FIRAuthInterop, app.container)
-                       messaging:FIR_COMPONENT(FIRMessagingInterop, app.container)
-                        appCheck:FIR_COMPONENT(FIRAppCheckInterop, app.container)];
-}
-
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck {
-  return [self initWithProjectID:projectID
-                          region:region
-                    customDomain:customDomain
-                            auth:auth
-                       messaging:messaging
-                        appCheck:appCheck
-                  fetcherService:[[GTMSessionFetcherService alloc] init]];
-}
-
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck
-                   fetcherService:(GTMSessionFetcherService *)fetcherService {
-  self = [super init];
-  if (self) {
-    if (!region) {
-      FUNThrowInvalidArgument(@"FIRFunctions region cannot be nil.");
-    }
-    _fetcherService = fetcherService;
-    _projectID = [projectID copy];
-    _region = [region copy];
-    _customDomain = [customDomain copy];
-    _serializer = [[FUNSerializer alloc] init];
-    _contextProvider = [[FUNContextProvider alloc] initWithAuth:auth
-                                                      messaging:messaging
-                                                       appCheck:appCheck];
-    _emulatorOrigin = nil;
-  }
-  return self;
-}
-
-- (void)useLocalhost {
-  [self useEmulatorWithHost:@"localhost" port:5005];
-}
-
-- (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port {
-  NSAssert(host.length > 0, @"Cannot connect to nil or empty host");
-  NSString *prefix = [host hasPrefix:@"http"] ? @"" : @"http://";
-  NSString *origin = [NSString stringWithFormat:@"%@%@:%li", prefix, host, (long)port];
-  _emulatorOrigin = origin;
-}
-
-- (void)useFunctionsEmulatorOrigin:(NSString *)origin {
-  _emulatorOrigin = origin;
-}
-
-- (NSString *)URLWithName:(NSString *)name {
-  if (!name) {
-    FUNThrowInvalidArgument(@"FIRFunctions function name cannot be nil.");
-  }
-  if (!_projectID) {
-    FUNThrowInvalidArgument(@"FIRFunctions app projectID cannot be nil.");
-  }
-  if (_emulatorOrigin) {
-    return [NSString stringWithFormat:@"%@/%@/%@/%@", _emulatorOrigin, _projectID, _region, name];
-  }
-  if (_customDomain) {
-    return [NSString stringWithFormat:@"%@/%@", _customDomain, name];
-  }
-  return
-      [NSString stringWithFormat:@"https://%@-%@.cloudfunctions.net/%@", _region, _projectID, name];
-}
-
-- (void)callFunction:(NSString *)name
-          withObject:(nullable id)data
-             timeout:(NSTimeInterval)timeout
-          completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                               NSError *_Nullable error))completion {
-  [_contextProvider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    if (error) {
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-    return [self callFunction:name
-                   withObject:data
-                      timeout:timeout
-                      context:context
-                   completion:completion];
-  }];
-}
-
-- (void)callFunction:(NSString *)name
-          withObject:(nullable id)data
-             timeout:(NSTimeInterval)timeout
-             context:(FUNContext *)context
-          completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                               NSError *_Nullable error))completion {
-  NSURL *url = [NSURL URLWithString:[self URLWithName:name]];
-  NSURLRequest *request = [NSURLRequest requestWithURL:url
-                                           cachePolicy:NSURLRequestUseProtocolCachePolicy
-                                       timeoutInterval:timeout];
-  GTMSessionFetcher *fetcher = [_fetcherService fetcherWithRequest:request];
-
-  NSMutableDictionary *body = [NSMutableDictionary dictionary];
-  // Encode the data in the body.
-  if (!data) {
-    data = [NSNull null];
-  }
-  id encoded = [_serializer encode:data];
-  if (!encoded) {
-    FUNThrowInvalidArgument(@"FIRFunctions data encoded as nil. This should not happen.");
-  }
-  body[@"data"] = encoded;
-
-  NSError *error = nil;
-  NSData *payload = [NSJSONSerialization dataWithJSONObject:body options:0 error:&error];
-  if (error) {
-    if (completion) {
-      dispatch_async(dispatch_get_main_queue(), ^{
-        completion(nil, error);
-      });
-    }
-    return;
-  }
-  fetcher.bodyData = payload;
-
-  // Set the headers.
-  [fetcher setRequestValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
-  if (context.authToken) {
-    NSString *value = [NSString stringWithFormat:@"Bearer %@", context.authToken];
-    [fetcher setRequestValue:value forHTTPHeaderField:@"Authorization"];
-  }
-  if (context.FCMToken) {
-    [fetcher setRequestValue:context.FCMToken forHTTPHeaderField:kFUNFCMTokenHeader];
-  }
-  if (context.appCheckToken) {
-    [fetcher setRequestValue:context.appCheckToken forHTTPHeaderField:kFUNAppCheckTokenHeader];
-  }
-
-  // Override normal security rules if this is a local test.
-  if (_emulatorOrigin) {
-    fetcher.allowLocalhostRequest = YES;
-    fetcher.allowedInsecureSchemes = @[ @"http" ];
-  }
-
-  FUNSerializer *serializer = _serializer;
-  [fetcher beginFetchWithCompletionHandler:^(NSData *_Nullable data, NSError *_Nullable error) {
-    // If there was an HTTP error, convert it to our own error domain.
-    if (error) {
-      if ([error.domain isEqualToString:kGTMSessionFetcherStatusDomain]) {
-        error = FUNErrorForResponse(error.code, data, serializer);
-      }
-      if ([error.domain isEqualToString:NSURLErrorDomain]) {
-        if (error.code == NSURLErrorTimedOut) {
-          error = FUNErrorForCode(FIRFunctionsErrorCodeDeadlineExceeded);
-        }
-      }
-    } else {
-      // If there wasn't an HTTP error, see if there was an error in the body.
-      error = FUNErrorForResponse(200, data, serializer);
-    }
-    // If there was an error, report it to the user and stop.
-    if (error) {
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-
-    id responseJSON = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
-    if (error) {
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-    if (![responseJSON isKindOfClass:[NSDictionary class]]) {
-      NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"Response was not a dictionary."};
-      error = [NSError errorWithDomain:FIRFunctionsErrorDomain
-                                  code:FIRFunctionsErrorCodeInternal
-                              userInfo:userInfo];
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-    id dataJSON = responseJSON[@"data"];
-    // TODO(klimt): Allow "result" instead of "data" for now, for backwards compatibility.
-    if (!dataJSON) {
-      dataJSON = responseJSON[@"result"];
-    }
-    if (!dataJSON) {
-      NSDictionary *userInfo = @{NSLocalizedDescriptionKey : @"Response is missing data field."};
-      error = [NSError errorWithDomain:FIRFunctionsErrorDomain
-                                  code:FIRFunctionsErrorCodeInternal
-                              userInfo:userInfo];
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-    id resultData = [serializer decode:dataJSON error:&error];
-    if (error) {
-      if (completion) {
-        completion(nil, error);
-      }
-      return;
-    }
-    id result = [[FIRHTTPSCallableResult alloc] initWithData:resultData];
-    if (completion) {
-      // If there's no result field, this will return nil, which is fine.
-      completion(result, nil);
-    }
-  }];
-}
-
-- (FIRHTTPSCallable *)HTTPSCallableWithName:(NSString *)name {
-  return [[FIRHTTPSCallable alloc] initWithFunctions:self name:name];
-}
-
-- (nullable NSString *)emulatorOrigin {
-  return _emulatorOrigin;
-}
-
-- (nullable NSString *)customDomain {
-  return _customDomain;
-}
-
-- (NSString *)region {
-  return _region;
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 42
FirebaseFunctions/Sources/FIRFunctionsComponent.h

@@ -1,42 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-@class FIRFunctions, FIRApp;
-
-NS_ASSUME_NONNULL_BEGIN
-
-/// This protocol is used in the interop registration process to register an
-/// instance provider for individual FIRApps.
-@protocol FIRFunctionsProvider
-
-- (FIRFunctions *)functionsForApp:(FIRApp *)app
-                           region:(nullable NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             type:(Class)cls;
-
-@end
-
-@interface FIRFunctionsComponent : NSObject <FIRFunctionsProvider>
-
-/// The FIRApp that instances will be set up with.
-@property(nonatomic, weak, readonly) FIRApp *app;
-
-/// Unavailable, use `functionsForApp:region:customDomain:` instead.
-- (instancetype)init NS_UNAVAILABLE;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 127
FirebaseFunctions/Sources/FIRFunctionsComponent.m

@@ -1,127 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <os/lock.h>
-
-#import "FirebaseFunctions/Sources/FIRFunctionsComponent.h"
-
-#import "FirebaseFunctions/Sources/FIRFunctions_Private.h"
-
-#import "FirebaseCore/Internal/FirebaseCoreInternal.h"
-
-#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
-#import "FirebaseAuth/Interop/FIRAuthInterop.h"
-#import "FirebaseMessaging/Interop/FIRMessagingInterop.h"
-
-@interface FIRFunctionsComponent () <FIRLibrary, FIRFunctionsProvider>
-
-/// A map of active instances, grouped by app. Keys are FIRApp names and values are arrays
-/// containing all instances of FIRFunctions associated with the given app.
-@property(nonatomic) NSMutableDictionary<NSString *, NSMutableArray<FIRFunctions *> *> *instances;
-
-/// Internal intializer.
-- (instancetype)initWithApp:(FIRApp *)app;
-
-@end
-
-@implementation FIRFunctionsComponent {
-  os_unfair_lock _instancesLock;
-}
-
-#pragma mark - Initialization
-
-- (instancetype)initWithApp:(FIRApp *)app {
-  self = [super init];
-  if (self) {
-    _app = app;
-    _instances = [NSMutableDictionary dictionary];
-    _instancesLock = OS_UNFAIR_LOCK_INIT;
-  }
-  return self;
-}
-
-#pragma mark - Lifecycle
-
-+ (void)load {
-  [FIRApp registerInternalLibrary:(Class<FIRLibrary>)self withName:@"fire-fun"];
-}
-
-#pragma mark - FIRComponentRegistrant
-
-+ (NSArray<FIRComponent *> *)componentsToRegister {
-  FIRComponentCreationBlock creationBlock =
-      ^id _Nullable(FIRComponentContainer *container, BOOL *isCacheable) {
-    *isCacheable = YES;
-    return [[self alloc] initWithApp:container.app];
-  };
-  FIRDependency *auth = [FIRDependency dependencyWithProtocol:@protocol(FIRAuthInterop)
-                                                   isRequired:NO];
-  FIRComponent *internalProvider =
-      [FIRComponent componentWithProtocol:@protocol(FIRFunctionsProvider)
-                      instantiationTiming:FIRInstantiationTimingLazy
-                             dependencies:@[ auth ]
-                            creationBlock:creationBlock];
-  return @[ internalProvider ];
-}
-
-#pragma mark - Instance management
-
-- (void)appWillBeDeleted:(FIRApp *)app {
-  NSString *appName = app.name;
-  if (appName == nil) {
-    return;
-  }
-
-  os_unfair_lock_lock(&_instancesLock);
-  [self.instances removeObjectForKey:appName];
-  os_unfair_lock_unlock(&_instancesLock);
-}
-
-#pragma mark - FIRFunctionsProvider Conformance
-
-- (FIRFunctions *)functionsForApp:(FIRApp *)app
-                           region:(NSString *)region
-                     customDomain:(NSString *_Nullable)customDomain
-                             type:(Class)cls {
-  os_unfair_lock_lock(&_instancesLock);
-  NSArray<FIRFunctions *> *associatedInstances = [self instances][app.name];
-  if (associatedInstances.count > 0) {
-    for (FIRFunctions *instance in associatedInstances) {
-      // Domains may be nil, so handle with care
-      BOOL equalDomains = NO;
-      if (instance.customDomain != nil) {
-        equalDomains = [customDomain isEqualToString:instance.customDomain];
-      } else {
-        equalDomains = customDomain == nil;
-      }
-      if ([instance.region isEqualToString:region] && equalDomains) {
-        os_unfair_lock_unlock(&_instancesLock);
-        return instance;
-      }
-    }
-  }
-
-  FIRFunctions *newInstance = [[cls alloc] initWithApp:app region:region customDomain:customDomain];
-
-  if (self.instances[app.name] == nil) {
-    NSMutableArray *array = [NSMutableArray arrayWithObject:newInstance];
-    self.instances[app.name] = array;
-  } else {
-    [self.instances[app.name] addObject:newInstance];
-  }
-  os_unfair_lock_unlock(&_instancesLock);
-  return newInstance;
-}
-
-@end

+ 0 - 30
FirebaseFunctions/Sources/FIRFunctions_Private.h

@@ -1,30 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRFunctions (Private)
-
-@property(nonatomic, readonly) NSString *region;
-@property(nonatomic, readonly, nullable) NSString *customDomain;
-
-- (instancetype)initWithApp:(FIRApp *)app
-                     region:(NSString *)region
-               customDomain:(nullable NSString *)customDomain;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 46
FirebaseFunctions/Sources/FIRHTTPSCallable+Internal.h

@@ -1,46 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h"
-
-@class FIRFunctions;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRHTTPSCallableResult (Internal)
-
-/**
- * Initializes a callable result.
- *
- * @param result The data to wrap.
- */
-- (instancetype)initWithData:(id)result;
-
-@end
-
-@interface FIRHTTPSCallable (Internal)
-
-/**
- * Initializes a reference to the given http trigger.
- *
- * @param functionsClient The functions client to use for making network requests.
- * @param name The name of the http trigger.
- */
-- (instancetype)initWithFunctions:(FIRFunctions *)functionsClient name:(NSString *)name;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 75
FirebaseFunctions/Sources/FIRHTTPSCallable.m

@@ -1,75 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h"
-#import "FirebaseFunctions/Sources/FIRHTTPSCallable+Internal.h"
-
-#import "FirebaseFunctions/Sources/FIRFunctions+Internal.h"
-#import "FirebaseFunctions/Sources/FUNUsageValidation.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@implementation FIRHTTPSCallableResult
-
-- (instancetype)initWithData:(id)data {
-  self = [super init];
-  if (self) {
-    _data = data;
-  }
-  return self;
-}
-
-@end
-
-@interface FIRHTTPSCallable () {
-  // The functions client to use for making calls.
-  FIRFunctions *_functions;
-  // The name of the http endpoint this reference refers to.
-  NSString *_name;
-}
-
-@end
-
-@implementation FIRHTTPSCallable
-
-- (instancetype)initWithFunctions:(FIRFunctions *)functions name:(NSString *)name {
-  self = [super init];
-  if (self) {
-    if (!name) {
-      FUNThrowInvalidArgument(@"FIRHTTPSCallable name cannot be nil.");
-    }
-    _name = [name copy];
-    _functions = functions;
-    _timeoutInterval = 70.0;
-  }
-  return self;
-}
-
-- (void)callWithCompletion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                                     NSError *_Nullable error))completion {
-  [self callWithObject:nil completion:completion];
-}
-
-- (void)callWithObject:(nullable id)data
-            completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                                 NSError *_Nullable error))completion {
-  [_functions callFunction:_name
-                withObject:data
-                   timeout:self.timeoutInterval
-                completion:completion];
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 53
FirebaseFunctions/Sources/FUNContext.h

@@ -1,53 +0,0 @@
-//
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-@class FIRApp;
-
-@protocol FIRAppCheckInterop;
-@protocol FIRAuthInterop;
-@protocol FIRMessagingInterop;
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- * FUNContext is a helper class for gathering metadata for a function call.
- */
-@interface FUNContext : NSObject
-- (id)init NS_UNAVAILABLE;
-@property(nonatomic, copy, nullable, readonly) NSString *authToken;
-@property(nonatomic, copy, nullable, readonly) NSString *FCMToken;
-
-/// Firebase app check (FAC) token if available.
-@property(nonatomic, copy, nullable, readonly) NSString *appCheckToken;
-@end
-
-/**
- * A FUNContextProvider gathers metadata and creats a FUNContext.
- */
-@interface FUNContextProvider : NSObject
-
-- (id)init NS_UNAVAILABLE;
-
-- (instancetype)initWithAuth:(nullable id<FIRAuthInterop>)auth
-                   messaging:(nullable id<FIRMessagingInterop>)messaging
-                    appCheck:(nullable id<FIRAppCheckInterop>)appCheck NS_DESIGNATED_INITIALIZER;
-
-- (void)getContext:(void (^)(FUNContext *context, NSError *_Nullable error))completion;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 126
FirebaseFunctions/Sources/FUNContext.m

@@ -1,126 +0,0 @@
-//
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/FUNContext.h"
-
-#import "FirebaseAppCheck/Interop/FIRAppCheckInterop.h"
-#import "FirebaseAppCheck/Interop/FIRAppCheckTokenResultInterop.h"
-#import "FirebaseAuth/Interop/FIRAuthInterop.h"
-#import "FirebaseMessaging/Interop/FIRMessagingInterop.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FUNContext ()
-
-- (instancetype)initWithAuthToken:(NSString *_Nullable)authToken
-                         FCMToken:(NSString *_Nullable)FCMToken
-                    appCheckToken:(NSString *_Nullable)appCheckToken NS_DESIGNATED_INITIALIZER;
-
-@end
-
-@implementation FUNContext
-
-- (instancetype)initWithAuthToken:(NSString *_Nullable)authToken
-                         FCMToken:(NSString *_Nullable)FCMToken
-                    appCheckToken:(NSString *_Nullable)appCheckToken {
-  self = [super init];
-  if (self) {
-    _authToken = [authToken copy];
-    _FCMToken = [FCMToken copy];
-    _appCheckToken = [appCheckToken copy];
-  }
-  return self;
-}
-
-@end
-
-@interface FUNContextProvider () {
-  id<FIRAuthInterop> _Nullable _auth;
-  id<FIRMessagingInterop> _Nullable _messaging;
-  id<FIRAppCheckInterop> _Nullable _appCheck;
-}
-@end
-
-@implementation FUNContextProvider
-
-- (instancetype)initWithAuth:(nullable id<FIRAuthInterop>)auth
-                   messaging:(nullable id<FIRMessagingInterop>)messaging
-                    appCheck:(nullable id<FIRAppCheckInterop>)appCheck {
-  self = [super init];
-  if (self) {
-    _auth = auth;
-    _messaging = messaging;
-    _appCheck = appCheck;
-  }
-  return self;
-}
-
-// This is broken out so it can be mocked for tests.
-- (NSString *)FCMToken {
-  return _messaging.FCMToken;
-}
-
-- (void)getContext:(void (^)(FUNContext *context, NSError *_Nullable error))completion {
-  dispatch_group_t dispatchGroup = dispatch_group_create();
-
-  // Try to get FCM token.
-  NSString *FCMToken = [self FCMToken];
-
-  __block NSString *authToken;
-  __block NSString *appCheckToken;
-  __block NSError *authError;
-
-  // Fetch auth token if available.
-  if (_auth != nil) {
-    dispatch_group_enter(dispatchGroup);
-
-    [_auth getTokenForcingRefresh:NO
-                     withCallback:^(NSString *_Nullable token, NSError *_Nullable error) {
-                       authToken = token;
-                       authError = error;
-
-                       dispatch_group_leave(dispatchGroup);
-                     }];
-  }
-
-  // Fetch FAC token if available.
-  if (_appCheck) {
-    dispatch_group_enter(dispatchGroup);
-
-    [_appCheck getTokenForcingRefresh:NO
-                           completion:^(id<FIRAppCheckTokenResultInterop> _Nonnull tokenResult) {
-                             // Send only valid token to functions.
-                             if (tokenResult.error == nil) {
-                               appCheckToken = tokenResult.token;
-                             }
-
-                             dispatch_group_leave(dispatchGroup);
-                           }];
-  }
-
-  dispatch_group_notify(dispatchGroup, dispatch_get_main_queue(), ^{
-    FUNContext *context = [[FUNContext alloc] initWithAuthToken:authToken
-                                                       FCMToken:FCMToken
-                                                  appCheckToken:appCheckToken];
-
-    if (completion) {
-      completion(context, authError);
-    }
-  });
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 44
FirebaseFunctions/Sources/FUNError.h

@@ -1,44 +0,0 @@
-//
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h"
-
-@class FUNSerializer;
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- * Takes an error code and returns a corresponding NSError.
- * @param code The eror code.
- * @return The corresponding NSError.
- */
-NSError *_Nullable FUNErrorForCode(FIRFunctionsErrorCode code);
-
-/**
- * Takes an HTTP status code and optional body and returns a corresponding NSError.
- * If an explicit error is encoded in the JSON body, it will be used.
- * Otherwise, uses the standard HTTP status code -> error mapping defined in:
- * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
- * @param status An HTTP status code.
- * @param body Optional body of the HTTP response.
- * @param serializer A serializer to use to decode the details in the error response.
- * @return The corresponding error.
- */
-NSError *_Nullable FUNErrorForResponse(NSInteger status,
-                                       NSData *_Nullable body,
-                                       FUNSerializer *serializer);
-
-NS_ASSUME_NONNULL_END

+ 0 - 196
FirebaseFunctions/Sources/FUNError.m

@@ -1,196 +0,0 @@
-//
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/FUNError.h"
-
-#import "FirebaseFunctions/Sources/FUNSerializer.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-NSString *const FIRFunctionsErrorDomain = @"com.firebase.functions";
-NSString *const FIRFunctionsErrorDetailsKey = @"details";
-
-/**
- * Takes an HTTP status code and returns the corresponding FIRFunctionsErrorCode error code.
- * This is the standard HTTP status code -> error mapping defined in:
- * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto
- * @param status An HTTP status code.
- * @return The corresponding error code, or FIRFunctionsErrorCodeUnknown if none.
- */
-FIRFunctionsErrorCode FIRFunctionsErrorCodeForHTTPStatus(NSInteger status) {
-  switch (status) {
-    case 200:
-      return FIRFunctionsErrorCodeOK;
-    case 400:
-      return FIRFunctionsErrorCodeInvalidArgument;
-    case 401:
-      return FIRFunctionsErrorCodeUnauthenticated;
-    case 403:
-      return FIRFunctionsErrorCodePermissionDenied;
-    case 404:
-      return FIRFunctionsErrorCodeNotFound;
-    case 409:
-      return FIRFunctionsErrorCodeAborted;
-    case 429:
-      return FIRFunctionsErrorCodeResourceExhausted;
-    case 499:
-      return FIRFunctionsErrorCodeCancelled;
-    case 500:
-      return FIRFunctionsErrorCodeInternal;
-    case 501:
-      return FIRFunctionsErrorCodeUnimplemented;
-    case 503:
-      return FIRFunctionsErrorCodeUnavailable;
-    case 504:
-      return FIRFunctionsErrorCodeDeadlineExceeded;
-  }
-  return FIRFunctionsErrorCodeInternal;
-}
-
-/**
- * Takes the name of an error code and returns the enum value for it.
- * @param name An error name.
- * @return The error code with this name, or FIRFunctionsErrorCodeUnknown if none.
- */
-NSNumber *FIRFunctionsErrorCodeForName(NSString *name) {
-  static NSDictionary<NSString *, NSNumber *> *errors;
-  static dispatch_once_t onceToken;
-  dispatch_once(&onceToken, ^{
-    errors = @{
-      @"OK" : @(FIRFunctionsErrorCodeOK),
-      @"CANCELLED" : @(FIRFunctionsErrorCodeCancelled),
-      @"UNKNOWN" : @(FIRFunctionsErrorCodeUnknown),
-      @"INVALID_ARGUMENT" : @(FIRFunctionsErrorCodeInvalidArgument),
-      @"DEADLINE_EXCEEDED" : @(FIRFunctionsErrorCodeDeadlineExceeded),
-      @"NOT_FOUND" : @(FIRFunctionsErrorCodeNotFound),
-      @"ALREADY_EXISTS" : @(FIRFunctionsErrorCodeAlreadyExists),
-      @"PERMISSION_DENIED" : @(FIRFunctionsErrorCodePermissionDenied),
-      @"RESOURCE_EXHAUSTED" : @(FIRFunctionsErrorCodeResourceExhausted),
-      @"FAILED_PRECONDITION" : @(FIRFunctionsErrorCodeFailedPrecondition),
-      @"ABORTED" : @(FIRFunctionsErrorCodeAborted),
-      @"OUT_OF_RANGE" : @(FIRFunctionsErrorCodeOutOfRange),
-      @"UNIMPLEMENTED" : @(FIRFunctionsErrorCodeUnimplemented),
-      @"INTERNAL" : @(FIRFunctionsErrorCodeInternal),
-      @"UNAVAILABLE" : @(FIRFunctionsErrorCodeUnavailable),
-      @"DATA_LOSS" : @(FIRFunctionsErrorCodeDataLoss),
-      @"UNAUTHENTICATED" : @(FIRFunctionsErrorCodeUnauthenticated),
-    };
-  });
-  return errors[name];
-}
-
-/**
- * Takes a FIRFunctionsErrorCode and returns an English description of it.
- * @param code An error code.
- * @return A description of the code, or "UNKNOWN" if none.
- */
-NSString *FUNDescriptionForErrorCode(FIRFunctionsErrorCode code) {
-  switch (code) {
-    case FIRFunctionsErrorCodeOK:
-      return @"OK";
-    case FIRFunctionsErrorCodeCancelled:
-      return @"CANCELLED";
-    case FIRFunctionsErrorCodeUnknown:
-      return @"UNKNOWN";
-    case FIRFunctionsErrorCodeInvalidArgument:
-      return @"INVALID ARGUMENT";
-    case FIRFunctionsErrorCodeDeadlineExceeded:
-      return @"DEADLINE EXCEEDED";
-    case FIRFunctionsErrorCodeNotFound:
-      return @"NOT FOUND";
-    case FIRFunctionsErrorCodeAlreadyExists:
-      return @"ALREADY EXISTS";
-    case FIRFunctionsErrorCodePermissionDenied:
-      return @"PERMISSION DENIED";
-    case FIRFunctionsErrorCodeResourceExhausted:
-      return @"RESOURCE EXHAUSTED";
-    case FIRFunctionsErrorCodeFailedPrecondition:
-      return @"FAILED PRECONDITION";
-    case FIRFunctionsErrorCodeAborted:
-      return @"ABORTED";
-    case FIRFunctionsErrorCodeOutOfRange:
-      return @"OUT OF RANGE";
-    case FIRFunctionsErrorCodeUnimplemented:
-      return @"UNIMPLEMENTED";
-    case FIRFunctionsErrorCodeInternal:
-      return @"INTERNAL";
-    case FIRFunctionsErrorCodeUnavailable:
-      return @"UNAVAILABLE";
-    case FIRFunctionsErrorCodeDataLoss:
-      return @"DATA LOSS";
-    case FIRFunctionsErrorCodeUnauthenticated:
-      return @"UNAUTHENTICATED";
-  }
-  return @"UNKNOWN";
-}
-
-NSError *_Nullable FUNErrorForCode(FIRFunctionsErrorCode code) {
-  NSDictionary *userInfo = @{NSLocalizedDescriptionKey : FUNDescriptionForErrorCode(code)};
-  return [NSError errorWithDomain:FIRFunctionsErrorDomain code:code userInfo:userInfo];
-}
-
-NSError *_Nullable FUNErrorForResponse(NSInteger status,
-                                       NSData *_Nullable body,
-                                       FUNSerializer *serializer) {
-  // Start with reasonable defaults from the status code.
-  FIRFunctionsErrorCode code = FIRFunctionsErrorCodeForHTTPStatus(status);
-  NSString *description = FUNDescriptionForErrorCode(code);
-  id details = nil;
-
-  // Then look through the body for explicit details.
-  if (body) {
-    NSError *parseError = nil;
-    id json = [NSJSONSerialization JSONObjectWithData:body options:0 error:&parseError];
-    if (!parseError && [json isKindOfClass:[NSDictionary class]]) {
-      id errorDetails = json[@"error"];
-      if ([errorDetails isKindOfClass:[NSDictionary class]]) {
-        if ([errorDetails[@"status"] isKindOfClass:[NSString class]]) {
-          NSNumber *codeNumber = FIRFunctionsErrorCodeForName(errorDetails[@"status"]);
-          if (codeNumber == nil) {
-            // If the code in the body is invalid, treat the whole response as malformed.
-            return FUNErrorForCode(FIRFunctionsErrorCodeInternal);
-          }
-          code = codeNumber.intValue;
-          // The default description needs to be updated for the new code.
-          description = FUNDescriptionForErrorCode(code);
-        }
-        if ([errorDetails[@"message"] isKindOfClass:[NSString class]]) {
-          description = (NSString *)errorDetails[@"message"];
-        }
-        details = errorDetails[@"details"];
-        if (details) {
-          NSError *decodeError = nil;
-          details = [serializer decode:details error:&decodeError];
-          // Just ignore the details if there an error decoding them.
-        }
-      }
-    }
-  }
-
-  if (code == FIRFunctionsErrorCodeOK) {
-    // Technically, there's an edge case where a developer could explicitly return an error code of
-    // OK, and we will treat it as success, but that seems reasonable.
-    return nil;
-  }
-
-  NSMutableDictionary *userInfo = [NSMutableDictionary dictionary];
-  userInfo[NSLocalizedDescriptionKey] = description;
-  if (details) {
-    userInfo[FIRFunctionsErrorDetailsKey] = details;
-  }
-  return [NSError errorWithDomain:FIRFunctionsErrorDomain code:code userInfo:userInfo];
-}
-
-NS_ASSUME_NONNULL_END

+ 0 - 33
FirebaseFunctions/Sources/FUNSerializer.h

@@ -1,33 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FUNSerializer : NSObject
-
-/**
- * Converts raw Objective-C types into JSON objects.
- */
-- (id)encode:(id)object;
-
-/**
- * Converts objects in JSON to Objective-C types.
- */
-- (nullable id)decode:(id)object error:(NSError **)error;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 239
FirebaseFunctions/Sources/FUNSerializer.m

@@ -1,239 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/FUNSerializer.h"
-
-#import "FirebaseFunctions/Sources/FUNUsageValidation.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-static NSString *const kLongType = @"type.googleapis.com/google.protobuf.Int64Value";
-static NSString *const kUnsignedLongType = @"type.googleapis.com/google.protobuf.UInt64Value";
-static NSString *const kDateType = @"type.googleapis.com/google.protobuf.Timestamp";
-
-@interface FUNSerializer () {
-  NSDateFormatter *_dateFormatter;
-}
-@end
-
-@implementation FUNSerializer
-
-- (instancetype)init {
-  self = [super init];
-  if (self) {
-    _dateFormatter = [[NSDateFormatter alloc] init];
-    _dateFormatter.dateFormat = @"yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
-    _dateFormatter.timeZone = [NSTimeZone timeZoneWithName:@"UTC"];
-  }
-  return self;
-}
-
-- (id)encodeNumber:(NSNumber *)number {
-  // Recover the underlying type of the number, using the method described here:
-  // http://stackoverflow.com/questions/2518761/get-type-of-nsnumber
-  const char *cType = [number objCType];
-
-  // Type Encoding values taken from
-  // https://developer.apple.com/library/mac/documentation/Cocoa/Conceptual/ObjCRuntimeGuide/
-  // Articles/ocrtTypeEncodings.html
-  switch (cType[0]) {
-    case 'q':
-      // "long long" might be larger than JS supports, so make it a string.
-      return @{
-        @"@type" : kLongType,
-        @"value" : [NSString stringWithFormat:@"%@", number],
-      };
-    case 'Q':
-      // "unsigned long long" might be larger than JS supports, so make it a string.
-      return @{
-        @"@type" : kUnsignedLongType,
-        @"value" : [NSString stringWithFormat:@"%@", number],
-      };
-
-    case 'i':
-    case 's':
-    case 'l':
-    case 'I':
-    case 'S':
-      // If it's an integer that isn't too long, so just use the number.
-      return number;
-
-    case 'f':
-    case 'd':
-      // It's a float/double that's not too large.
-      return number;
-
-    case 'B':
-    case 'c':
-    case 'C':
-      // Boolean values are weird.
-      //
-      // On arm64, objCType of a BOOL-valued NSNumber will be "c", even though @encode(BOOL)
-      // returns "B". "c" is the same as @encode(signed char). Unfortunately this means that
-      // legitimate usage of signed chars is impossible, but this should be rare.
-      //
-      // Just return Boolean values as-is.
-      return number;
-
-    default:
-      // All documented codes should be handled above, so this shouldn't happen.
-      FUNThrowInvalidArgument(@"Unknown NSNumber objCType %s on %@", cType, number);
-  }
-}
-
-- (id)encode:(id)object {
-  if ([object isEqual:[NSNull null]]) {
-    return object;
-  }
-  if ([object isKindOfClass:[NSNumber class]]) {
-    return [self encodeNumber:object];
-  }
-  if ([object isKindOfClass:[NSString class]]) {
-    return object;
-  }
-  if ([object isKindOfClass:[NSDictionary class]]) {
-    NSMutableDictionary *encoded = [NSMutableDictionary dictionary];
-    [object
-        enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL *_Nonnull stop) {
-          encoded[key] = [self encode:obj];
-        }];
-    return encoded;
-  }
-  if ([object isKindOfClass:[NSArray class]]) {
-    NSMutableArray *encoded = [NSMutableArray arrayWithCapacity:[object count]];
-    for (id obj in object) {
-      [encoded addObject:[self encode:obj]];
-    }
-    return encoded;
-  }
-  // TODO(klimt): Add this back when we support NSDate.
-  /*
-  if ([object isKindOfClass:[NSDate class]]) {
-    NSString *iso8601 = [_dateFormatter stringFromDate:object];
-    return @{
-      @"@type" : kDateType,
-      @"value" : iso8601,
-    };
-  }
-  */
-  FUNThrowInvalidArgument(@"Unsupported type: %@ for value %@", NSStringFromClass([object class]),
-                          object);
-}
-
-NSError *FUNInvalidNumberError(id value, id wrapped) {
-  NSString *description = [NSString stringWithFormat:@"Invalid number: %@ for %@", value, wrapped];
-  NSDictionary *userInfo = @{
-    NSLocalizedDescriptionKey : description,
-  };
-  return [NSError errorWithDomain:FIRFunctionsErrorDomain
-                             code:FIRFunctionsErrorCodeInternal
-                         userInfo:userInfo];
-}
-
-- (nullable id)decodeWrappedType:(NSDictionary *)wrapped error:(NSError **)error {
-  NSAssert(error, @"error must not be nil");
-  NSString *type = wrapped[@"@type"];
-  NSString *value = wrapped[@"value"];
-  if (!value) {
-    return nil;
-  }
-  if ([type isEqualToString:kLongType]) {
-    NSNumberFormatter *formatter = [[NSNumberFormatter alloc] init];
-    NSNumber *n = [formatter numberFromString:value];
-    if (n == nil) {
-      if (error != NULL) {
-        *error = FUNInvalidNumberError(value, wrapped);
-      }
-      return nil;
-    }
-    return n;
-  } else if ([type isEqualToString:kUnsignedLongType]) {
-    // NSNumber formatter doesn't handle unsigned long long, so we have to parse it.
-    const char *str = value.UTF8String;
-    char *end = NULL;
-    unsigned long long n = strtoull(str, &end, 10);
-    if (errno == ERANGE) {
-      // This number was actually too big for an unsigned long long.
-      if (error != NULL) {
-        *error = FUNInvalidNumberError(value, wrapped);
-      }
-      return nil;
-    }
-    if (*end) {
-      // The whole string wasn't parsed.
-      if (error != NULL) {
-        *error = FUNInvalidNumberError(value, wrapped);
-      }
-      return nil;
-    }
-    return @(n);
-  }
-  return nil;
-}
-
-- (nullable id)decode:(id)object error:(NSError **)error {
-  NSAssert(error, @"error must not be nil");
-  if ([object isKindOfClass:[NSDictionary class]]) {
-    if (object[@"@type"]) {
-      id result = [self decodeWrappedType:object error:error];
-      if (*error) {
-        return nil;
-      }
-      if (result) {
-        return result;
-      }
-      // Treat unknown types as dictionaries, so we don't crash old clients when we add types.
-    }
-    NSMutableDictionary *decoded = [NSMutableDictionary dictionary];
-    __block NSError *decodeError = nil;
-    [object
-        enumerateKeysAndObjectsUsingBlock:^(id _Nonnull key, id _Nonnull obj, BOOL *_Nonnull stop) {
-          id decodedItem = [self decode:obj error:&decodeError];
-          if (decodeError) {
-            *stop = YES;
-            return;
-          }
-          decoded[key] = decodedItem;
-        }];
-    if (decodeError) {
-      if (error != NULL) {
-        *error = decodeError;
-      }
-      return nil;
-    }
-    return decoded;
-  }
-  if ([object isKindOfClass:[NSArray class]]) {
-    NSMutableArray *result = [NSMutableArray arrayWithCapacity:[object count]];
-    for (id obj in object) {
-      id decoded = [self decode:obj error:error];
-      if (*error) {
-        return nil;
-      }
-      [result addObject:decoded];
-    }
-    return result;
-  }
-  if ([object isKindOfClass:[NSNumber class]] || [object isKindOfClass:[NSString class]] ||
-      [object isEqual:[NSNull null]]) {
-    return object;
-  }
-  FUNThrowInvalidArgument(@"Unsupported type: %@ for value %@", NSStringFromClass([object class]),
-                          object);
-}
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 38
FirebaseFunctions/Sources/FUNUsageValidation.h

@@ -1,38 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/** Helper for creating a general exception for invalid usage of an API. */
-NSException *FUNInvalidUsage(NSString *exceptionName, NSString *format, ...);
-
-/**
- * Macro to throw exceptions in response to API usage errors. Avoids the lint warning you usually
- * get when using @throw and (unlike a function) doesn't trigger warnings about not all codepaths
- * returning a value.
- *
- * Exceptions should only be used for programmer errors made by consumers of the SDK, e.g.
- * invalid method arguments.
- *
- * For recoverable runtime errors, use NSError**.
- * For internal programming errors, use FSTFail().
- */
-#define FUNThrowInvalidArgument(format, ...)                                       \
-  do {                                                                             \
-    @throw FUNInvalidUsage(@"FIRInvalidArgumentException", format, ##__VA_ARGS__); \
-  } while (0)
-
-NS_ASSUME_NONNULL_END

+ 0 - 28
FirebaseFunctions/Sources/FUNUsageValidation.m

@@ -1,28 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseFunctions/Sources/FUNUsageValidation.h"
-
-NS_ASSUME_NONNULL_BEGIN
-
-NSException *FUNInvalidUsage(NSString *exceptionName, NSString *format, ...) {
-  va_list arg_list;
-  va_start(arg_list, format);
-  NSString *formattedString = [[NSString alloc] initWithFormat:format arguments:arg_list];
-  va_end(arg_list);
-
-  return [[NSException alloc] initWithName:exceptionName reason:formattedString userInfo:nil];
-}
-
-NS_ASSUME_NONNULL_END

+ 1 - 1
FirebaseFunctionsSwift/Sources/Functions.swift → FirebaseFunctions/Sources/Functions.swift

@@ -39,7 +39,7 @@ internal enum FunctionsConstants {
 /**
  * `Functions` is the client for Cloud Functions for a Firebase project.
  */
-@objc(FIRFunctions) public class Functions: NSObject {
+@objc(FIRFunctions) open class Functions: NSObject {
   // MARK: - Private Variables
 
   /// The network client to use for http requests.

+ 0 - 0
FirebaseFunctionsSwift/Sources/FunctionsComponent.swift → FirebaseFunctions/Sources/FunctionsComponent.swift


+ 0 - 0
FirebaseFunctionsSwift/Sources/FunctionsContext.swift → FirebaseFunctions/Sources/FunctionsContext.swift


+ 1 - 1
FirebaseFunctionsSwift/Sources/FunctionsError.swift → FirebaseFunctions/Sources/FunctionsError.swift

@@ -21,7 +21,7 @@ public let FunctionsErrorDomain: String = "com.firebase.functions"
 public let FunctionsErrorDetailsKey: String = "details"
 
 // Swift globals are not visible from Objective C. Use these instead.
-@objc(FIRFunctionsErrorKeys) public class __FunctionsErrorKeys: NSObject {
+@objc(FIRFunctionsErrorKeys) open class __FunctionsErrorKeys: NSObject {
   // The error domain for codes in the FIRFunctionsErrorCode enum.
   @objc public static let domain: String = "com.firebase.functions"
 

+ 0 - 0
FirebaseFunctionsSwift/Sources/FunctionsSerializer.swift → FirebaseFunctions/Sources/FunctionsSerializer.swift


+ 2 - 2
FirebaseFunctionsSwift/Sources/HTTPSCallable.swift → FirebaseFunctions/Sources/HTTPSCallable.swift

@@ -18,7 +18,7 @@ import Foundation
  * A `HTTPSCallableResult` contains the result of calling a `HTTPSCallable`.
  */
 @objc(FIRHTTPSCallableResult)
-public class HTTPSCallableResult: NSObject {
+open class HTTPSCallableResult: NSObject {
   /**
    * The data that was returned from the Callable HTTPS trigger.
    *
@@ -37,7 +37,7 @@ public class HTTPSCallableResult: NSObject {
  * A `HTTPSCallable` is reference to a particular Callable HTTPS trigger in Cloud Functions.
  */
 @objc(FIRHTTPSCallable)
-public class HTTPSCallable: NSObject {
+open class HTTPSCallable: NSObject {
   // MARK: - Private Properties
 
   // The functions client to use for making calls.

+ 0 - 94
FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h

@@ -1,94 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-// The error domain for codes in the FIRFunctionsErrorCode enum.
-FOUNDATION_EXPORT NSString *const FIRFunctionsErrorDomain NS_SWIFT_NAME(FunctionsErrorDomain);
-
-// The key for finding error details in the NSError userInfo.
-// clang-format off
-// clang-format12 merges the next two lines.
-FOUNDATION_EXPORT NSString *const FIRFunctionsErrorDetailsKey
-    NS_SWIFT_NAME(FunctionsErrorDetailsKey);
-// clang-format on
-
-/**
- * The set of error status codes that can be returned from a Callable HTTPS tigger. These are the
- * canonical error codes for Google APIs, as documented here:
- * https://github.com/googleapis/googleapis/blob/master/google/rpc/code.proto#L26
- */
-typedef NS_ENUM(NSInteger, FIRFunctionsErrorCode) {
-  /** The operation completed successfully. */
-  FIRFunctionsErrorCodeOK = 0,
-  /** The operation was cancelled (typically by the caller). */
-  FIRFunctionsErrorCodeCancelled = 1,
-  /** Unknown error or an error from a different error domain. */
-  FIRFunctionsErrorCodeUnknown = 2,
-  /**
-   * Client specified an invalid argument. Note that this differs from `FailedPrecondition`.
-   * `InvalidArgument` indicates arguments that are problematic regardless of the state of the
-   * system (e.g., an invalid field name).
-   */
-  FIRFunctionsErrorCodeInvalidArgument = 3,
-  /**
-   * Deadline expired before operation could complete. For operations that change the state of the
-   * system, this error may be returned even if the operation has completed successfully. For
-   * example, a successful response from a server could have been delayed long enough for the
-   * deadline to expire.
-   */
-  FIRFunctionsErrorCodeDeadlineExceeded = 4,
-  /** Some requested document was not found. */
-  FIRFunctionsErrorCodeNotFound = 5,
-  /** Some document that we attempted to create already exists. */
-  FIRFunctionsErrorCodeAlreadyExists = 6,
-  /** The caller does not have permission to execute the specified operation. */
-  FIRFunctionsErrorCodePermissionDenied = 7,
-  /**
-   * Some resource has been exhausted, perhaps a per-user quota, or perhaps the entire file system
-   * is out of space.
-   */
-  FIRFunctionsErrorCodeResourceExhausted = 8,
-  /**
-   * Operation was rejected because the system is not in a state required for the operation's
-   * execution.
-   */
-  FIRFunctionsErrorCodeFailedPrecondition = 9,
-  /**
-   * The operation was aborted, typically due to a concurrency issue like transaction aborts, etc.
-   */
-  FIRFunctionsErrorCodeAborted = 10,
-  /** Operation was attempted past the valid range. */
-  FIRFunctionsErrorCodeOutOfRange = 11,
-  /** Operation is not implemented or not supported/enabled. */
-  FIRFunctionsErrorCodeUnimplemented = 12,
-  /**
-   * Internal errors. Means some invariant expected by underlying system has been broken. If you
-   * see one of these errors, something is very broken.
-   */
-  FIRFunctionsErrorCodeInternal = 13,
-  /**
-   * The service is currently unavailable. This is a most likely a transient condition and may be
-   * corrected by retrying with a backoff.
-   */
-  FIRFunctionsErrorCodeUnavailable = 14,
-  /** Unrecoverable data loss or corruption. */
-  FIRFunctionsErrorCodeDataLoss = 15,
-  /** The request does not have valid authentication credentials for the operation. */
-  FIRFunctionsErrorCodeUnauthenticated = 16,
-} NS_SWIFT_NAME(FunctionsErrorCode);
-
-NS_ASSUME_NONNULL_END

+ 0 - 104
FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h

@@ -1,104 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-@class FIRApp;
-@class FIRHTTPSCallable;
-
-/**
- * `FIRFunctions` is the client for Cloud Functions for a Firebase project.
- */
-NS_SWIFT_NAME(Functions)
-@interface FIRFunctions : NSObject
-
-/**
- * The current emulator origin, or nil if it is not set.
- */
-@property(nonatomic, readonly, nullable) NSString *emulatorOrigin;
-
-/** :nodoc: */
-- (id)init NS_UNAVAILABLE;
-
-/**
- * Creates a Cloud Functions client with the default app.
- */
-+ (instancetype)functions NS_SWIFT_NAME(functions());
-
-/**
- * Creates a Cloud Functions client with the given app.
- * @param app The app for the Firebase project.
- */
-+ (instancetype)functionsForApp:(FIRApp *)app NS_SWIFT_NAME(functions(app:));
-
-/**
- * Creates a Cloud Functions client with the default app and given region.
- * @param region The region for the http trigger, such as "us-central1".
- */
-+ (instancetype)functionsForRegion:(NSString *)region NS_SWIFT_NAME(functions(region:));
-
-/**
- * Creates a Cloud Functions client with the default app and given custom domain.
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
- */
-+ (instancetype)functionsForCustomDomain:(NSString *)customDomain
-    NS_SWIFT_NAME(functions(customDomain:));
-
-/**
- * Creates a Cloud Functions client with the given app and region, or returns a pre-existing
- * instance if one already exists.
- * @param app The app for the Firebase project.
- * @param region The region for the http trigger, such as "us-central1".
- */
-+ (instancetype)functionsForApp:(FIRApp *)app
-                         region:(NSString *)region NS_SWIFT_NAME(functions(app:region:));
-
-/**
- * Creates a Cloud Functions client with the given app and region, or returns a pre-existing
- * instance if one already exists.
- * @param app The app for the Firebase project.
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
- */
-+ (instancetype)functionsForApp:(FIRApp *)app
-                   customDomain:(NSString *)customDomain
-    NS_SWIFT_NAME(functions(app:customDomain:));
-
-/**
- * Creates a reference to the Callable HTTPS trigger with the given name.
- * @param name The name of the Callable HTTPS trigger.
- */
-- (FIRHTTPSCallable *)HTTPSCallableWithName:(NSString *)name NS_SWIFT_NAME(httpsCallable(_:));
-
-/**
- * Changes this instance to point to a Cloud Functions emulator running locally.
- * See https://firebase.google.com/docs/functions/local-emulator
- * @param origin The origin of the local emulator, such as "localhost:5005".
- */
-- (void)useFunctionsEmulatorOrigin:(NSString *)origin
-    NS_SWIFT_NAME(useFunctionsEmulator(origin:))
-        __attribute__((deprecated("Use useEmulator(host:port:) instead.")));
-
-/**
- * Changes this instance to point to a Cloud Functions emulator running locally.
- * See https://firebase.google.com/docs/functions/local-emulator
- * @param host The host of the local emulator, such as "localhost".
- * @param port The port of the local emulator, for example 5005.
- */
-- (void)useEmulatorWithHost:(NSString *)host port:(NSInteger)port;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 96
FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h

@@ -1,96 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/**
- * A `FIRHTTPSCallableResult` contains the result of calling a `FIRHTTPSCallable`.
- */
-NS_SWIFT_NAME(HTTPSCallableResult)
-@interface FIRHTTPSCallableResult : NSObject
-
-- (id)init NS_UNAVAILABLE;
-
-/**
- * The data that was returned from the Callable HTTPS trigger.
- *
- * The data is in the form of native objects. For example, if your trigger returned an
- * array, this object would be an NSArray. If your trigger returned a JavaScript object with
- * keys and values, this object would be an NSDictionary.
- */
-@property(nonatomic, strong, readonly) id data;
-
-@end
-
-/**
- * A `FIRHTTPSCallable` is reference to a particular Callable HTTPS trigger in Cloud Functions.
- */
-NS_SWIFT_NAME(HTTPSCallable)
-@interface FIRHTTPSCallable : NSObject
-
-- (id)init NS_UNAVAILABLE;
-
-/**
- * Executes this Callable HTTPS trigger asynchronously without any parameters.
- *
- * The request to the Cloud Functions backend made by this method automatically includes a
- * FCM token to identify the app instance. If a user is logged in with Firebase
- * Auth, an auth ID token for the user is also automatically included.
- *
- * Firebase Cloud Messaging sends data to the Firebase backend periodically to collect information
- * regarding the app instance. To stop this, see `Messaging.deleteData()`. It
- * resumes with a new FCM Token the next time you call this method.
- *
- * @param completion The block to call when the HTTPS request has completed.
- */
-- (void)callWithCompletion:
-    (void (^)(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error))completion
-    NS_SWIFT_NAME(call(completion:));
-
-/**
- * Executes this Callable HTTPS trigger asynchronously.
- *
- * The data passed into the trigger can be any of the following types:
- * * NSNull
- * * NSString
- * * NSNumber
- * * NSArray<id>, where the contained objects are also one of these types.
- * * NSDictionary<NSString, id>, where the values are also one of these types.
- *
- * The request to the Cloud Functions backend made by this method automatically includes a
- * Firebase Instance ID token to identify the app instance. If a user is logged in with Firebase
- * Auth, an auth ID token for the user is also automatically included.
- *
- * Firebase Instance ID sends data to the Firebase backend periodically to collect information
- * regarding the app instance. To stop this, see `[FIRInstanceID deleteIDWithHandler:]`. It
- * resumes with a new Instance ID the next time you call this method.
- *
- * @param data Parameters to pass to the trigger.
- * @param completion The block to call when the HTTPS request has completed.
- */
-- (void)callWithObject:(nullable id)data
-            completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                                 NSError *_Nullable error))completion
-    NS_SWIFT_NAME(call(_:completion:));
-
-/**
- * The timeout to use when calling the function. Defaults to 60 seconds.
- */
-@property(nonatomic, assign) NSTimeInterval timeoutInterval;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 19
FirebaseFunctions/Sources/Public/FirebaseFunctions/FirebaseFunctions.h

@@ -1,19 +0,0 @@
-/*
- * Copyright 2018 Google
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#import "FIRError.h"
-#import "FIRFunctions.h"
-#import "FIRHTTPSCallable.h"

+ 1 - 1
FirebaseFunctions/Tests/CombineUnit/HTTPSCallableTests.swift

@@ -16,7 +16,7 @@ import Foundation
 
 import Combine
 import FirebaseCore
-@testable import FirebaseFunctionsSwift
+@testable import FirebaseFunctions
 import FirebaseFunctionsCombineSwift
 import FirebaseAuthInterop
 import FirebaseAppCheckInterop

+ 0 - 244
FirebaseFunctions/Tests/Integration/FIRIntegrationTests.m

@@ -1,244 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <XCTest/XCTest.h>
-
-#import "FirebaseCore/Internal/FirebaseCoreInternal.h"
-
-#import "FirebaseFunctions/Sources/FIRFunctions+Internal.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRHTTPSCallable.h"
-#import "SharedTestUtilities/FIRAuthInteropFake.h"
-#import "SharedTestUtilities/FIRMessagingInteropFake.h"
-
-// Project ID used by these tests.
-static NSString *const kDefaultProjectID = @"functions-integration-test";
-
-@interface FIRIntegrationTests : XCTestCase {
-  FIRFunctions *_functions;
-  NSString *_projectID;
-  BOOL _useLocalhost;
-  FIRMessagingInteropFake *_messagingFake;
-}
-@end
-
-@implementation FIRIntegrationTests
-
-- (void)setUp {
-  [super setUp];
-
-  _messagingFake = [[FIRMessagingInteropFake alloc] init];
-
-  _projectID = kDefaultProjectID;
-  _useLocalhost = YES;
-
-  // Check for configuration of a prod project via GoogleServices-Info.plist.
-  FIROptions *options = [FIROptions defaultOptions];
-  if (options && ![options.projectID isEqualToString:@"abc-xyz-123"]) {
-    _projectID = options.projectID;
-    _useLocalhost = NO;
-  }
-
-  _functions = [[FIRFunctions alloc]
-      initWithProjectID:_projectID
-                 region:@"us-central1"
-           customDomain:nil
-                   auth:[[FIRAuthInteropFake alloc] initWithToken:nil userID:nil error:nil]
-              messaging:_messagingFake
-               appCheck:nil];
-  if (_useLocalhost) {
-    [_functions useLocalhost];
-  }
-}
-
-- (void)tearDown {
-  [super tearDown];
-}
-
-- (void)testData {
-  NSDictionary *data = @{
-    @"bool" : @YES,
-    @"int" : @2,
-    @"long" : @9876543210L,
-    @"string" : @"four",
-    @"array" : @[ @5, @6 ],
-    @"null" : [NSNull null],
-  };
-
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"dataTest"];
-  [function callWithObject:data
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNil(error);
-                  XCTAssertEqualObjects(@"stub response", result.data[@"message"]);
-                  XCTAssertEqualObjects(@42, result.data[@"code"]);
-                  XCTAssertEqualObjects(@420L, result.data[@"long"]);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testScalar {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"scalarTest"];
-  [function callWithObject:@17
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNil(error);
-                  XCTAssertEqualObjects(@76, result.data);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testToken {
-  // Recreate _functions with a token.
-  FIRFunctions *functions = [[FIRFunctions alloc]
-      initWithProjectID:_projectID
-                 region:@"us-central1"
-           customDomain:nil
-                   auth:[[FIRAuthInteropFake alloc] initWithToken:@"token" userID:nil error:nil]
-              messaging:_messagingFake
-               appCheck:nil];
-  if (_useLocalhost) {
-    [functions useLocalhost];
-  }
-
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [functions HTTPSCallableWithName:@"tokenTest"];
-  [function callWithObject:@{}
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNil(error);
-                  XCTAssertEqualObjects(@{}, result.data);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testFCMToken {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"FCMTokenTest"];
-  [function callWithObject:@{}
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNil(error);
-                  XCTAssertEqualObjects(@{}, result.data);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testNull {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"nullTest"];
-  [function callWithObject:[NSNull null]
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertEqualObjects([NSNull null], result.data);
-                  XCTAssertNil(error);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-
-  // Test the version with no arguments.
-  expectation = [[XCTestExpectation alloc] init];
-  [function
-      callWithCompletion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-        XCTAssertEqualObjects([NSNull null], result.data);
-        XCTAssertNil(error);
-        [expectation fulfill];
-      }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testMissingResult {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"missingResultTest"];
-  [function
-      callWithCompletion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-        XCTAssertNotNil(error);
-        XCTAssertEqual(FIRFunctionsErrorCodeInternal, error.code);
-        XCTAssertEqualObjects(@"Response is missing data field.", error.localizedDescription);
-        [expectation fulfill];
-      }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testUnhandledError {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"unhandledErrorTest"];
-  [function callWithObject:@{}
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNotNil(error);
-                  XCTAssertEqual(FIRFunctionsErrorCodeInternal, error.code);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testUnknownError {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"unknownErrorTest"];
-  [function callWithObject:@{}
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNotNil(error);
-                  XCTAssertEqual(FIRFunctionsErrorCodeInternal, error.code);
-                  XCTAssertEqualObjects(@"INTERNAL", error.localizedDescription);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testExplicitError {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"explicitErrorTest"];
-  [function
-      callWithObject:@{}
-          completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-            XCTAssertNotNil(error);
-            XCTAssertEqual(FIRFunctionsErrorCodeOutOfRange, error.code);
-            XCTAssertEqualObjects(@"explicit nope", error.userInfo[NSLocalizedDescriptionKey]);
-            NSDictionary *expectedDetails = @{@"start" : @10, @"end" : @20, @"long" : @30L};
-            XCTAssertEqualObjects(expectedDetails, error.userInfo[FIRFunctionsErrorDetailsKey]);
-            [expectation fulfill];
-          }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testHttpError {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"httpErrorTest"];
-  [function callWithObject:@{}
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertNotNil(error);
-                  XCTAssertEqual(FIRFunctionsErrorCodeInvalidArgument, error.code);
-                  [expectation fulfill];
-                }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-- (void)testTimeout {
-  XCTestExpectation *expectation = [[XCTestExpectation alloc] init];
-  FIRHTTPSCallable *function = [_functions HTTPSCallableWithName:@"timeoutTest"];
-  function.timeoutInterval = 0.05;
-  [function
-      callWithCompletion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-        XCTAssertNotNil(error);
-        XCTAssertEqual(FIRFunctionsErrorCodeDeadlineExceeded, error.code);
-        XCTAssertEqualObjects(@"DEADLINE EXCEEDED", error.userInfo[NSLocalizedDescriptionKey]);
-        XCTAssertNil(error.userInfo[FIRFunctionsErrorDetailsKey]);
-        [expectation fulfill];
-      }];
-  [self waitForExpectations:@[ expectation ] timeout:10];
-}
-
-@end

+ 1 - 1
FirebaseFunctionsSwift/Tests/Integration/IntegrationTests.swift → FirebaseFunctions/Tests/Integration/IntegrationTests.swift

@@ -14,7 +14,7 @@
 
 import Foundation
 
-@testable import FirebaseFunctionsSwift
+@testable import FirebaseFunctions
 import FirebaseAuthInterop
 import FirebaseMessagingInterop
 import XCTest

+ 1 - 3
FirebaseFunctionsSwift/Tests/ObjCIntegration/FIRFunctions+Internal.h → FirebaseFunctions/Tests/ObjCIntegration/FIRFunctions+Internal.h

@@ -14,9 +14,7 @@
 
 #import <Foundation/Foundation.h>
 
-// This file started as a copy of FirebaseFunctions/Sources/FIRFunctions+Internal.h with only the
-// next line changed from a public header import to a module import.
-@import FirebaseFunctionsSwift;
+@import FirebaseFunctions;
 
 @protocol FIRAppCheckInterop;
 @protocol FIRAuthInterop;

+ 2 - 2
FirebaseFunctionsSwift/Tests/ObjCIntegration/FIRIntegrationTests.m → FirebaseFunctions/Tests/ObjCIntegration/FIRIntegrationTests.m

@@ -15,9 +15,9 @@
 #import <XCTest/XCTest.h>
 
 #import "FirebaseCore/Internal/FirebaseCoreInternal.h"
-#import "FirebaseFunctionsSwift/Tests/ObjCIntegration/FIRFunctions+Internal.h"
+#import "FirebaseFunctions/Tests/ObjCIntegration/FIRFunctions+Internal.h"
 
-@import FirebaseFunctionsSwift;
+@import FirebaseFunctions;
 @import FirebaseMessagingInterop;
 @import GTMSessionFetcherCore;
 

+ 0 - 33
FirebaseFunctions/Tests/SwiftIntegration/APITests.swift

@@ -1,33 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import Foundation
-
-import FirebaseCore
-import FirebaseFunctions
-
-// This file is a build-only test for the public Functions Swift APIs not
-// exercised in IntegrationTests.swift.
-
-func apis() {
-  Functions.functions()
-  Functions.functions(region: "my-region")
-  Functions.functions(customDomain: "abc")
-  let myApp = FirebaseApp.app()!
-  Functions.functions(app: myApp)
-  Functions.functions(app: myApp, region: "my-region")
-  Functions.functions(app: myApp, customDomain: "my-domain")
-  Functions.functions().useLocalhost()
-  Functions.functions().useEmulator(withHost: "my-host", port: 1234)
-}

+ 0 - 482
FirebaseFunctions/Tests/SwiftIntegration/IntegrationTests.swift

@@ -1,482 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-import Foundation
-
-import FirebaseFunctions
-import FirebaseFunctionsTestingSupport
-import XCTest
-
-/// This file was initialized as a direct port of the Objective C
-/// FirebaseFunctions/Tests/Integration/FIRIntegrationTests.m
-///
-/// The tests require the emulator to be running with `FirebaseFunctions/Backend/start.sh synchronous`
-/// The Firebase Functions called in the tests are implemented in `FirebaseFunctions/Backend/index.js`.
-
-class IntegrationTests: XCTestCase {
-  let functions = FunctionsFake(
-    projectID: "functions-integration-test",
-    region: "us-central1",
-    customDomain: nil,
-    withToken: nil
-  )
-  let projectID = "functions-swift-integration-test"
-
-  override func setUp() {
-    super.setUp()
-    functions.useLocalhost()
-  }
-
-  func testData() {
-    let expectation = expectation(description: #function)
-    let data = [
-      "bool": true,
-      "int": 2 as Int32,
-      "long": 9_876_543_210,
-      "string": "four",
-      "array": [5 as Int32, 6 as Int32],
-      "null": nil,
-    ] as [String: Any?]
-    let function = functions.httpsCallable("dataTest")
-    XCTAssertNotNil(function)
-    function.call(data) { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data as? [String: Any])
-        let message = try XCTUnwrap(data["message"] as? String)
-        let long = try XCTUnwrap(data["long"] as? Int64)
-        let code = try XCTUnwrap(data["code"] as? Int32)
-        XCTAssertEqual(message, "stub response")
-        XCTAssertEqual(long, 420)
-        XCTAssertEqual(code, 42)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testDataAsync() async throws {
-      let input = [
-        "bool": true,
-        "int": 2 as Int32,
-        "long": 9_876_543_210,
-        "string": "four",
-        "array": [5 as Int32, 6 as Int32],
-        "null": nil,
-      ] as [String: Any?]
-
-      let function = functions.httpsCallable("dataTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call(input)
-      let data = try XCTUnwrap(result.data as? [String: Any])
-      let message = try XCTUnwrap(data["message"] as? String)
-      let long = try XCTUnwrap(data["long"] as? Int64)
-      let code = try XCTUnwrap(data["code"] as? Int32)
-      XCTAssertEqual(message, "stub response")
-      XCTAssertEqual(long, 420)
-      XCTAssertEqual(code, 42)
-    }
-  #endif
-
-  func testScalar() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("scalarTest")
-    XCTAssertNotNil(function)
-    function.call(17 as Int16) { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data as? Int)
-        XCTAssertEqual(data, 76)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testScalarAsync() async throws {
-      let function = functions.httpsCallable("scalarTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call(17 as Int16)
-      let data = try XCTUnwrap(result.data as? Int)
-      XCTAssertEqual(data, 76)
-    }
-  #endif
-
-  func testToken() {
-    // Recreate functions with a token.
-    let functions = FunctionsFake(
-      projectID: "functions-integration-test",
-      region: "us-central1",
-      customDomain: nil,
-      withToken: "token"
-    )
-    functions.useLocalhost()
-
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("FCMTokenTest")
-    XCTAssertNotNil(function)
-    function.call([:]) { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data) as? [String: Int]
-        XCTAssertEqual(data, [:])
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testTokenAsync() async throws {
-      // Recreate functions with a token.
-      let functions = FunctionsFake(
-        projectID: "functions-integration-test",
-        region: "us-central1",
-        customDomain: nil,
-        withToken: "token"
-      )
-      functions.useLocalhost()
-
-      let function = functions.httpsCallable("FCMTokenTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call([:])
-      let data = try XCTUnwrap(result.data) as? [String: Int]
-      XCTAssertEqual(data, [:])
-    }
-  #endif
-
-  func testFCMToken() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("FCMTokenTest")
-    XCTAssertNotNil(function)
-    function.call([:]) { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data) as? [String: Int]
-        XCTAssertEqual(data, [:])
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testFCMTokenAsync() async throws {
-      let function = functions.httpsCallable("FCMTokenTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call([:])
-      let data = try XCTUnwrap(result.data) as? [String: Int]
-      XCTAssertEqual(data, [:])
-    }
-  #endif
-
-  func testNull() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("nullTest")
-    XCTAssertNotNil(function)
-    function.call(nil) { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data) as? NSNull
-        XCTAssertEqual(data, NSNull())
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testNullAsync() async throws {
-      let function = functions.httpsCallable("nullTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call(nil)
-      let data = try XCTUnwrap(result.data) as? NSNull
-      XCTAssertEqual(data, NSNull())
-    }
-  #endif
-
-  // No parameters to call should be the same as passing nil.
-  func testParameterless() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("nullTest")
-    XCTAssertNotNil(function)
-    function.call { result, error in
-      do {
-        XCTAssertNil(error)
-        let data = try XCTUnwrap(result?.data) as? NSNull
-        XCTAssertEqual(data, NSNull())
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testParameterlessAsync() async throws {
-      let function = functions.httpsCallable("nullTest")
-      XCTAssertNotNil(function)
-
-      let result = try await function.call()
-      let data = try XCTUnwrap(result.data) as? NSNull
-      XCTAssertEqual(data, NSNull())
-    }
-  #endif
-
-  func testMissingResult() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("missingResultTest")
-    XCTAssertNotNil(function)
-    function.call(nil) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("Response is missing data field.", error.localizedDescription)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testMissingResultAsync() async throws {
-      let function = functions.httpsCallable("missingResultTest")
-      XCTAssertNotNil(function)
-      do {
-        _ = try await function.call(nil)
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("Response is missing data field.", error.localizedDescription)
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-
-  func testUnhandledError() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("unhandledErrorTest")
-    XCTAssertNotNil(function)
-    function.call([]) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error! as NSError)
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("INTERNAL", error.localizedDescription)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testUnhandledErrorAsync() async throws {
-      let function = functions.httpsCallable("unhandledErrorTest")
-      XCTAssertNotNil(function)
-      do {
-        _ = try await function.call([])
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("INTERNAL", error.localizedDescription)
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-
-  func testUnknownError() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("unknownErrorTest")
-    XCTAssertNotNil(function)
-    function.call([]) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error! as NSError)
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("INTERNAL", error.localizedDescription)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testUnknownErrorAsync() async throws {
-      let function = functions.httpsCallable("unknownErrorTest")
-      XCTAssertNotNil(function)
-      do {
-        _ = try await function.call([])
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.internal.rawValue, error.code)
-        XCTAssertEqual("INTERNAL", error.localizedDescription)
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-
-  func testExplicitError() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("explicitErrorTest")
-    XCTAssertNotNil(function)
-    function.call([]) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error! as NSError)
-        XCTAssertEqual(FunctionsErrorCode.outOfRange.rawValue, error.code)
-        XCTAssertEqual("explicit nope", error.localizedDescription)
-        XCTAssertEqual(["start": 10 as Int32, "end": 20 as Int32, "long": 30],
-                       error.userInfo[FunctionsErrorDetailsKey] as! [String: Int32])
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testExplicitErrorAsync() async throws {
-      let function = functions.httpsCallable("explicitErrorTest")
-      XCTAssertNotNil(function)
-      do {
-        _ = try await function.call([])
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.outOfRange.rawValue, error.code)
-        XCTAssertEqual("explicit nope", error.localizedDescription)
-        XCTAssertEqual(["start": 10 as Int32, "end": 20 as Int32, "long": 30],
-                       error.userInfo[FunctionsErrorDetailsKey] as! [String: Int32])
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-
-  func testHttpError() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("httpErrorTest")
-    XCTAssertNotNil(function)
-    function.call([]) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error! as NSError)
-        XCTAssertEqual(FunctionsErrorCode.invalidArgument.rawValue, error.code)
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testHttpErrorAsync() async throws {
-      let function = functions.httpsCallable("httpErrorTest")
-      XCTAssertNotNil(function)
-      do {
-        _ = try await function.call([])
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.invalidArgument.rawValue, error.code)
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-
-  func testTimeout() {
-    let expectation = expectation(description: #function)
-    let function = functions.httpsCallable("timeoutTest")
-    XCTAssertNotNil(function)
-    function.timeoutInterval = 0.05
-    function.call([]) { result, error in
-      do {
-        XCTAssertNotNil(error)
-        let error = try XCTUnwrap(error! as NSError)
-        XCTAssertEqual(FunctionsErrorCode.deadlineExceeded.rawValue, error.code)
-        XCTAssertEqual("DEADLINE EXCEEDED", error.localizedDescription)
-        XCTAssertNil(error.userInfo[FunctionsErrorDetailsKey])
-        expectation.fulfill()
-      } catch {
-        XCTAssert(false, "Failed to unwrap the function result: \(error)")
-      }
-    }
-    XCTAssert(true)
-    waitForExpectations(timeout: 5)
-  }
-
-  #if compiler(>=5.5) && canImport(_Concurrency)
-    @available(iOS 15, tvOS 15, macOS 12, watchOS 8, *)
-    func testTimeoutAsync() async throws {
-      let function = functions.httpsCallable("timeoutTest")
-      XCTAssertNotNil(function)
-      function.timeoutInterval = 0.05
-      do {
-        _ = try await function.call([])
-      } catch {
-        let error = try XCTUnwrap(error) as NSError
-        XCTAssertEqual(FunctionsErrorCode.deadlineExceeded.rawValue, error.code)
-        XCTAssertEqual("DEADLINE EXCEEDED", error.localizedDescription)
-        XCTAssertNil(error.userInfo[FunctionsErrorDetailsKey])
-        return
-      }
-      XCTAssertFalse(true, "Failed to throw error for missing result")
-    }
-  #endif
-}

+ 1 - 1
FirebaseFunctionsSwift/Tests/Unit/ContextProviderTests.swift → FirebaseFunctions/Tests/Unit/ContextProviderTests.swift

@@ -15,7 +15,7 @@
 import Foundation
 
 import FirebaseCore
-@testable import FirebaseFunctionsSwift
+@testable import FirebaseFunctions
 
 import FirebaseAppCheckInterop
 import FirebaseAuthInterop

+ 0 - 256
FirebaseFunctions/Tests/Unit/FIRFunctionsTests.m

@@ -1,256 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <XCTest/XCTest.h>
-
-#import "FirebaseFunctions/Sources/FIRFunctions+Internal.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRFunctions.h"
-
-#import "SharedTestUtilities/AppCheckFake/FIRAppCheckFake.h"
-#import "SharedTestUtilities/AppCheckFake/FIRAppCheckTokenResultFake.h"
-
-#import <FirebaseCore/FirebaseCore.h>
-
-#if SWIFT_PACKAGE
-@import GTMSessionFetcherCore;
-#else
-#import <GTMSessionFetcher/GTMSessionFetcherService.h>
-#endif
-
-@interface FIRFunctions (Test)
-
-@property(nonatomic, readonly) NSString *emulatorOrigin;
-
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck
-                   fetcherService:(GTMSessionFetcherService *)fetcherService;
-
-@end
-
-@interface FIRFunctionsTests : XCTestCase
-
-@end
-
-@implementation FIRFunctionsTests {
-  FIRFunctions *_functions;
-  FIRFunctions *_functionsCustomDomain;
-
-  GTMSessionFetcherService *_fetcherService;
-  FIRAppCheckFake *_appCheckFake;
-}
-
-- (void)setUp {
-  [super setUp];
-  _fetcherService = [[GTMSessionFetcherService alloc] init];
-  _appCheckFake = [[FIRAppCheckFake alloc] init];
-
-  _functions = [[FIRFunctions alloc] initWithProjectID:@"my-project"
-                                                region:@"my-region"
-                                          customDomain:nil
-                                                  auth:nil
-                                             messaging:nil
-                                              appCheck:_appCheckFake
-                                        fetcherService:_fetcherService];
-
-  _functionsCustomDomain = [[FIRFunctions alloc] initWithProjectID:@"my-project"
-                                                            region:@"my-region"
-                                                      customDomain:@"https://mydomain.com"
-                                                              auth:nil
-                                                         messaging:nil
-                                                          appCheck:nil
-                                                    fetcherService:_fetcherService];
-}
-
-- (void)tearDown {
-  _functionsCustomDomain = nil;
-  _functions = nil;
-  _fetcherService = nil;
-  [super tearDown];
-}
-
-- (void)testFunctionsInstanceIsStablePerApp {
-  FIROptions *options =
-      [[FIROptions alloc] initWithGoogleAppID:@"0:0000000000000:ios:0000000000000000"
-                                  GCMSenderID:@"00000000000000000-00000000000-000000000"];
-  [FIRApp configureWithOptions:options];
-
-  FIRFunctions *functions1 = [FIRFunctions functions];
-  FIRFunctions *functions2 = [FIRFunctions functionsForApp:[FIRApp defaultApp]];
-
-  XCTAssertEqualObjects(functions1, functions2);
-
-  [FIRApp configureWithName:@"test" options:options];
-  FIRApp *app2 = [FIRApp appNamed:@"test"];
-
-  functions2 = [FIRFunctions functionsForApp:app2 region:@"us-central2"];
-
-  XCTAssertNotEqualObjects(functions1, functions2);
-
-  functions1 = [FIRFunctions functionsForApp:app2 region:@"us-central2"];
-
-  XCTAssertEqualObjects(functions1, functions2);
-
-  functions1 = [FIRFunctions functionsForCustomDomain:@"test_domain"];
-  functions2 = [FIRFunctions functionsForRegion:@"us-central1"];
-
-  XCTAssertNotEqualObjects(functions1, functions2);
-
-  functions2 = [FIRFunctions functionsForApp:[FIRApp defaultApp] customDomain:@"test_domain"];
-  XCTAssertEqualObjects(functions1, functions2);
-}
-
-- (void)testURLWithName {
-  NSString *url = [_functions URLWithName:@"my-endpoint"];
-  XCTAssertEqualObjects(@"https://my-region-my-project.cloudfunctions.net/my-endpoint", url);
-}
-
-- (void)testRegionWithEmulator {
-  [_functionsCustomDomain useEmulatorWithHost:@"localhost" port:5005];
-  NSLog(@"%@", _functionsCustomDomain.emulatorOrigin);
-  NSString *url = [_functionsCustomDomain URLWithName:@"my-endpoint"];
-  XCTAssertEqualObjects(@"http://localhost:5005/my-project/my-region/my-endpoint", url);
-}
-
-- (void)testRegionWithEmulatorWithScheme {
-  [_functionsCustomDomain useEmulatorWithHost:@"http://localhost" port:5005];
-  NSLog(@"%@", _functionsCustomDomain.emulatorOrigin);
-  NSString *url = [_functionsCustomDomain URLWithName:@"my-endpoint"];
-  XCTAssertEqualObjects(@"http://localhost:5005/my-project/my-region/my-endpoint", url);
-}
-
-- (void)testCustomDomain {
-  NSString *url = [_functionsCustomDomain URLWithName:@"my-endpoint"];
-  XCTAssertEqualObjects(@"https://mydomain.com/my-endpoint", url);
-}
-
-- (void)testSetEmulatorSettings {
-  [_functions useEmulatorWithHost:@"localhost" port:1000];
-  XCTAssertEqualObjects(@"http://localhost:1000", _functions.emulatorOrigin);
-}
-
-#pragma mark - App Check integration
-
-- (void)testCallFunctionWhenAppCheckIsInstalledAndFACTokenSuccess {
-  _appCheckFake.tokenResult = [[FIRAppCheckTokenResultFake alloc] initWithToken:@"valid_token"
-                                                                          error:nil];
-
-  NSError *networkError = [NSError errorWithDomain:@"testCallFunctionWhenAppCheckIsInstalled"
-                                              code:-1
-                                          userInfo:nil];
-
-  XCTestExpectation *httpRequestExpectation =
-      [self expectationWithDescription:@"HTTPRequestExpectation"];
-  __weak __auto_type weakSelf = self;
-  _fetcherService.testBlock = ^(GTMSessionFetcher *_Nonnull fetcherToTest,
-                                GTMSessionFetcherTestResponse _Nonnull testResponse) {
-    // __unused to avoid warning in Xcode 12+ in g3.
-    __unused __auto_type self = weakSelf;
-    [httpRequestExpectation fulfill];
-
-    NSString *appCheckTokenHeader =
-        [fetcherToTest.request valueForHTTPHeaderField:@"X-Firebase-AppCheck"];
-    XCTAssertEqualObjects(appCheckTokenHeader, @"valid_token");
-
-    testResponse(nil, nil, networkError);
-  };
-
-  XCTestExpectation *completionExpectation =
-      [self expectationWithDescription:@"completionExpectation"];
-  [_functions callFunction:@"fake_func"
-                withObject:nil
-                   timeout:10
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertEqualObjects(error, networkError);
-                  [completionExpectation fulfill];
-                }];
-
-  [self waitForExpectations:@[ httpRequestExpectation, completionExpectation ] timeout:1.5];
-}
-
-- (void)testCallFunctionWhenAppCheckIsInstalledAndFACTokenError {
-  NSError *appCheckError = [NSError errorWithDomain:self.name code:-1 userInfo:nil];
-  _appCheckFake.tokenResult = [[FIRAppCheckTokenResultFake alloc] initWithToken:@"dummy_token"
-                                                                          error:appCheckError];
-
-  NSError *networkError = [NSError errorWithDomain:self.name code:-2 userInfo:nil];
-
-  XCTestExpectation *httpRequestExpectation =
-      [self expectationWithDescription:@"HTTPRequestExpectation"];
-  __weak __auto_type weakSelf = self;
-  _fetcherService.testBlock = ^(GTMSessionFetcher *_Nonnull fetcherToTest,
-                                GTMSessionFetcherTestResponse _Nonnull testResponse) {
-    // __unused to avoid warning in Xcode 12+ in g3.
-    __unused __auto_type self = weakSelf;
-    [httpRequestExpectation fulfill];
-
-    NSString *appCheckTokenHeader =
-        [fetcherToTest.request valueForHTTPHeaderField:@"X-Firebase-AppCheck"];
-    XCTAssertNil(appCheckTokenHeader);
-
-    testResponse(nil, nil, networkError);
-  };
-
-  XCTestExpectation *completionExpectation =
-      [self expectationWithDescription:@"completionExpectation"];
-  [_functions callFunction:@"fake_func"
-                withObject:nil
-                   timeout:10
-                completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-                  XCTAssertEqualObjects(error, networkError);
-                  [completionExpectation fulfill];
-                }];
-
-  [self waitForExpectations:@[ httpRequestExpectation, completionExpectation ] timeout:1.5];
-}
-
-- (void)testCallFunctionWhenAppCheckIsNotInstalled {
-  NSError *networkError = [NSError errorWithDomain:@"testCallFunctionWhenAppCheckIsInstalled"
-                                              code:-1
-                                          userInfo:nil];
-
-  XCTestExpectation *httpRequestExpectation =
-      [self expectationWithDescription:@"HTTPRequestExpectation"];
-  __weak __auto_type weakSelf = self;
-  _fetcherService.testBlock = ^(GTMSessionFetcher *_Nonnull fetcherToTest,
-                                GTMSessionFetcherTestResponse _Nonnull testResponse) {
-    // __unused to avoid warning in Xcode 12+ in g3.
-    __unused __auto_type self = weakSelf;
-    [httpRequestExpectation fulfill];
-
-    NSString *appCheckTokenHeader =
-        [fetcherToTest.request valueForHTTPHeaderField:@"X-Firebase-AppCheck"];
-    XCTAssertNil(appCheckTokenHeader);
-
-    testResponse(nil, nil, networkError);
-  };
-
-  XCTestExpectation *completionExpectation =
-      [self expectationWithDescription:@"completionExpectation"];
-  [_functionsCustomDomain
-      callFunction:@"fake_func"
-        withObject:nil
-           timeout:10
-        completion:^(FIRHTTPSCallableResult *_Nullable result, NSError *_Nullable error) {
-          XCTAssertEqualObjects(error, networkError);
-          [completionExpectation fulfill];
-        }];
-
-  [self waitForExpectations:@[ httpRequestExpectation, completionExpectation ] timeout:1.5];
-}
-
-@end

+ 0 - 192
FirebaseFunctions/Tests/Unit/FUNContextProviderTests.m

@@ -1,192 +0,0 @@
-// Copyright 2019 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <XCTest/XCTest.h>
-
-#import "FirebaseFunctions/Sources/FUNContext.h"
-
-#import "SharedTestUtilities/AppCheckFake/FIRAppCheckFake.h"
-#import "SharedTestUtilities/AppCheckFake/FIRAppCheckTokenResultFake.h"
-#import "SharedTestUtilities/FIRAuthInteropFake.h"
-#import "SharedTestUtilities/FIRMessagingInteropFake.h"
-
-@interface FUNContextProviderTests : XCTestCase
-
-@property(nonatomic) FIRMessagingInteropFake *messagingFake;
-
-@property(nonatomic) FIRAppCheckFake *appCheckFake;
-@property(strong, nonatomic) FIRAppCheckTokenResultFake *appCheckTokenSuccess;
-@property(strong, nonatomic) FIRAppCheckTokenResultFake *appCheckTokenError;
-
-@end
-
-@implementation FUNContextProviderTests
-
-- (void)setUp {
-  self.messagingFake = [[FIRMessagingInteropFake alloc] init];
-  self.appCheckFake = [[FIRAppCheckFake alloc] init];
-
-  self.appCheckTokenSuccess = [[FIRAppCheckTokenResultFake alloc] initWithToken:@"valid_token"
-                                                                          error:nil];
-  self.appCheckTokenError = [[FIRAppCheckTokenResultFake alloc]
-      initWithToken:@"dummy token"
-              error:[NSError errorWithDomain:@"testAppCheckError" code:-1 userInfo:nil]];
-}
-
-- (void)testContextWithAuth {
-  FIRAuthInteropFake *auth = [[FIRAuthInteropFake alloc] initWithToken:@"token"
-                                                                userID:@"userID"
-                                                                 error:nil];
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:(id<FIRAuthInterop>)auth
-                                                                messaging:self.messagingFake
-                                                                 appCheck:nil];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Context should have auth keys."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssert([context.authToken isEqualToString:@"token"]);
-    XCTAssert([context.FCMToken isEqualToString:self.messagingFake.FCMToken]);
-    XCTAssertNil(error);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testContextWithAuthError {
-  NSError *authError = [[NSError alloc] initWithDomain:@"com.functions.tests" code:4 userInfo:nil];
-  FIRAuthInteropFake *auth = [[FIRAuthInteropFake alloc] initWithToken:nil
-                                                                userID:nil
-                                                                 error:authError];
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:(id<FIRAuthInterop>)auth
-                                                                messaging:self.messagingFake
-                                                                 appCheck:nil];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should fail with Auth error."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertNil(context.authToken);
-    XCTAssertEqual(error, auth.error);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testContextWithoutAuth {
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:nil
-                                                                messaging:nil
-                                                                 appCheck:nil];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should succeed without Auth."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertNil(error);
-    XCTAssertNil(context.authToken);
-    XCTAssertNil(context.FCMToken);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testContextWithAppCheckOnlySuccess {
-  self.appCheckFake.tokenResult = self.appCheckTokenSuccess;
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:nil
-                                                                messaging:nil
-                                                                 appCheck:self.appCheckFake];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should succeed without Auth."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertNil(error);
-    XCTAssertNil(context.authToken);
-    XCTAssertNil(context.FCMToken);
-    XCTAssertEqualObjects(context.appCheckToken, self.appCheckTokenSuccess.token);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testContextWithAppCheckOnlyError {
-  self.appCheckFake.tokenResult = self.appCheckTokenError;
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:nil
-                                                                messaging:nil
-                                                                 appCheck:self.appCheckFake];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should succeed without Auth."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertNil(error);
-    XCTAssertNil(context.authToken);
-    XCTAssertNil(context.FCMToken);
-    // Don't expect any token in the case of App Check error.
-    XCTAssertNil(context.appCheckToken);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testAllContextsAvailableSuccess {
-  self.appCheckFake.tokenResult = self.appCheckTokenSuccess;
-  FIRAuthInteropFake *auth = [[FIRAuthInteropFake alloc] initWithToken:@"token"
-                                                                userID:@"userID"
-                                                                 error:nil];
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:auth
-                                                                messaging:self.messagingFake
-                                                                 appCheck:self.appCheckFake];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should succeed without Auth."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertNil(error);
-    XCTAssert([context.authToken isEqualToString:@"token"]);
-    XCTAssert([context.FCMToken isEqualToString:self.messagingFake.FCMToken]);
-    XCTAssertEqualObjects(context.appCheckToken, self.appCheckTokenSuccess.token);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-- (void)testAllContextsAuthAndAppCheckError {
-  self.appCheckFake.tokenResult = self.appCheckTokenError;
-
-  NSError *authError = [[NSError alloc] initWithDomain:@"com.functions.tests" code:4 userInfo:nil];
-  FIRAuthInteropFake *auth = [[FIRAuthInteropFake alloc] initWithToken:nil
-                                                                userID:nil
-                                                                 error:authError];
-
-  FUNContextProvider *provider = [[FUNContextProvider alloc] initWithAuth:auth
-                                                                messaging:self.messagingFake
-                                                                 appCheck:self.appCheckFake];
-  XCTestExpectation *expectation =
-      [self expectationWithDescription:@"Completion handler should succeed without Auth."];
-  [provider getContext:^(FUNContext *context, NSError *_Nullable error) {
-    XCTAssertNotNil(context);
-    XCTAssertEqual(error, auth.error);
-
-    XCTAssertNil(context.authToken);
-    XCTAssert([context.FCMToken isEqualToString:self.messagingFake.FCMToken]);
-    // Don't expect any token in the case of App Check error.
-    XCTAssertNil(context.appCheckToken);
-    [expectation fulfill];
-  }];
-
-  [self waitForExpectations:@[ expectation ] timeout:0.1];
-}
-
-@end

+ 0 - 240
FirebaseFunctions/Tests/Unit/FUNSerializerTests.m

@@ -1,240 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <XCTest/XCTest.h>
-
-#import "FirebaseFunctions/Sources/FUNSerializer.h"
-#import "FirebaseFunctions/Sources/Public/FirebaseFunctions/FIRError.h"
-
-@interface FUNSerializerTests : XCTestCase
-@end
-
-@implementation FUNSerializerTests
-
-- (void)setUp {
-  [super setUp];
-}
-
-- (void)tearDown {
-  [super tearDown];
-}
-
-- (void)testEncodeNull {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects([NSNull null], [serializer encode:[NSNull null]]);
-}
-
-- (void)testDecodeNull {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects([NSNull null], [serializer decode:[NSNull null] error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeInt {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(@1, [serializer encode:@1]);
-}
-
-- (void)testDecodeInt {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(@1, [serializer decode:@1 error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeLong {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSDictionary *expected = @{
-    @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-    @"value" : @"-9223372036854775800",
-  };
-  XCTAssertEqualObjects(expected, [serializer encode:@-9223372036854775800L]);
-}
-
-- (void)testDecodeLong {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSDictionary *input = @{
-    @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-    @"value" : @"-9223372036854775800",
-  };
-  NSError *error = nil;
-  NSNumber *actual = [serializer decode:input error:&error];
-  XCTAssertEqualObjects(@-9223372036854775800L, actual);
-  // A naive implementation might convert a number to a double and think that's close enough.
-  // We need to make sure it's a long long for accuracy.
-  XCTAssertEqual('q', actual.objCType[0]);
-  XCTAssertNil(error);
-}
-
-- (void)testDecodeInvalidLong {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSDictionary *input = @{
-    @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-    @"value" : @"-9223372036854775800 and some other junk",
-  };
-  NSError *error = nil;
-  NSNumber *actual = [serializer decode:input error:&error];
-  XCTAssertNil(actual);
-  XCTAssertNotNil(error);
-  XCTAssertEqualObjects(FIRFunctionsErrorDomain, error.domain);
-  XCTAssertEqual(FIRFunctionsErrorCodeInternal, error.code);
-}
-
-- (void)testEncodeUnsignedLong {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSDictionary *expected = @{
-    @"@type" : @"type.googleapis.com/google.protobuf.UInt64Value",
-    @"value" : @"18446744073709551600",
-  };
-  XCTAssertEqualObjects(expected, [serializer encode:@18446744073709551600UL]);
-}
-
-- (void)testDecodeUnsignedLong {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSDictionary *input = @{
-    @"@type" : @"type.googleapis.com/google.protobuf.UInt64Value",
-    @"value" : @"17446744073709551688",
-  };
-  NSError *error = nil;
-  NSNumber *actual = [serializer decode:input error:&error];
-  XCTAssertEqualObjects(@17446744073709551688UL, actual);
-  // A naive NSNumberFormatter implementation will convert the number to a double and think
-  // that's close enough. We need to make sure it's an unsigned long long for accuracy.
-  XCTAssertEqual('Q', actual.objCType[0]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeDouble {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(@1.2, [serializer encode:@1.2]);
-}
-
-- (void)testDecodeDouble {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(@1.2, [serializer decode:@1.2 error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeBool {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(@YES, [serializer encode:@YES]);
-}
-
-- (void)testDecodeBool {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(@NO, [serializer decode:@NO error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeString {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(@"hello", [serializer encode:@"hello"]);
-}
-
-- (void)testDecodeString {
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(@"hello", [serializer decode:@"hello" error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeArray {
-  NSArray *input = @[ @1, @"two", @[ @3, @9876543210LL ] ];
-  NSArray *expected = @[
-    @1, @"two",
-    @[
-      @3, @{
-        @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-        @"value" : @"9876543210",
-      }
-    ]
-  ];
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(expected, [serializer encode:input]);
-}
-
-- (void)testDecodeArray {
-  NSArray *input = @[
-    @1, @"two",
-    @[
-      @3, @{
-        @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-        @"value" : @"9876543210",
-      }
-    ]
-  ];
-  NSArray *expected = @[ @1, @"two", @[ @3, @9876543210LL ] ];
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-
-  XCTAssertEqualObjects(expected, [serializer decode:input error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testEncodeMap {
-  NSDictionary *input = @{@"foo" : @1, @"bar" : @"hello", @"baz" : @[ @3, @9876543210LL ]};
-  NSDictionary *expected = @{
-    @"foo" : @1,
-    @"bar" : @"hello",
-    @"baz" : @[
-      @3, @{
-        @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-        @"value" : @"9876543210",
-      }
-    ]
-  };
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  XCTAssertEqualObjects(expected, [serializer encode:input]);
-}
-
-- (void)testDecodeMap {
-  NSDictionary *input = @{
-    @"foo" : @1,
-    @"bar" : @"hello",
-    @"baz" : @[
-      @3, @{
-        @"@type" : @"type.googleapis.com/google.protobuf.Int64Value",
-        @"value" : @"9876543210",
-      }
-    ]
-  };
-  NSDictionary *expected = @{@"foo" : @1, @"bar" : @"hello", @"baz" : @[ @3, @9876543210LL ]};
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(expected, [serializer decode:input error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testDecodeUnknownType {
-  NSDictionary *input = @{@"@type" : @"unknown", @"value" : @"whatever"};
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(input, [serializer decode:input error:&error]);
-  XCTAssertNil(error);
-}
-
-- (void)testDecodeUnknownTypeWithoutValue {
-  NSDictionary *input = @{
-    @"@type" : @"unknown",
-  };
-  FUNSerializer *serializer = [[FUNSerializer alloc] init];
-  NSError *error = nil;
-  XCTAssertEqualObjects(input, [serializer decode:input error:&error]);
-  XCTAssertNil(error);
-}
-
-@end

+ 0 - 2
FirebaseFunctions/Tests/SwiftUnit/FunctionsAPITests.swift → FirebaseFunctions/Tests/Unit/FunctionsAPITests.swift

@@ -1,4 +1,3 @@
-//
 // Copyright 2021 Google LLC
 //
 // Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +11,6 @@
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 // See the License for the specific language governing permissions and
 // limitations under the License.
-//
 
 // MARK: This file is used to evaluate the experience of using Firebase APIs in Swift.
 

+ 1 - 1
FirebaseFunctionsSwift/Tests/Unit/FunctionsTests.swift → FirebaseFunctions/Tests/Unit/FunctionsTests.swift

@@ -15,7 +15,7 @@
 import Foundation
 
 import FirebaseCore
-@testable import FirebaseFunctionsSwift
+@testable import FirebaseFunctions
 #if COCOAPODS
   import GTMSessionFetcher
 #else

+ 1 - 1
FirebaseFunctionsSwift/Tests/Unit/SerializerTests.swift → FirebaseFunctions/Tests/Unit/SerializerTests.swift

@@ -15,7 +15,7 @@
 import Foundation
 
 import FirebaseCore
-@testable import FirebaseFunctionsSwift
+@testable import FirebaseFunctions
 #if COCOAPODS
   import GTMSessionFetcher
 #else

+ 0 - 57
FirebaseFunctionsSwift.podspec

@@ -1,57 +0,0 @@
-Pod::Spec.new do |s|
-  s.name                    = 'FirebaseFunctionsSwift'
-  s.version                 = '8.12.0-beta'
-  s.summary                 = 'Swift Extensions for Firebase Functions'
-
-  s.description      = <<-DESC
-Swift SDK Extensions for Cloud Functions for Firebase.
-                       DESC
-
-  s.homepage                = 'https://developers.google.com/'
-  s.license                 = { :type => 'Apache', :file => 'LICENSE' }
-  s.authors                 = 'Google, Inc.'
-
-  s.source                  = {
-    :git => 'https://github.com/Firebase/firebase-ios-sdk.git',
-    :tag => 'CocoaPods-' + s.version.to_s
-  }
-
-  s.swift_version           = '5.3'
-
-  ios_deployment_target = '10.0'
-  osx_deployment_target = '10.12'
-  tvos_deployment_target = '10.0'
-  watchos_deployment_target = '6.0'
-
-  s.ios.deployment_target = ios_deployment_target
-  s.osx.deployment_target = osx_deployment_target
-  s.tvos.deployment_target = tvos_deployment_target
-  s.watchos.deployment_target = watchos_deployment_target
-
-  s.cocoapods_version       = '>= 1.4.0'
-  s.prefix_header_file      = false
-
-  s.source_files = [
-    'FirebaseFunctionsSwift/Sources/**/*.swift',
-  ]
-
-  s.dependency 'FirebaseCore', '~> 8.12'
-  s.dependency 'FirebaseCoreInternal', '~> 8.12'
-  s.dependency 'FirebaseAppCheckInterop', '~> 8.12'
-  s.dependency 'FirebaseAuthInterop', '~> 8.12'
-  s.dependency 'FirebaseMessagingInterop', '~> 8.12'
-  s.dependency 'FirebaseSharedSwift', '~> 8.12'
-  s.dependency 'GTMSessionFetcher/Core', '~> 1.5'
-
-  # Maybe TODO: The unit tests depend on setting up a podspec for SharedTestUtilities
-  # OTOH, we are running them with SwiftPM.
-
-  s.test_spec 'integration' do |int_tests|
-    int_tests.platforms = {
-      :ios => ios_deployment_target,
-      :osx => osx_deployment_target,
-      :tvos => tvos_deployment_target
-    }
-    int_tests.source_files = 'FirebaseFunctionsSwift/Tests/Integration/*.swift'
-  end
-end

+ 0 - 3
FirebaseFunctionsSwift/CHANGELOG.md

@@ -1,3 +0,0 @@
-# 8.11.0-beta
-- Initial public beta release with Codable support. See example usage in
-  https://github.com/firebase/firebase-ios-sdk/blob/master/FirebaseFunctionsSwift/Tests/IntegrationTests.swift. (#8854)

+ 0 - 142
FirebaseFunctionsSwift/Tests/Unit/FunctionsAPITests.swift

@@ -1,142 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// MARK: This file is used to evaluate the experience of using Firebase APIs in Swift.
-
-import Foundation
-
-import FirebaseCore
-import FirebaseFunctionsSwift
-
-final class FunctionsAPITests {
-  func usage() {
-    // MARK: - Functions
-
-    // Retrieve Functions instance
-    _ = Functions.functions()
-
-    if let app = FirebaseApp.app() {
-      _ = Functions.functions(app: app)
-      _ = Functions.functions(app: app, region: "alderaan")
-      _ = Functions.functions(app: app, customDomain: "https://visitalderaan.com")
-    }
-
-    _ = Functions.functions(region: "alderaan")
-    _ = Functions.functions(customDomain: "https://visitalderaan.com")
-
-    // Reference to a callable HTTPS trigger
-    _ = Functions.functions().httpsCallable("setCourseForAlderaan")
-
-    // Functions emulator
-    Functions.functions().useEmulator(withHost: "host", port: 3000)
-    if let _ /* emulatorOrigin */ = Functions.functions().emulatorOrigin {
-      // ...
-    }
-
-    // MARK: - HTTPSCallable
-
-    let callableRef = Functions.functions().httpsCallable("setCourseForAlderaan")
-    callableRef.timeoutInterval = 60
-
-    let data: Any? = nil
-    callableRef.call(data) { result, error in
-      if let result = result {
-        _ = result.data
-      } else if let _ /* error */ = error {
-        // ...
-      }
-    }
-
-    #if compiler(>=5.5) && canImport(_Concurrency)
-      if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
-        // async/await is a Swift 5.5+ feature available on iOS 15+
-        Task {
-          do {
-            let result = try await callableRef.call(data)
-            _ = result.data
-          } catch {
-            // ...
-          }
-        }
-      }
-    #endif // compiler(>=5.5) && canImport(_Concurrency)
-
-    callableRef.call { result, error in
-      if let result = result {
-        _ = result.data
-      } else if let _ /* error */ = error {
-        // ...
-      }
-    }
-
-    #if compiler(>=5.5) && canImport(_Concurrency)
-      if #available(iOS 15.0, macOS 12.0, macCatalyst 15.0, tvOS 15.0, watchOS 8.0, *) {
-        // async/await is a Swift 5.5+ feature available on iOS 15+
-        Task {
-          do {
-            let result = try await callableRef.call()
-            _ = result.data
-          } catch {
-            // ...
-          }
-        }
-      }
-    #endif // compiler(>=5.5) && canImport(_Concurrency)
-
-    // MARK: - FunctionsErrorCode
-
-    callableRef.call { _, error in
-      if let error = error {
-        switch (error as NSError).code {
-        case FunctionsErrorCode.OK.rawValue:
-          break
-        case FunctionsErrorCode.cancelled.rawValue:
-          break
-        case FunctionsErrorCode.unknown.rawValue:
-          break
-        case FunctionsErrorCode.invalidArgument.rawValue:
-          break
-        case FunctionsErrorCode.deadlineExceeded.rawValue:
-          break
-        case FunctionsErrorCode.notFound.rawValue:
-          break
-        case FunctionsErrorCode.alreadyExists.rawValue:
-          break
-        case FunctionsErrorCode.permissionDenied.rawValue:
-          break
-        case FunctionsErrorCode.resourceExhausted.rawValue:
-          break
-        case FunctionsErrorCode.failedPrecondition.rawValue:
-          break
-        case FunctionsErrorCode.aborted.rawValue:
-          break
-        case FunctionsErrorCode.outOfRange.rawValue:
-          break
-        case FunctionsErrorCode.unimplemented.rawValue:
-          break
-        case FunctionsErrorCode.internal.rawValue:
-          break
-        case FunctionsErrorCode.unavailable.rawValue:
-          break
-        case FunctionsErrorCode.dataLoss.rawValue:
-          break
-        case FunctionsErrorCode.unauthenticated.rawValue:
-          break
-        default:
-          break
-        }
-      }
-    }
-  }
-}

+ 0 - 60
FirebaseFunctionsTestingSupport.podspec

@@ -1,60 +0,0 @@
-Pod::Spec.new do |s|
-  s.name                    = 'FirebaseFunctionsTestingSupport'
-  s.version                 = '1.0.0'
-  s.summary                 = 'Firebase SDKs testing support types and utilities.'
-
-  s.description      = <<-DESC
-  Type declarations and utilities needed for unit testing of the code dependent on Firebase SDKs.
-  This podspec is for internal testing only and should not be published.
-                       DESC
-
-  s.homepage                = 'https://developers.google.com/'
-  s.license                 = { :type => 'Apache', :file => 'LICENSE' }
-  s.authors                 = 'Google, Inc.'
-
-  s.source                  = {
-    :git => 'https://github.com/Firebase/firebase-ios-sdk.git',
-    :tag => 'CocoaPods-' + s.version.to_s
-  }
-
-  ios_deployment_target = '10.0'
-  osx_deployment_target = '10.12'
-  tvos_deployment_target = '10.0'
-  watchos_deployment_target = '6.0'
-
-  s.ios.deployment_target = ios_deployment_target
-  s.osx.deployment_target = osx_deployment_target
-  s.tvos.deployment_target = tvos_deployment_target
-  s.watchos.deployment_target = watchos_deployment_target
-
-  s.cocoapods_version       = '>= 1.4.0'
-  s.prefix_header_file      = false
-  s.requires_arc            = true
-
-  base_dir = 'FirebaseTestingSupport/Functions/'
-
-  s.source_files = [
-    base_dir + 'Sources/**/*.{m,mm,h}',
-    'SharedTestUtilities/FIRAuthInteropFake*',
-    'SharedTestUtilities/FIRMessagingInteropFake*'
-  ]
-
-  s.public_header_files = base_dir + '**/*.h'
-
-  s.dependency 'FirebaseFunctions', '~> 8.0'
-
-  s.pod_target_xcconfig = {
-    'GCC_C_LANGUAGE_STANDARD' => 'c99',
-    'OTHER_CFLAGS' => '-fno-autolink',
-    'HEADER_SEARCH_PATHS' =>
-      '"${PODS_TARGET_SRCROOT}" '
-  }
-
-  s.test_spec 'unit' do |unit_tests|
-    unit_tests.scheme = { :code_coverage => true }
-    unit_tests.platforms = {:ios => ios_deployment_target, :osx => osx_deployment_target, :tvos => tvos_deployment_target}
-    unit_tests.source_files = [
-      base_dir + 'Tests/**/*.swift'
-    ]
-  end
-end

+ 0 - 36
FirebaseTestingSupport/Functions/Sources/FIRFunctionsFake.m

@@ -1,36 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctionsFake.h"
-#import "FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctions+Testing.h"
-#import "SharedTestUtilities/FIRAuthInteropFake.h"
-#import "SharedTestUtilities/FIRMessagingInteropFake.h"
-
-@implementation FIRFunctionsFake
-
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                        withToken:(nullable NSString *)token {
-  return [super initWithProjectID:projectID
-                           region:region
-                     customDomain:customDomain
-                             auth:[[FIRAuthInteropFake alloc] initWithToken:token
-                                                                     userID:nil
-                                                                      error:nil]
-                        messaging:[[FIRMessagingInteropFake alloc] init]
-                         appCheck:nil];
-}
-
-@end

+ 0 - 32
FirebaseTestingSupport/Functions/Sources/FIRHTTPSCallableFake.m

@@ -1,32 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import "FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRHTTPSCallableFake.h"
-
-@implementation FIRHTTPSCallableResultFake
-
-id _fakeData;
-
-- (instancetype)initWithData:(id)data {
-  if (self) {
-    _fakeData = data;
-  }
-  return self;
-}
-
-- (id)data {
-  return _fakeData;
-}
-
-@end

+ 0 - 72
FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctions+Testing.h

@@ -1,72 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is a copy of Functions/Internal/FIRFunctions+Internal.h except for the modular import
-// of FirebaseFunctions.
-
-#import <Foundation/Foundation.h>
-
-@import FirebaseFunctions;
-
-@protocol FIRAppCheckInterop;
-@protocol FIRAuthInterop;
-@protocol FIRMessagingInterop;
-@class FIRHTTPSCallableResult;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRFunctions (Testing)
-
-/**
- * Calls an http trigger endpoint.
- * @param name The name of the http trigger.
- * @param data Parameters to pass to the function. Can be anything encodable as JSON.
- * @param completion The block to call when the request is complete.
- */
-- (void)callFunction:(NSString *)name
-          withObject:(nullable id)data
-             timeout:(NSTimeInterval)timeout
-          completion:(void (^)(FIRHTTPSCallableResult *_Nullable result,
-                               NSError *_Nullable error))completion;
-
-/**
- * Constructs the url for an http trigger. This is exposed only for testing.
- * @param name The name of the endpoint.
- */
-- (NSString *)URLWithName:(NSString *)name;
-
-/**
- * Sets the functions client to send requests to localhost instead of Firebase.
- * For testing only.
- */
-- (void)useLocalhost;
-
-/**
- * Internal initializer for the Cloud Functions client.
- * @param projectID The project ID for the Firebase project.
- * @param region The region for the http trigger, such as "us-central1".
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
- * @param auth The auth provider to use (optional).
- * @param messaging The messaging interop to use (optional).
- */
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                             auth:(nullable id<FIRAuthInterop>)auth
-                        messaging:(nullable id<FIRMessagingInterop>)messaging
-                         appCheck:(nullable id<FIRAppCheckInterop>)appCheck;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 38
FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRFunctionsFake.h

@@ -1,38 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-#import <FirebaseFunctions/FIRFunctions.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/// A functions object with fake tokens.
-NS_SWIFT_NAME(FunctionsFake)
-@interface FIRFunctionsFake : FIRFunctions
-
-/**
- * Internal initializer for testing a Cloud Functions client with fakes.
- * @param projectID The project ID for the Firebase project.
- * @param region The region for the http trigger, such as "us-central1".
- * @param customDomain A custom domain for the http trigger, such as "https://mydomain.com".
- * @param token A token to use for validation (optional).
- */
-- (instancetype)initWithProjectID:(NSString *)projectID
-                           region:(NSString *)region
-                     customDomain:(nullable NSString *)customDomain
-                        withToken:(nullable NSString *)token;
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 49
FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRHTTPSCallable+Testing.h

@@ -1,49 +0,0 @@
-// Copyright 2017 Google
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// This file is a copy of Functions/Internal/FIRHTTPSCallable+Internal.h except for the modular
-// import of FirebaseFunctions.
-
-#import <Foundation/Foundation.h>
-
-@import FirebaseFunctions;
-
-@class FIRFunctions;
-
-NS_ASSUME_NONNULL_BEGIN
-
-@interface FIRHTTPSCallableResult (Testing)
-
-/**
- * Initializes a callable result.
- *
- * @param result The data to wrap.
- */
-- (instancetype)initWithData:(id)result;
-
-@end
-
-@interface FIRHTTPSCallable (Testing)
-
-/**
- * Initializes a reference to the given http trigger.
- *
- * @param functionsClient The functions client to use for making network requests.
- * @param name The name of the http trigger.
- */
-- (instancetype)initWithFunctions:(FIRFunctions *)functionsClient name:(NSString *)name;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 0 - 29
FirebaseTestingSupport/Functions/Sources/Public/FirebaseFunctionsTestingSupport/FIRHTTPSCallableFake.h

@@ -1,29 +0,0 @@
-// Copyright 2021 Google LLC
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//      http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-#import <Foundation/Foundation.h>
-
-#import <FirebaseFunctions/FIRHTTPSCallable.h>
-
-NS_ASSUME_NONNULL_BEGIN
-
-/// A fake object to replace a real `FIRHTTPSCallableResult` in tests.
-NS_SWIFT_NAME(HTTPSCallableResultFake)
-@interface FIRHTTPSCallableResultFake : FIRHTTPSCallableResult
-
-- (instancetype)initWithData:(id)result;
-
-@end
-
-NS_ASSUME_NONNULL_END

+ 12 - 67
Package.swift

@@ -92,10 +92,6 @@ let package = Package(
       name: "FirebaseFunctions",
       targets: ["FirebaseFunctions"]
     ),
-    .library(
-      name: "FirebaseFunctionsSwift-Beta",
-      targets: ["FirebaseFunctionsSwift"]
-    ),
     .library(
       name: "FirebaseInAppMessaging-Beta",
       targets: ["FirebaseInAppMessagingTarget"]
@@ -697,18 +693,6 @@ let package = Package(
 
     .target(
       name: "FirebaseFunctions",
-      dependencies: [
-        "FirebaseCore",
-        .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
-      ],
-      path: "FirebaseFunctions/Sources",
-      publicHeadersPath: "Public",
-      cSettings: [
-        .headerSearchPath("../../"),
-      ]
-    ),
-    .target(
-      name: "FirebaseFunctionsSwift",
       dependencies: [
         "FirebaseAppCheckInterop",
         "FirebaseAuthInterop",
@@ -718,35 +702,35 @@ let package = Package(
         "FirebaseSharedSwift",
         .product(name: "GTMSessionFetcherCore", package: "GTMSessionFetcher"),
       ],
-      path: "FirebaseFunctionsSwift/Sources"
+      path: "FirebaseFunctions/Sources"
     ),
     .testTarget(
-      name: "FirebaseFunctionsSwiftUnit",
-      dependencies: ["FirebaseFunctionsSwift",
+      name: "FirebaseFunctionsUnit",
+      dependencies: ["FirebaseFunctions",
                      "SharedTestUtilities"],
-      path: "FirebaseFunctionsSwift/Tests/Unit",
+      path: "FirebaseFunctions/Tests/Unit",
       cSettings: [
         .headerSearchPath("../../../"),
       ]
     ),
     .testTarget(
-      name: "FirebaseFunctionsSwiftIntegration",
-      dependencies: ["FirebaseFunctionsSwift",
+      name: "FirebaseFunctionsIntegration",
+      dependencies: ["FirebaseFunctions",
                      "SharedTestUtilities"],
-      path: "FirebaseFunctionsSwift/Tests/Integration"
+      path: "FirebaseFunctions/Tests/Integration"
     ),
     .testTarget(
-      name: "FirebaseFunctionsSwiftObjCIntegration",
-      dependencies: ["FirebaseFunctionsSwift",
+      name: "FirebaseFunctionsObjCIntegration",
+      dependencies: ["FirebaseFunctions",
                      "SharedTestUtilities"],
-      path: "FirebaseFunctionsSwift/Tests/ObjCIntegration",
+      path: "FirebaseFunctions/Tests/ObjCIntegration",
       cSettings: [
         .headerSearchPath("../../.."),
       ]
     ),
     .target(
       name: "FirebaseFunctionsCombineSwift",
-      dependencies: ["FirebaseFunctionsSwift"],
+      dependencies: ["FirebaseFunctions"],
       path: "FirebaseCombineSwift/Sources/Functions"
     ),
     .testTarget(
@@ -755,45 +739,6 @@ let package = Package(
                      "SharedTestUtilities"],
       path: "FirebaseFunctions/Tests/CombineUnit"
     ),
-    .testTarget(
-      name: "FunctionsUnit",
-      dependencies: ["FirebaseFunctions",
-                     "SharedTestUtilities"],
-      path: "FirebaseFunctions/Tests/Unit",
-      cSettings: [
-        .headerSearchPath("../../../"),
-      ]
-    ),
-    .testTarget(
-      name: "FunctionsUnitSwift",
-      dependencies: ["FirebaseFunctions"],
-      path: "FirebaseFunctions/Tests/SwiftUnit"
-    ),
-    .testTarget(
-      name: "FunctionsIntegration",
-      dependencies: ["FirebaseFunctions",
-                     "SharedTestUtilities"],
-      path: "FirebaseFunctions/Tests/Integration",
-      cSettings: [
-        .headerSearchPath("../../../"),
-      ]
-    ),
-    .testTarget(
-      name: "FunctionsSwiftIntegration",
-      dependencies: ["FirebaseFunctions",
-                     "FirebaseFunctionsTestingSupport",
-                     "SharedTestUtilities"],
-      path: "FirebaseFunctions/Tests/SwiftIntegration"
-    ),
-    .target(
-      name: "FirebaseFunctionsTestingSupport",
-      dependencies: ["FirebaseFunctions"],
-      path: "FirebaseTestingSupport/Functions/Sources",
-      publicHeadersPath: "Public",
-      cSettings: [
-        .headerSearchPath("../../.."),
-      ]
-    ),
 
     // MARK: - Firebase In App Messaging
 
@@ -1111,7 +1056,7 @@ let package = Package(
         "FirebaseDynamicLinks",
         "FirebaseFirestore",
         "FirebaseFirestoreSwift",
-        "FirebaseFunctionsSwift",
+        "FirebaseFunctions",
         "FirebaseInAppMessaging",
         .target(name: "FirebaseInAppMessagingSwift",
                 condition: .when(platforms: [.iOS, .tvOS])),

+ 0 - 1
ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift

@@ -43,7 +43,6 @@ public let shared = Manifest(
     Pod("FirebaseFirestore", allowWarnings: true, zip: true),
     Pod("FirebaseFirestoreSwift", isBeta: true),
     Pod("FirebaseFunctions", zip: true),
-    Pod("FirebaseFunctionsSwift", isBeta: true),
     Pod("FirebaseInAppMessaging", isBeta: true, platforms: ["ios"], zip: true),
     Pod("FirebaseInAppMessagingSwift", isBeta: true, platforms: ["ios"]),
     Pod("FirebaseMessaging", zip: true),

+ 4 - 0
ReleaseTooling/Sources/ZipBuilder/CocoaPodUtils.swift

@@ -530,6 +530,10 @@ enum CocoaPodUtils {
         if podspec == "FirebaseInstallations.podspec" ||
           podspec == "FirebaseCoreDiagnostics.podspec" ||
           podspec == "FirebaseCore.podspec" ||
+          podspec == "FirebaseCoreInternal.podspec" ||
+          podspec == "FirebaseAppCheck.podspec" ||
+          podspec == "FirebaseAuth.podspec" ||
+          podspec == "FirebaseMessaging.podspec" ||
           podspec == "FirebaseRemoteConfig.podspec" ||
           podspec == "FirebaseABTesting.podspec" {
           let podName = podspec.replacingOccurrences(of: ".podspec", with: "")

+ 0 - 2
SwiftPMTests/objc-import-test/objc-header.m

@@ -24,7 +24,6 @@
 #import "FirebaseDatabase/FirebaseDatabase.h"
 #import "FirebaseDynamicLinks/FirebaseDynamicLinks.h"
 #import "FirebaseFirestore/FirebaseFirestore.h"
-#import "FirebaseFunctions/FirebaseFunctions.h"
 #if TARGET_OS_IOS || TARGET_OS_TV
 #import "FirebaseInAppMessaging/FirebaseInAppMessaging.h"
 #endif
@@ -48,7 +47,6 @@
 #import <FirebaseDatabase/FirebaseDatabase.h>
 #import <FirebaseDynamicLinks/FirebaseDynamicLinks.h>
 #import <FirebaseFirestore/FirebaseFirestore.h>
-#import <FirebaseFunctions/FirebaseFunctions.h>
 #if TARGET_OS_IOS || TARGET_OS_TV
 #import <FirebaseInAppMessaging/FirebaseInAppMessaging.h>
 #endif

+ 1 - 1
SwiftPMTests/swift-test/main.swift

@@ -26,7 +26,7 @@ import FirebaseDatabase
 import FirebaseDynamicLinks
 import FirebaseFirestore
 import FirebaseFirestoreSwift
-import FirebaseFunctionsSwift
+import FirebaseFunctions
 #if (os(iOS) || os(tvOS)) && !targetEnvironment(macCatalyst)
   import FirebaseInAppMessaging
   @testable import FirebaseInAppMessagingSwift

+ 1 - 1
scripts/health_metrics/file_patterns.json

@@ -111,7 +111,7 @@
   },
   {
     "sdk": "functions",
-    "podspecs": ["FirebaseFunctions.podspec", "FirebaseFunctionsSwift.podspec"],
+    "podspecs": ["FirebaseFunctions.podspec"],
     "filePatterns": [
       "^Functions.*",
       "\\.github/workflows/functions\\.yml",

+ 2 - 0
scripts/localize_podfile.swift

@@ -36,6 +36,8 @@ let implicitPods = [
   "FirebaseCore", "FirebaseInstallations", "Firebase",
   "FirebaseAuth", "FirebaseABTesting",
   "FirebaseCoreDiagnostics", "FirebaseRemoteConfig",
+  "FirebaseCoreInternal", "FirebaseAppCheckInterop",
+  "FirebaseAuthInterop", "FirebaseMessagingInterop",
 ]
 var didImplicits = false
 

+ 9 - 9
scripts/spm_test_schemes/FirebaseFunctionsSwiftIntegration.xcscheme → scripts/spm_test_schemes/FirebaseFunctionsIntegration.xcscheme

@@ -14,9 +14,9 @@
             buildForAnalyzing = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftIntegration"
-               BuildableName = "FirebaseFunctionsSwiftIntegration"
-               BlueprintName = "FirebaseFunctionsSwiftIntegration"
+               BlueprintIdentifier = "FirebaseFunctionsIntegration"
+               BuildableName = "FirebaseFunctionsIntegration"
+               BlueprintName = "FirebaseFunctionsIntegration"
                ReferencedContainer = "container:">
             </BuildableReference>
          </BuildActionEntry>
@@ -32,9 +32,9 @@
             skipped = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftIntegration"
-               BuildableName = "FirebaseFunctionsSwiftIntegration"
-               BlueprintName = "FirebaseFunctionsSwiftIntegration"
+               BlueprintIdentifier = "FirebaseFunctionsIntegration"
+               BuildableName = "FirebaseFunctionsIntegration"
+               BlueprintName = "FirebaseFunctionsIntegration"
                ReferencedContainer = "container:">
             </BuildableReference>
          </TestableReference>
@@ -60,9 +60,9 @@
       <MacroExpansion>
          <BuildableReference
             BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FirebaseFunctionsSwiftIntegration"
-            BuildableName = "FirebaseFunctionsSwiftIntegration"
-            BlueprintName = "FirebaseFunctionsSwiftIntegration"
+            BlueprintIdentifier = "FirebaseFunctionsIntegration"
+            BuildableName = "FirebaseFunctionsIntegration"
+            BlueprintName = "FirebaseFunctionsIntegration"
             ReferencedContainer = "container:">
          </BuildableReference>
       </MacroExpansion>

+ 9 - 9
scripts/spm_test_schemes/FirebaseFunctionsSwiftObjCIntegration.xcscheme → scripts/spm_test_schemes/FirebaseFunctionsObjCIntegration.xcscheme

@@ -14,9 +14,9 @@
             buildForAnalyzing = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftObjCIntegration"
-               BuildableName = "FirebaseFunctionsSwiftObjCIntegration"
-               BlueprintName = "FirebaseFunctionsSwiftObjCIntegration"
+               BlueprintIdentifier = "FirebaseFunctionsObjCIntegration"
+               BuildableName = "FirebaseFunctionsObjCIntegration"
+               BlueprintName = "FirebaseFunctionsObjCIntegration"
                ReferencedContainer = "container:">
             </BuildableReference>
          </BuildActionEntry>
@@ -32,9 +32,9 @@
             skipped = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftObjCIntegration"
-               BuildableName = "FirebaseFunctionsSwiftObjCIntegration"
-               BlueprintName = "FirebaseFunctionsSwiftObjCIntegration"
+               BlueprintIdentifier = "FirebaseFunctionsObjCIntegration"
+               BuildableName = "FirebaseFunctionsObjCIntegration"
+               BlueprintName = "FirebaseFunctionsObjCIntegration"
                ReferencedContainer = "container:">
             </BuildableReference>
          </TestableReference>
@@ -60,9 +60,9 @@
       <MacroExpansion>
          <BuildableReference
             BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FirebaseFunctionsSwiftObjCIntegration"
-            BuildableName = "FirebaseFunctionsSwiftObjCIntegration"
-            BlueprintName = "FirebaseFunctionsSwiftObjCIntegration"
+            BlueprintIdentifier = "FirebaseFunctionsObjCIntegration"
+            BuildableName = "FirebaseFunctionsObjCIntegration"
+            BlueprintName = "FirebaseFunctionsObjCIntegration"
             ReferencedContainer = "container:">
          </BuildableReference>
       </MacroExpansion>

+ 9 - 9
scripts/spm_test_schemes/FirebaseFunctionsSwiftUnit.xcscheme → scripts/spm_test_schemes/FirebaseFunctionsUnit.xcscheme

@@ -14,9 +14,9 @@
             buildForAnalyzing = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftUnit"
-               BuildableName = "FirebaseFunctionsSwiftUnit"
-               BlueprintName = "FirebaseFunctionsSwiftUnit"
+               BlueprintIdentifier = "FirebaseFunctionsUnit"
+               BuildableName = "FirebaseFunctionsUnit"
+               BlueprintName = "FirebaseFunctionsUnit"
                ReferencedContainer = "container:">
             </BuildableReference>
          </BuildActionEntry>
@@ -32,9 +32,9 @@
             skipped = "NO">
             <BuildableReference
                BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FirebaseFunctionsSwiftUnit"
-               BuildableName = "FirebaseFunctionsSwiftUnit"
-               BlueprintName = "FirebaseFunctionsSwiftUnit"
+               BlueprintIdentifier = "FirebaseFunctionsUnit"
+               BuildableName = "FirebaseFunctionsUnit"
+               BlueprintName = "FirebaseFunctionsUnit"
                ReferencedContainer = "container:">
             </BuildableReference>
          </TestableReference>
@@ -60,9 +60,9 @@
       <MacroExpansion>
          <BuildableReference
             BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FirebaseFunctionsSwiftUnit"
-            BuildableName = "FirebaseFunctionsSwiftUnit"
-            BlueprintName = "FirebaseFunctionsSwiftUnit"
+            BlueprintIdentifier = "FirebaseFunctionsUnit"
+            BuildableName = "FirebaseFunctionsUnit"
+            BlueprintName = "FirebaseFunctionsUnit"
             ReferencedContainer = "container:">
          </BuildableReference>
       </MacroExpansion>

+ 0 - 77
scripts/spm_test_schemes/FunctionsIntegration.xcscheme

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "1310"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsIntegration"
-               BuildableName = "FunctionsIntegration"
-               BlueprintName = "FunctionsIntegration"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-         <TestableReference
-            skipped = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsIntegration"
-               BuildableName = "FunctionsIntegration"
-               BlueprintName = "FunctionsIntegration"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </TestableReference>
-      </Testables>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FunctionsIntegration"
-            BuildableName = "FunctionsIntegration"
-            BlueprintName = "FunctionsIntegration"
-            ReferencedContainer = "container:">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 0 - 77
scripts/spm_test_schemes/FunctionsSwiftIntegration.xcscheme

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "1310"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsSwiftIntegration"
-               BuildableName = "FunctionsSwiftIntegration"
-               BlueprintName = "FunctionsSwiftIntegration"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-         <TestableReference
-            skipped = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsSwiftIntegration"
-               BuildableName = "FunctionsSwiftIntegration"
-               BlueprintName = "FunctionsSwiftIntegration"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </TestableReference>
-      </Testables>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FunctionsSwiftIntegration"
-            BuildableName = "FunctionsSwiftIntegration"
-            BlueprintName = "FunctionsSwiftIntegration"
-            ReferencedContainer = "container:">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 0 - 77
scripts/spm_test_schemes/FunctionsUnit.xcscheme

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "1300"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsUnit"
-               BuildableName = "FunctionsUnit"
-               BlueprintName = "FunctionsUnit"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-         <TestableReference
-            skipped = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsUnit"
-               BuildableName = "FunctionsUnit"
-               BlueprintName = "FunctionsUnit"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </TestableReference>
-      </Testables>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FunctionsUnit"
-            BuildableName = "FunctionsUnit"
-            BlueprintName = "FunctionsUnit"
-            ReferencedContainer = "container:">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>

+ 0 - 77
scripts/spm_test_schemes/FunctionsUnitSwift.xcscheme

@@ -1,77 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<Scheme
-   LastUpgradeVersion = "1300"
-   version = "1.3">
-   <BuildAction
-      parallelizeBuildables = "YES"
-      buildImplicitDependencies = "YES">
-      <BuildActionEntries>
-         <BuildActionEntry
-            buildForTesting = "YES"
-            buildForRunning = "YES"
-            buildForProfiling = "NO"
-            buildForArchiving = "NO"
-            buildForAnalyzing = "YES">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsUnitSwift"
-               BuildableName = "FunctionsUnitSwift"
-               BlueprintName = "FunctionsUnitSwift"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </BuildActionEntry>
-      </BuildActionEntries>
-   </BuildAction>
-   <TestAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      shouldUseLaunchSchemeArgsEnv = "YES">
-      <Testables>
-         <TestableReference
-            skipped = "NO">
-            <BuildableReference
-               BuildableIdentifier = "primary"
-               BlueprintIdentifier = "FunctionsUnitSwift"
-               BuildableName = "FunctionsUnitSwift"
-               BlueprintName = "FunctionsUnitSwift"
-               ReferencedContainer = "container:">
-            </BuildableReference>
-         </TestableReference>
-      </Testables>
-   </TestAction>
-   <LaunchAction
-      buildConfiguration = "Debug"
-      selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
-      selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
-      launchStyle = "0"
-      useCustomWorkingDirectory = "NO"
-      ignoresPersistentStateOnLaunch = "NO"
-      debugDocumentVersioning = "YES"
-      debugServiceExtension = "internal"
-      allowLocationSimulation = "YES">
-   </LaunchAction>
-   <ProfileAction
-      buildConfiguration = "Release"
-      shouldUseLaunchSchemeArgsEnv = "YES"
-      savedToolIdentifier = ""
-      useCustomWorkingDirectory = "NO"
-      debugDocumentVersioning = "YES">
-      <MacroExpansion>
-         <BuildableReference
-            BuildableIdentifier = "primary"
-            BlueprintIdentifier = "FunctionsUnitSwift"
-            BuildableName = "FunctionsUnitSwift"
-            BlueprintName = "FunctionsUnitSwift"
-            ReferencedContainer = "container:">
-         </BuildableReference>
-      </MacroExpansion>
-   </ProfileAction>
-   <AnalyzeAction
-      buildConfiguration = "Debug">
-   </AnalyzeAction>
-   <ArchiveAction
-      buildConfiguration = "Release"
-      revealArchiveInOrganizer = "YES">
-   </ArchiveAction>
-</Scheme>