Преглед изворни кода

Internal API and fixes for SPM

samedson пре 3 година
родитељ
комит
0d9bf42e55

+ 1 - 1
Crashlytics/Crashlytics/FIRCrashlytics.m

@@ -52,7 +52,7 @@
 
 #import "FirebaseCore/Extension/FirebaseCoreInternal.h"
 #import "FirebaseInstallations/Source/Library/Private/FirebaseInstallationsInternal.h"
-#import "FirebaseSessions/Interop/FIRSessionsProvider.h"
+#import "FirebaseSessions/Internal/FIRSessionsProvider.h"
 #import "Interop/Analytics/Public/FIRAnalyticsInterop.h"
 
 #import <GoogleDataTransport/GoogleDataTransport.h>

+ 2 - 2
FirebaseCrashlytics.podspec

@@ -34,9 +34,9 @@ Pod::Spec.new do |s|
     'FirebaseCore/Extension/*.h',
     'FirebaseInstallations/Source/Library/Private/*.h',
     'Interop/Analytics/Public/*.h',
-    # TODO(samedson) Remove Interop when FirebaseSessions releases and move to
+    # TODO(b/264274170) Remove Interop when FirebaseSessions releases and move to
     # FirebaseSessions.swift
-    'FirebaseSessions/Interop/*.h',
+    'FirebaseSessions/Internal/*.h',
   ]
 
   s.public_header_files = [

+ 1 - 1
FirebaseSessions.podspec

@@ -37,7 +37,7 @@ Pod::Spec.new do |s|
   s.source_files = [
     base_dir + 'Sources/**/*.{swift}',
     base_dir + 'SourcesObjC/**/*.{c,h,m,mm}',
-    # TODO(samedson) Remove Interop when FirebaseSessions releases and move to
+    # TODO(b/264274170) Remove Interop when FirebaseSessions releases and move to
     # FirebaseSessions.swift
     base_dir + 'Interop/*.h',
   ]

+ 1 - 1
FirebaseSessions/Interop/FIRSessionsProvider.h → FirebaseSessions/Internal/FIRSessionsProvider.h

@@ -41,7 +41,7 @@ NS_SWIFT_NAME(SessionsSubscriber)
 /// dependency. To make SDKs that depend on FirebaseSessions build,
 /// we're defining this header in Objective-C and including it in all places.
 ///
-/// TODO(samedson) Remove Interop when FirebaseSessions releases and move to
+/// TODO(b/264274170) Remove Interop when FirebaseSessions releases and move to
 /// FirebaseSessions.swift
 NS_SWIFT_NAME(SessionsProvider)
 @protocol FIRSessionsProvider

+ 3 - 0
FirebaseSessions/Sources/FirebaseSessions.swift

@@ -18,6 +18,9 @@ import Foundation
 @_implementationOnly import FirebaseCoreExtension
 @_implementationOnly import FirebaseInstallations
 @_implementationOnly import GoogleDataTransport
+#if SWIFT_PACKAGE
+  import FirebaseSessionsObjC
+#endif // SWIFT_PACKAGE
 
 private enum GoogleDataTransportConfig {
   static let sessionsLogSource = "1974"

+ 4 - 0
FirebaseSessions/Sources/SessionsSubscriber+CustomStringConvertible.swift

@@ -15,6 +15,10 @@
 
 import Foundation
 
+#if SWIFT_PACKAGE
+  import FirebaseSessionsObjC
+#endif // SWIFT_PACKAGE
+
 extension SessionsSubscriberName: CustomStringConvertible {
   public var description: String {
     switch self {

+ 31 - 0
FirebaseSessions/SourcesObjC/FirebaseSessionsInternal.h

@@ -0,0 +1,31 @@
+//
+// Copyright 2022 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.
+
+#ifndef FirebaseSessionsInternal_h
+#define FirebaseSessionsInternal_h
+
+#import <Foundation/Foundation.h>
+
+// This header is necessary for including the Interop header
+// in the Swift part of the codebase under Swift Package Manager
+// TODO(b/264274170) Remove the interop and make the dependency direct
+#import "FirebaseSessions/Internal/FIRSessionsProvider.h"
+
+NS_ASSUME_NONNULL_BEGIN
+
+
+NS_ASSUME_NONNULL_END
+
+#endif /* FirebaseSessionsInternal_h */

+ 5 - 2
Package.swift

@@ -1094,7 +1094,7 @@ let package = Package(
       ],
       path: "FirebaseSessions/Sources",
       cSettings: [
-        .headerSearchPath(".."),
+        .headerSearchPath("../.."),
         .define("DISPLAY_VERSION", to: firebaseVersion),
         .define("PB_FIELD_32BIT", to: "1"),
         .define("PB_NO_PACKED_STRUCTS", to: "1"),
@@ -1141,7 +1141,10 @@ let package = Package(
     .testTarget(
       name: "FirebaseSessionsUnit",
       dependencies: ["FirebaseSessions"],
-      path: "FirebaseSessions/Tests/Unit"
+      path: "FirebaseSessions/Tests/Unit",
+      cSettings: [
+        .headerSearchPath("../../.."),
+      ]
     ),
 
     // MARK: - Firebase Storage