react-native-macos/ReactCommon
Kudo Chien 65abc361bf Fix ios build error when podfile generate_multiple_pod_projects=true and fabric is on (#33381)
Summary:
there are build errors happened when in [`generate_multiple_pod_projects`](https://blog.cocoapods.org/CocoaPods-1.7.0-beta/#multiple-xcodeproj-generation) mode and fabric is on. since we have multiple pod projects, there are something breaks.

### `-DRCT_NEW_ARCH_ENABLED=1` does not pass to `RCTAppSetupUtils.mm`

because `installer.pods_project` is targeting `Pods.xcodeproj` but not `React-Core.xcodeproj`. we should use ` installer.target_installation_results.pod_target_installation_results` to deal with `generate_multiple_pod_projects` mode.

### fatal error: 'CompactValue.h' file not found

```
In file included from /path/to/react-native/packages/rn-tester/build/generated/ios/react/renderer/components/rncore/Props.cpp:11:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Codegen/react/renderer/components/rncore/Props.h:13:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Fabric/react/renderer/components/view/ViewProps.h:11:
In file included from /path/to/react-native/packages/rn-tester/Pods/Headers/Private/React-Fabric/react/renderer/components/view/YogaStylableProps.h:10:
/path/to/react-native/packages/rn-tester/Pods/Headers/Public/Yoga/yoga/YGStyle.h:16:10: fatal error: 'CompactValue.h' file not found
#include "CompactValue.h"
         ^~~~~~~~~~~~~~~~
1 error generated.
```

`Props.cpp` -> `YogaStylableProps.h` -> `YGStyle.h` -> `CompactValue.h`
[`CompactValue.h` is internal private header for Yoga pod](4eef075a58/ReactCommon/yoga/Yoga.podspec (L54-L56)) where `React-Codegen` project cannot access to.

~there are some solutions toward this problem. one way is to make other yoga headers as public headers. i am not sure whether this solution would introduce any side effects. so i only make necessary projects to search yoga private headers.~

Update: a solution is to expose all yoga headers publicly.  however, CocoaPods will put all public headers to module umbrella header. this will break YogaKit (swift) integration because swift module doesn't support c++. my pr is trying to expose all yoga headers to `$PODS_ROOT/Headers/Public/Yoga/yoga`, but use custom `module_map` to control which headers should be exposed to the swift module. CocoaPods's custom module_map has some limitation where cannot well support for both `use_frameworks!` mode and non use_frameworks! mode. there's a workaround to use `script_phase` copying the umbrella header to right place.

## Changelog

[iOS] [Fixed] - Fix iOS build error when Podfile `generate_multiple_pod_projects=true` and Fabric is on

Pull Request resolved: https://github.com/facebook/react-native/pull/33381

Test Plan:
verify with rn-tester

1. add `generate_multiple_pod_projects`

```diff
 --- a/packages/rn-tester/Podfile
+++ b/packages/rn-tester/Podfile
@@ -5,7 +5,7 @@ platform :ios, '11.0'

 # Temporary solution to suppress duplicated GUID error.
 # Can be removed once we move to generate files outside pod install.
-install! 'cocoapods', :deterministic_uuids => false
+install! 'cocoapods',  :generate_multiple_pod_projects => true, :deterministic_uuids => false

 USE_FRAMEWORKS = ENV['USE_FRAMEWORKS'] == '1'

```

2. pod install and build rn-tester from xcode

Reviewed By: cortinico

Differential Revision: D34844041

Pulled By: dmitryrykun

fbshipit-source-id: 93311b56d8e44491307a911ad58442f267c979eb
2022-04-11 06:04:20 -07:00
..
butter Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
callinvoker Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
cxxreact Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
hermes Add support for devtools' profiler 2022-04-01 23:03:55 -07:00
jsengineinstance The life-changing magic of clang-tidying up 2020-02-04 11:09:30 -08:00
jsi Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
jsiexecutor Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
jsinspector Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
libraries/fbcore/src/test/java/com/facebook/powermock Explicitly set autoglob (long tail) 2020-12-17 19:35:29 -08:00
logger Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
microprofiler Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
react Emit touch-equivalent W3C pointer events on iOS 2022-04-07 14:07:58 -07:00
reactperflogger Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
runtimeexecutor Fixup typo in pfh labels 2022-04-05 12:15:05 -07:00
yoga Fix ios build error when podfile generate_multiple_pod_projects=true and fabric is on (#33381) 2022-04-11 06:04:20 -07:00
React-Fabric.podspec bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
React-rncore.podspec bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00
ReactCommon.podspec bump iOS and tvOS from 11.0 to 12.4 in cocoapods 2022-03-16 21:08:01 -07:00