Skip to content

Commit

Permalink
Remove deprecated ML pods from Zip and docs (#6061)
Browse files Browse the repository at this point in the history
  • Loading branch information
paulb777 authored Jul 16, 2020
1 parent 69c3e4b commit e799928
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 71 deletions.
16 changes: 1 addition & 15 deletions Carthage.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,17 +47,7 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseGoogleSignInBinar
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseInAppMessagingBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMessagingBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLModelInterpreterBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLNLLanguageIDBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLNLSmartReplyBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLNLTranslateBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLNaturalLanguageBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionAutoMLBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionBarcodeModelBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionFaceModelBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionLabelModelBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionObjectDetectionBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseMLVisionTextModelBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebasePerformanceBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseProtobufBinary.json"
binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseRemoteConfigBinary.json"
Expand All @@ -73,11 +63,7 @@ binary "https://dl.google.com/dl/firebase/ios/carthage/FirebaseStorageBinary.jso
- [Delete Firebase.framework from the Link Binary With Libraries Build Phase](https://github.com/firebase/firebase-ios-sdk/issues/911#issuecomment-372455235).
- If you're including a Firebase component that has resources, copy its bundles
into the Xcode project and make sure they're added to the
`Copy Bundle Resources` Build Phase :
- For FirebaseMLVisionFaceModel:
- ./Carthage/Build/iOS/FaceDetector.framework/GoogleMVFaceDetectorResources.bundle
- For FirebaseMLVisionTextModel:
- ./Carthage/Build/iOS/TextDetector.framework/GoogleMVTextDetectorResources.bundle
`Copy Bundle Resources` Build Phase.

- Please note that you shouldn't add any of the Firebase frameworks to the Carthage build phase
(`copy-frameworks`). The frameworks contain static libraries that are linked at build time.
Expand Down
14 changes: 2 additions & 12 deletions Rome.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,8 @@ Then do the following steps:
`file Rome/*/* | grep universal | grep dynamic`
1. Drag each dynamic framework to the "Embed Frameworks" section on the
Xcode Build Target's "General" page.
1. If you're using FirebaseML, FirebaseInAppMessaging, or FirebaseFirestore,
find
the resources to the project: `ls -ld Pods/*/Resources/*`. More details on
this below.
1. If you're using FirebaseInAppMessaging, find the resources needed:
`ls -ld Pods/*/Resources/*`. More details on this below.
1. Drag all of those resources into the Project Navigator, just
like the frameworks, again making sure that the target you want to add these
resources to has a checkmark next to it, and that you've selected "Copy items
Expand All @@ -81,13 +79,5 @@ Then do the following steps:
- If you're including a Firebase component that has resources, copy its bundles
into the Xcode project and make sure they're added to the
`Copy Bundle Resources` Build Phase :
- For Firestore:
- ./Rome/GRPCClient.framework/gRPCCertificates.bundle
- For InAppMessaging:
- ./Rome/FirebaseInAppMessaging.framework/InAppMessagingDisplayResources.bundle
- For FirebaseMLVisionFaceModel:
- ./Pods/GoogleMobileVision/FaceDetector/Resources/GoogleMVFaceDetectorResources
- For FirebaseMLVisionTextModel:
- ./Pods/GoogleMobileVision/TextDetector/Resources/GoogleMVTextDetectorResources
- For the FirebaseML resources, a bundle needs to be created. TBD better
instructions here.
35 changes: 0 additions & 35 deletions ZipBuilder/Sources/ZipBuilder/FirebasePods.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,31 +34,11 @@ enum FirebasePods: String, CaseIterable {
case inAppMessaging = "FirebaseInAppMessaging"
case messaging = "FirebaseMessaging"
case mlModelInterpreter = "FirebaseMLModelInterpreter"
case mlNaturalLanguage = "FirebaseMLNaturalLanguage"
case mlNLLanguageID = "FirebaseMLNLLanguageID"
case mlNLSmartReply = "FirebaseMLNLSmartReply"
case mlNLTranslate = "FirebaseMLNLTranslate"
case mlVision = "FirebaseMLVision"
case mlVisionAutoML = "FirebaseMLVisionAutoML"
case mlVisionObjectDetection = "FirebaseMLVisionObjectDetection"
case mlVisionBarcodeModel = "FirebaseMLVisionBarcodeModel"
case mlVisionFaceModel = "FirebaseMLVisionFaceModel"
case mlVisionLabelModel = "FirebaseMLVisionLabelModel"
case mlVisionTextModel = "FirebaseMLVisionTextModel"
case performance = "FirebasePerformance"
case remoteConfig = "FirebaseRemoteConfig"
case storage = "FirebaseStorage"

/// Flag to explicitly exclude any Resources from being copied.
var excludeResources: Bool {
switch self {
case .mlVision, .mlVisionBarcodeModel, .mlVisionLabelModel:
return true
default:
return false
}
}

/// Describes the dependency on other frameworks for the README file.
static func readmeHeader(podName: String) -> String {
var header = "## \(podName)"
Expand All @@ -68,19 +48,4 @@ enum FirebasePods: String, CaseIterable {
header += "\n"
return header
}

// TODO: Evaluate if there's a way to do this that doesn't require the hardcoded values to be
// maintained. Likely looking at the `vendored_frameworks` from each Pod's Podspec.
/// Returns folders to remove from the Zip file from a specific pod for de-duplication. This
/// is necessary for the MLKit frameworks because of their unique structure, an unnecessary amount
/// of frameworks get pulled in.
static func duplicateFrameworksToRemove(pod: String) -> [String] {
switch pod {
case "FirebaseMLVisionBarcodeModel", "FirebaseMLVisionFaceModel", "FirebaseMLVisionLabelModel",
"FirebaseMLVisionTextModel":
return ["GTMSessionFetcher.framework", "Protobuf.framework"]
default:
return []
}
}
}
11 changes: 2 additions & 9 deletions ZipBuilder/Sources/ZipBuilder/ZipBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -374,8 +374,7 @@ struct ZipBuilder {
func copyFrameworks(fromPods installedPods: [String],
toDirectory dir: URL,
frameworkLocations: [String: [URL]],
podsToIgnore: [String] = [],
foldersToIgnore: [String] = []) throws -> [String] {
podsToIgnore: [String] = []) throws -> [String] {
let fileManager = FileManager.default
if !fileManager.directoryExists(at: dir) {
try fileManager.createDirectory(at: dir, withIntermediateDirectories: false, attributes: nil)
Expand Down Expand Up @@ -405,10 +404,6 @@ struct ZipBuilder {
// Copy each of the frameworks over, unless it's explicitly ignored.
for xcframework in xcframeworks {
let xcframeworkName = xcframework.lastPathComponent
if foldersToIgnore.contains(xcframeworkName) {
continue
}

let destination = dir.appendingPathComponent(xcframeworkName)
try fileManager.copyItem(at: xcframework, to: destination)
copiedFrameworkNames
Expand Down Expand Up @@ -553,9 +548,7 @@ struct ZipBuilder {
let namedFrameworks = try copyFrameworks(fromPods: podsToCopy,
toDirectory: productDir,
frameworkLocations: builtFrameworks,
podsToIgnore: podsToIgnore,
foldersToIgnore: FirebasePods
.duplicateFrameworksToRemove(pod: podName))
podsToIgnore: podsToIgnore)

let copiedFrameworks = namedFrameworks.filter {
// Skip frameworks that aren't contained in the "podsToIgnore" array and the Firebase pod.
Expand Down

0 comments on commit e799928

Please sign in to comment.