react-native-macos/scripts
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
..
__tests__ Use CircleCI API to trigger releases (#32937) 2022-01-24 14:08:43 -08:00
circleci Download kotlin compiler JARs for Buck instead of checking them in (#33209) 2022-03-02 13:04:49 -08:00
react_native_pods_utils Introduce .xcode.env configuration file to source `node` (#33546) 2022-04-11 02:50:57 -07:00
versiontemplates Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
xcode Introduce .xcode.env configuration file to source `node` (#33546) 2022-04-11 02:50:57 -07:00
.packager.env Move YGStyle to seperate file and add constructors 2018-02-20 05:55:36 -08:00
.tests.env Bump OSS Android build to SDK 31 (#32606) 2021-11-24 12:27:26 -08:00
android-e2e-test.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
android-setup.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
bump-hermes-version.js Add script for bumping Hermes version for a release 2022-02-25 10:52:55 -08:00
bump-oss-version.js Use CircleCI API to trigger releases (#32937) 2022-01-24 14:08:43 -08:00
compose-source-maps.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
download-kotlin-compiler-with-buck.sh Download kotlin compiler JARs for Buck instead of checking them in (#33209) 2022-03-02 13:04:49 -08:00
find-node-for-xcode.sh Reintroduce `find-node.sh` as mitigation measure (#33538) 2022-04-04 02:43:07 -07:00
generate-api-docs.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
generate-artifacts.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
generate-provider-cli.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
generate-specs-cli.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
ios-configure-glog.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
launchPackager.bat Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
launchPackager.command Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
lint-java.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
node-binary.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
objc-test.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
packager-reporter.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
packager.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
prepare-package-for-release.js Use CircleCI API to trigger releases (#32937) 2022-01-24 14:08:43 -08:00
process-podspecs.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
publish-npm.js Setup multi-variant publishing for React Native Android (#33539) 2022-04-05 09:38:55 -07:00
react-native-xcode.sh Introduce .xcode.env configuration file to source `node` (#33546) 2022-04-11 02:50:57 -07:00
react_native_pods.rb Fix ios build error when podfile generate_multiple_pod_projects=true and fabric is on (#33381) 2022-04-11 06:04:20 -07:00
run-android-ci-instrumentation-tests.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
run-android-emulator.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
run-android-local-integration-tests.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
run-android-local-unit-tests.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
run-ci-e2e-tests.js Updating Yarn Cache path to fix broken CI (#32834) 2022-01-06 10:46:15 -08:00
run-ci-javascript-tests.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
run-instrumentation-tests-via-adb-shell.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
set-rn-template-version.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
set-rn-version.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
sync-css-layout.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
test-manual-e2e.sh fix: Access to relative paths when invoking test-manual-e2e (#33000) 2022-02-03 09:10:11 -08:00
try-n-times.js Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
update-ruby.sh Added Gemfile.lock to git add files when calling update-ruby.sh (#33484) 2022-03-25 08:01:41 -07:00
update_podfile_lock.sh Use realpath instead of readlink 2022-02-22 02:23:02 -08:00
validate-android-device-env.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
validate-android-sdk.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
validate-android-test-env.sh Update copyright headers from Facebook to Meta 2021-12-30 15:11:21 -08:00
validate-ios-test-env.sh bump Node references from 12/14 to 14/16 (#32980) 2022-01-28 05:07:18 -08:00
version-utils.js Use CircleCI API to trigger releases (#32937) 2022-01-24 14:08:43 -08:00