Make all headers public and add #ifdef __cplusplus #1150

Closed
janicduplessis wants to merge 1 commits from cppheaders into main
janicduplessis commented 2022-06-05 10:39:52 -07:00 (Migrated from github.com)

This change is mostly needed to support the new react-native architecture with Swift. Some private yoga headers end up being included in the swift build and result in compilation failure since swift cannot compile c++ modules. See https://github.com/facebook/react-native/pull/33381.

The most reliable fix is to include all headers as public headers, and add #ifdef __cplusplus to those that include c++. This is already what we do for other headers, this applies this to all headers.

Tested in the YogaKitSample, and also in a react-native app.

This change is mostly needed to support the new react-native architecture with Swift. Some private yoga headers end up being included in the swift build and result in compilation failure since swift cannot compile c++ modules. See https://github.com/facebook/react-native/pull/33381. The most reliable fix is to include all headers as public headers, and add `#ifdef __cplusplus` to those that include c++. This is already what we do for other headers, this applies this to all headers. Tested in the YogaKitSample, and also in a react-native app.
facebook-github-bot commented 2022-06-07 02:56:32 -07:00 (Migrated from github.com)

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

@cortinico has imported this pull request. If you are a Meta employee, you can view this diff [on Phabricator](https://www.internalfb.com/diff/D36966687).
dmytrorykun commented 2022-06-07 03:16:29 -07:00 (Migrated from github.com)

Hi @janicduplessis, can we revert https://github.com/facebook/react-native/pull/33381 as the next step?

Hi @janicduplessis, can we revert https://github.com/facebook/react-native/pull/33381 as the next step?
Kudo commented 2022-06-07 03:36:26 -07:00 (Migrated from github.com)

Yes, please. But I think the change to react_native_pods.rb don’t need to be reverted. I can create a pr for this later today if it works.

Yes, please. But I think the change to react_native_pods.rb don’t need to be reverted. I can create a pr for this later today if it works.
janicduplessis commented 2022-06-07 07:54:30 -07:00 (Migrated from github.com)

Yea we don't want to revert the whole thing. Sounds good @Kudo you can do the follow up PR in react-native.

Yea we don't want to revert the whole thing. Sounds good @Kudo you can do the follow up PR in react-native.
kelset commented 2022-06-07 08:03:16 -07:00 (Migrated from github.com)

What's the process now to get this version of Yoga with the fix to be consumed by RN? (yoga is actually missing from https://reactnative.dev/contributing/release-dependencies 😅)

What's the process now to get this version of Yoga with the fix to be consumed by RN? (yoga is actually missing from https://reactnative.dev/contributing/release-dependencies 😅)
cortinico commented 2022-06-07 09:19:55 -07:00 (Migrated from github.com)

What's the process now to get this version of Yoga with the fix to be consumed by RN?

Yoga is dir-synced inside ReactCommon/yoga/yoga so we don't need any version bump at all at this stage 👍

> What's the process now to get this version of Yoga with the fix to be consumed by RN? Yoga is dir-synced inside `ReactCommon/yoga/yoga` so we don't need any version bump at all at this stage 👍
kelset commented 2022-06-07 09:59:47 -07:00 (Migrated from github.com)

ok so we just need to have (basically) a sync commit land on master, and that one could potentially be even cherry-picked?

ok so we just need to have (basically) a sync commit land on master, and that one could potentially be even cherry-picked?
cortinico commented 2022-06-07 10:03:02 -07:00 (Migrated from github.com)

@kelset Correct. This landed on main 43f831b23c and can be cherry-picked wherever its needed.

@kelset Correct. This landed on `main` https://github.com/facebook/react-native/commit/43f831b23caf22e59af5c6d3fdd62fed3d20d4ec and can be cherry-picked wherever its needed.
kelset commented 2022-06-07 10:18:21 -07:00 (Migrated from github.com)

@Kudo @brentvatne you were saying that you wanted to fix in 0.69 right for Expo next SDK version, right?

@Kudo @brentvatne you were saying that you wanted to fix in 0.69 right for Expo next SDK version, right?
Kudo commented 2022-06-07 16:33:58 -07:00 (Migrated from github.com)

the revert pr is in https://github.com/facebook/react-native/pull/33973. we want to have both 43f831b23c and https://github.com/facebook/react-native/pull/33973 in 0.69. thanks for making it happens.

the revert pr is in https://github.com/facebook/react-native/pull/33973. we want to have both https://github.com/facebook/react-native/commit/43f831b23caf22e59af5c6d3fdd62fed3d20d4ec and https://github.com/facebook/react-native/pull/33973 in 0.69. thanks for making it happens.
kelset commented 2022-06-08 02:11:31 -07:00 (Migrated from github.com)

@Kudo , sounds good - can you add those requests here? https://github.com/reactwg/react-native-releases/discussions/21

since they are about Yoga I feel we'd need a new RC to ensure everything goes smoothly 😅

@Kudo , sounds good - can you add those requests here? https://github.com/reactwg/react-native-releases/discussions/21 since they are about Yoga I feel we'd need a new RC to ensure everything goes smoothly 😅
Kudo commented 2022-06-08 02:17:14 -07:00 (Migrated from github.com)

thanks @kelset! i'll add the commits after https://github.com/facebook/react-native/pull/33973 landed.

thanks @kelset! i'll add the commits after https://github.com/facebook/react-native/pull/33973 landed.

Pull request closed

Sign in to join this conversation.
No description provided.