firebase-ios-sdk icon indicating copy to clipboard operation
firebase-ios-sdk copied to clipboard

Added support to ZipBuilder for adding watchOS and watchOS Simulator slices

Open simonmaddox opened this issue 3 years ago • 12 comments

This was first mentioned in #8731. @paulb777 said that ZipBuilder needed to be updated to add watchOS and watchOS Simulator slices. I believe that this Pull Request implements these changes.

Unfortunately I've been unable to test - running swift run zip-builder on my machine, even with a fresh clone, causes a crash somewhere deep in Ruby. I've searched for every mention of tvOS and re-implemented for watchOS. If this doesn't 100% work, then perhaps it will get you most of the way there.

I implemented this because my app requires iOS 10 support, which means I cannot use SPM distribution. However, watchOS support appears to only be distributed in the SPM version of the frameworks.

simonmaddox avatar Oct 18 '21 14:10 simonmaddox

@simonmaddox Thanks for the PR! I've kicked off CI and will take a deeper look later this week.

In addition to SPM, we support watchOS via CocoaPods.

paulb777 avatar Oct 18 '21 14:10 paulb777

Thanks @paulb777. Unfortunately I can't use Cocoapods here - xcframeworks or SPM only.

Again, to reiterate, I'm unable to test on my machine (I'll search through Issues - perhaps that's been resolved somewhere). But this is hopefully a good starting point.

I wanted to show that there is demand for this change, and wanted to help get it over the line as best I could :)

simonmaddox avatar Oct 18 '21 15:10 simonmaddox

Last build failed because "Proposed commit is not style compliant". I've run style.sh and hopefully this time it passes 🤞

simonmaddox avatar Oct 18 '21 15:10 simonmaddox

The CI is failing after two and a half hours - likely after building all the other platforms and failing when it starts to try watchos. Likely there are problems related to trying to build products not supported for watchOS. https://github.com/firebase/firebase-ios-sdk/blob/master/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift#L26 probably needs updates to turn watchos off in several places.

Either way, a good next step would be to locally edit https://github.com/firebase/firebase-ios-sdk/blob/master/ReleaseTooling/Sources/FirebaseManifest/FirebaseManifest.swift and try to get a watchos build working for a single pod.

paulb777 avatar Oct 18 '21 21:10 paulb777

Thanks @paulb777, I’ll take a look at this.

First task is to figure out why builds are crashing locally. Once I’ve done that, hopefully it won’t take too much work.

simonmaddox avatar Oct 18 '21 21:10 simonmaddox

Tried building this on an Intel Mac, and under Rosetta on my M1 Mac, and got a little further. The build script no longer crashes inside Ruby.

Instead, it looks like I can't build because:

None of your spec sources contain a spec satisfying the dependency: FirebaseAppDistribution (= 8.9.0-beta).

I've checked out the 8.8.0 tag from the repo, and appear to be having some better luck now.

simonmaddox avatar Oct 19 '21 08:10 simonmaddox

Ok, I think I'm as far as I can go at this point with my very minimal knowledge of Firebase and Cocoapods.

I've (locally) got it mostly building for watchOS - it makes it most of the way through the build process. However, it's currently complaining that the base Firebase spec doesn't support watchOS. But when I add support to that spec, I get errors that Analytics doesn't support watchOS. FirebaseAnalytics-[version].tar.gz is downloaded from Google's server during the build process so I'm unable to modify that.

I've pushed what I've got to my branch (except for the changes to the .podspec files. I worry that changing that will have a bigger impact that I can check for). It won't pass the build system's checks, so there's no point in running - but perhaps will provide the majority of an implementation for this issue.

Before enabling watchos on Firebase in FirebaseManifest.swift:

ZipBuilder/ZipBuilder.swift:344: Fatal error: Could not get the Firebase pod from list of installed pods. All pods installed: ["nanopb": ZipBuilder.CocoaPodUtils.PodInfo, "FirebaseCrashlytics": ZipBuilder.CocoaPodUtils.PodInfo, "PromisesObjC": ZipBuilder.CocoaPodUtils.PodInfo, "GoogleDataTransport": ZipBuilder.CocoaPodUtils.PodInfo, "GoogleUtilities": ZipBuilder.CocoaPodUtils.PodInfo, "FirebaseInstallations": ZipBuilder.CocoaPodUtils.PodInfo, "FirebaseCore": ZipBuilder.CocoaPodUtils.PodInfo, "FirebaseCoreDiagnostics": ZipBuilder.CocoaPodUtils.PodInfo]

After enabling watchos on Firebase:

ZipBuilder/ZipBuilder.swift:422: Fatal error: Could not copy frameworks from Analytics into the zip file: Error Domain=com.firebase.zipbuilder Code=1 "Unable to find frameworks for FirebaseAnalytics in cache of frameworks built to include in the Zip file for that framework's folder." UserInfo={NSLocalizedDescription=Unable to find frameworks for FirebaseAnalytics in cache of frameworks built to include in the Zip file for that framework's folder.}

For future reference, the command I'm running to test this is:

swift run zip-builder --platforms watchos --local-podspec-path ../

simonmaddox avatar Oct 19 '21 11:10 simonmaddox

Good progress. thanks! The Analytics problem should be solvable by following the tvos/macos pattern, since Analytics doesn't support those either.

paulb777 avatar Oct 19 '21 13:10 paulb777

I've already followed that pattern for Analytics, but adding "Firebase" appears to require "Analytics". Not sure where to go now.

simonmaddox avatar Oct 19 '21 13:10 simonmaddox

Hmm, Firebase.podspec should only have Analytics dependencies for iOS. ZipBuilder.swift:422 should be ok because there should still be Analytics for iOS.

I'll try to dig in deeper later this week or next

paulb777 avatar Oct 19 '21 14:10 paulb777

Thanks. It's quite likely that I'm missing something obvious, but I'm pretty unfamiliar with the Firebase product architecture and build process.

simonmaddox avatar Oct 19 '21 14:10 simonmaddox

I looked a bit more. We don't currently support the Firebase pod for watchOS. A workaround to the ZipBuilder/ZipBuilder.swift:344: Fatal error: fatal error could be to save the Firebase pod version from one of the other platforms as a class variable, since there is nothing currently platform specific in it.

paulb777 avatar Oct 19 '21 16:10 paulb777

Closing in favor of #12624

paulb777 avatar Mar 27 '24 14:03 paulb777