react-native icon indicating copy to clipboard operation
react-native copied to clipboard

Update Yoga.podspec: fixes archiving for Mac Catalyst

Open kesha-antonov opened this issue 1 year ago • 9 comments

Hi

Summary:

When I tried to archive macos catalyst app in Xcode I got errors:

Screenshot 2024-02-05 at 00 03 32

This PR fixes archiving by linking PrivateHeaders in yoga.framework

Screenshot 2024-02-05 at 01 03 48 Screenshot 2024-02-05 at 01 05 18

Prev PR here https://github.com/facebook/react-native/pull/42159

Changelog:

[IOS] [FIXED] - fixed archiving for Mac Catalyst

Test Plan:

Try archive react-native tester app for macos catalyst in Xcode

kesha-antonov avatar Feb 04 '24 22:02 kesha-antonov

Hi @kesha-antonov, thanks for opening the issue. Setting the Header search paths for Yoga fixes the issue but it is not the right fix. The problem with Catalyst is that it stores the headers in the wrong folder when archiving for Mac Catalyst. The right fix is to set the right folder for the Public haders, similarly to what we did for Fabric.

Could you either:

  1. Try to apply a similar fix to yoga and archive again to verify that it works or
  2. Create a reproducer using this repo so I can try it myself and provide the right fix, please? 🙏

cipolleschi avatar Feb 05 '24 08:02 cipolleschi

Hi @kesha-antonov, thanks for opening the issue. Setting the Header search paths for Yoga fixes the issue but it is not the right fix. The problem with Catalyst is that it stores the headers in the wrong folder when archiving for Mac Catalyst. The right fix is to set the right folder for the Public haders, similarly to what we did for Fabric.

Could you either:

  1. Try to apply a similar fix to yoga and archive again to verify that it works or
  2. Create a reproducer using this repo so I can try it myself and provide the right fix, please? 🙏

Hi,

yeah, I tried what you propose but it doesn't work unfortunately I'll make reproduction

Also I don't think that problem in Public Headers since XCode shows error that it can't import files that are located as Private Headers

We make headers as public for root directory: https://github.com/facebook/react-native/blob/1c5877ae5d24b06c8ceb1afb52c978bc79e079d0/packages/react-native/ReactCommon/yoga/Yoga.podspec#L57 On other levels it is private headers: https://github.com/facebook/react-native/blob/1c5877ae5d24b06c8ceb1afb52c978bc79e079d0/packages/react-native/ReactCommon/yoga/Yoga.podspec#L64

So for what you propose to work we need to write public_header_files = 'yoga/**/*.h' Or make Private Headers visible as I proposed

What do you think?

kesha-antonov avatar Feb 05 '24 09:02 kesha-antonov

The difference that in repro app Search Paths are correct by default.

Screenshot 2024-02-05 at 13 30 43

When I add ENV['USE_FRAMEWORKS'] = 'static' to Podfile it changes to

Screenshot 2024-02-05 at 13 34 44

Then it starts to fail archiving. Even with proposed fix

Screenshot 2024-02-05 at 13 39 58

kesha-antonov avatar Feb 05 '24 10:02 kesha-antonov

@cipolleschi I've made the repro here: https://github.com/kesha-antonov/react-native-mac_catalyst_archiving_issue_05_02_2024

kesha-antonov avatar Feb 05 '24 10:02 kesha-antonov

Hi @kesha-antonov, thanks for spending the time on this and sorry for the late reply. I'm investigating the issue using your reproducer (thank you again for preparing it, it is super helpful).

You are right in saying that the problem is with Private headers rather than public ones.

I'm so confused because building for Release works properly but Archive fails... and AFAIK, the archive command will first build for release and the create the package... so, it is very unclear and weird that one works and the other doesn't... :/

cipolleschi avatar Feb 19 '24 14:02 cipolleschi

I think I found the actual issue... If we look at the step done for building:

Build for Release Archive
Screenshot 2024-02-19 at 14 57 22 Screenshot 2024-02-19 at 14 58 36

Basically, Archive does not create a folder for PrivateHeaders and does not symlink it, but I could not find how to specify that not with Xcode and not with Cocoapods.

I think this could be a bug in Xcode or in Cocoapods, to be honest.

cipolleschi avatar Feb 19 '24 15:02 cipolleschi

As a workaround, while we investigate this issue, I think we can move forward with this fix (I verified too that it works). I hope we could fix this properly (or that Cocoapods/Apple) will fix it for us

cipolleschi avatar Feb 19 '24 15:02 cipolleschi

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Feb 19 '24 15:02 facebook-github-bot

I think I found the actual issue... If we look at the step done for building:

| Build for Release | Archive |

| --- | --- |

| Screenshot 2024-02-19 at 14 57 22 | Screenshot 2024-02-19 at 14 58 36 |

Basically, Archive does not create a folder for PrivateHeaders and does not symlink it, but I could not find how to specify that not with Xcode and not with Cocoapods.

I think this could be a bug in Xcode or in Cocoapods, to be honest.

Thanks for the explanation. Didn't look at the logs there

I hope that Apple will fix it if it's Xcode's issue

kesha-antonov avatar Feb 19 '24 20:02 kesha-antonov

This pull request was successfully merged by @kesha-antonov in 767330f21885e668bc0d9b5b3063113d0446bcbc.

When will my fix make it into a release? | Upcoming Releases

github-actions[bot] avatar Feb 22 '24 14:02 github-actions[bot]