microsoft / react-native-macos

A framework for building native macOS apps with React.
https://microsoft.github.io/react-native-windows/
MIT License
3.39k stars 130 forks source link

[visionOS] Add local podspecs to override supported platforms #2047

Closed Saadnajmi closed 6 months ago

Saadnajmi commented 6 months ago

Please select one of the following

Summary:

This PR is part of a series of PRs for adding support for visionOS to the repository. See #2019 .

The way cocoapods works, the platforms a pod targets must be specified in its' pod spec, otherwise the generated Xcodeproj target won't output that platform's static library. AKA, if Pod A targets {:iOS => 13.4, :osx => 10.15}, then targets that output libA-iOS.a and libA-macOS.a will be generated, but not targets that output libA-visionOS.a. For most pod dependencies of react native, we set the platforms using min_supported_versions helper method, which we can override to return as many platforms as we want. However, there are a few pods where we don't control the podspec because we're getting it from the cocoapods registry. Without updating the pod in its own repo, we wouldn't be able to override the platforms, even if we're perfectly able to compile for said platform. In our case, that would be:

Rather than wait for those repos to update (SocketRocket has been taking a while), we can instead make local podspecs, stick in the folder third_party_podspecs, and reference them in our ruby methods. Let's do that.

We don't need to add fmt.podspec for main because https://github.com/facebook/react-native/commit/bb9ed0e9061288e56796fe6fe6a69541c3e09c90 already did so. For the back ports to 0.73-stable and 0.72-stable, I will cherry-pick that change with the caveat it is newer than the version of fmt used on those branches before. I tried to downgrade to 6.2.1... but then it failed to build. This is a library for formatting print statements and iostream, which should be relatively safe to upgrade.

Changelog:

[IOS] [CHANGED] - Add local podspecs to override supported platforms

Test Plan:

CI should pass.