Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions CoreOnly/Sources/Firebase.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,13 @@

#if __has_include(<FirebaseAuth/FirebaseAuth.h>)
#import <FirebaseAuth/FirebaseAuth.h>
#if __has_include("FirebaseAuth-umbrella.h")
#if __has_include(<FirebaseAuth/FirebaseAuth-Swift.h>)
#if __has_include(<UIKit/UIKit.h>)
#import <UIKit/UIKit.h>
#endif
#import <FirebaseAuthInterop/FIRAuthInterop.h>
#if __has_include(<FirebaseAuthInterop/FIRAuthInterop.h>)
#import <FirebaseAuthInterop/FIRAuthInterop.h>
#endif
#import <FirebaseAuth/FirebaseAuth-Swift.h>
#endif
#endif
Expand All @@ -53,7 +55,7 @@
#import <FirebaseFirestore/FirebaseFirestore.h>
#endif

#if __has_include("FirebaseFunctions-umbrella.h")
#if __has_include(<FirebaseFunctions/FirebaseFunctions-Swift.h>)
#import <FirebaseFunctions/FirebaseFunctions-Swift.h>
#endif

Expand All @@ -77,7 +79,7 @@
#import <FirebaseRemoteConfig/FirebaseRemoteConfig.h>
#endif

#if __has_include("FirebaseStorage-umbrella.h")
#if __has_include(<FirebaseStorage/FirebaseStorage-Swift.h>)
#import <FirebaseStorage/FirebaseStorage-Swift.h>
#endif

Expand Down
5 changes: 5 additions & 0 deletions FirebaseCore/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Firebase 13.0.0
- [changed] **Breaking change**: Removed the CocoaPods generated umbrella headers
(suffixed `-umbrella.h`) from the Zip and Carthage artifacts, in favor of `Firebase.h`
and framework specific umbrella headers. (#16540)

# Firebase 12.17.0
- [changed] Removed the (never activated) `recaptchaSiteKey` property from `FirebaseOptions`.
This feature is part of the public preview reCAPTCHA provider.
Expand Down
41 changes: 21 additions & 20 deletions ReleaseTooling/Sources/ZipBuilder/FrameworkBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -341,34 +341,32 @@ struct FrameworkBuilder {
fatalError("Could not get a path to an archive to fetch headers in \(frameworkName).")
}

// Find CocoaPods generated umbrella header.
// Find the umbrella header to use.
var umbrellaHeader = ""
// TODO(ncooke3): Evaluate if `TensorFlowLiteObjC` is needed?
if framework == "gRPC-Core" || framework == "TensorFlowLiteObjC" {
// TODO: Proper handling of podspec-specified module.modulemap files with customized umbrella
// headers. This is good enough for Firebase since it doesn't need these modules.
// TODO(ncooke3): Is this needed for gRPC-Core?
umbrellaHeader = "\(framework)-umbrella.h"
} else {
var umbrellaHeaderURL: URL
// Get the framework Headers directory. On macOS, it's a symbolic link.
let headersDir = archivePath.appendingPathComponent("Headers").resolvingSymlinksInPath()
let headersDir = archivePath.appendingPathComponent("Headers").resolvingSymlinksInPath()
if fileManager.directoryExists(at: headersDir) {
do {
let files = try fileManager.contentsOfDirectory(at: headersDir,
includingPropertiesForKeys: nil)
.compactMap { $0.path }
let umbrellas = files.filter { $0.hasSuffix("umbrella.h") }
if umbrellas.count != 1 {
fatalError("Did not find exactly one umbrella header in \(headersDir).")
}
guard let firstUmbrella = umbrellas.first else {
fatalError("Failed to get umbrella header in \(headersDir).")

// ignore cocoapods umbrella headers
let headerFileNames = files
.filter { $0.hasSuffix(".h") && !$0.hasSuffix("-umbrella.h") }
.map { URL(fileURLWithPath: $0).lastPathComponent }

// use the framework's own umbrella header, if it has one
if headerFileNames.contains("\(frameworkName).h") {
umbrellaHeader = "umbrella header \"\(frameworkName).h\""
} else if headerFileNames.contains("\(framework).h") {
umbrellaHeader = "umbrella header \"\(framework).h\""
} else if !headerFileNames.isEmpty {
// use clang's umbrella directory syntax as a fallback
umbrellaHeader = #"umbrella ".""#
}
umbrellaHeaderURL = URL(fileURLWithPath: firstUmbrella)
} catch {
fatalError("Error while enumerating files \(headersDir): \(error.localizedDescription)")
}
umbrellaHeader = umbrellaHeaderURL.lastPathComponent
}

// TODO: copy PrivateHeaders directory as well if it exists. SDWebImage is an example pod.
Expand Down Expand Up @@ -485,7 +483,10 @@ struct FrameworkBuilder {
at: headersDir,
includingPropertiesForKeys: nil
)
if headers.count > 2 {
let nonUmbrellaHeaders = headers.filter { !$0.lastPathComponent.hasSuffix("-umbrella.h") }
let nonSwiftHeaders = nonUmbrellaHeaders
.filter { !$0.lastPathComponent.hasSuffix("-Swift.h") }
if !nonSwiftHeaders.isEmpty {
// It is assumed that the framework will always contain a
// `module.modulemap` (either CocoaPods generates it or a custom
// one was set in the podspec corresponding to the framework being
Expand Down
2 changes: 1 addition & 1 deletion ReleaseTooling/Sources/ZipBuilder/ModuleMapBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct ModuleMapBuilder {
init(module: String, frameworks: Set<String>, libraries: Set<String>) {
var content = """
framework module \(module) {
umbrella header "\(ModuleMapBuilder.ModuleMapContents.umbrellaPlaceholder)"
\(ModuleMapBuilder.ModuleMapContents.umbrellaPlaceholder)
export *
module * { export * }

Expand Down
15 changes: 15 additions & 0 deletions ReleaseTooling/Sources/ZipBuilder/ZipBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,21 @@ struct ZipBuilder {
try? FileManager.default.removeItem(at: grpcCertsBundle)
}

// Delete CocoaPods umbrella headers.
for path in ["Headers", "PrivateHeaders", "Versions/A/Headers", "Versions/A/PrivateHeaders"] {
let headersDir = framework.appendingPathComponent(path).resolvingSymlinksInPath()
if FileManager.default.directoryExists(at: headersDir) {
if let headerFiles = try? FileManager.default.contentsOfDirectory(
at: headersDir,
includingPropertiesForKeys: nil
) {
for file in headerFiles where file.lastPathComponent.hasSuffix("-umbrella.h") {
try? FileManager.default.removeItem(at: file)
}
}
}
}

// The macOS slice's `PrivateHeaders` directory may have a
// `PrivateHeaders` file in it that symbolically links to nowhere. Delete
// it here to avoid putting it in the zip or crashing the Carthage hash
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_firestore_symbols.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ fi
# This script uses an env var that will alter the repo's `Package.swift` to
# pick up the copied Firestore framework. See
# `FIREBASECI_USE_LOCAL_FIRESTORE_ZIP` in Firebase's `Package.swift` for more.
cp -r "$FIRESTORE_XCFRAMEWORK_PATH" "$FIREBASE_REPO_PATH"
cp -a "$FIRESTORE_XCFRAMEWORK_PATH" "$FIREBASE_REPO_PATH"

# Create a temporary directory for the test package. The test package defines an
# executable and has the following directory structure:
Expand Down
Loading