From e255748d12df334bd35d8096e970141bafac886b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A9ctor=20Ramos?= Date: Wed, 1 Jul 2020 22:42:53 -0700 Subject: [PATCH] Codegen: Enable generation of ObjC FBReactNativeSpec with CocoaPods Summary: Build `FBReactNativeSpec.h` and `FBReactNativeSpec-generated.mm` using the new codegen script whenever the workspace is created using CocoaPods if the `USE_CODEGEN` envvar is set to 1. Effectively makes use of the new codegen integration in CocoaPods opt-in. The `USE_CODEGEN` envvar check should be removed when the generated files are removed from source control, at which point use of the new codegen in CocoaPods will be necessary. ``` cd RNTester USE_CODEGEN=1 pod install ``` Changelog: [Internal] Reviewed By: RSNara Differential Revision: D22250128 fbshipit-source-id: 8f06bf1424ca2e003ecfd032ec03d7896569f9bd --- RNTester/Podfile | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/RNTester/Podfile b/RNTester/Podfile index deb6b77c5b6..f14d1a20622 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -40,24 +40,31 @@ target 'RNTesterIntegrationTests' do pod 'React-RCTTest', :path => "./RCTTest" end -if ENV['USE_FRAMEWORKS'] == '1' +def frameworks_pre_install(installer) static_frameworks = ['FlipperKit', 'Flipper', 'Flipper-Folly', 'CocoaAsyncSocket', 'ComponentKit', 'Flipper-DoubleConversion', 'Flipper-Glog', 'Flipper-PeerTalk', 'Flipper-RSocket', 'CocoaLibEvent', 'OpenSSL-Universal', 'boost-for-react-native'] - pre_install do |installer| - Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} - installer.pod_targets.each do |pod| - if static_frameworks.include?(pod.name) - def pod.build_type - Pod::Target::BuildType.static_library - end - end + Pod::Installer::Xcode::TargetValidator.send(:define_method, :verify_no_static_framework_transitive_dependencies) {} + installer.pod_targets.each do |pod| + if static_frameworks.include?(pod.name) + def pod.build_type + Pod::Target::BuildType.static_library end + end end end +def codegen_pre_install(installer) + system("../scripts/generate-native-modules-specs.sh") +end + +pre_install do |installer| + frameworks_pre_install(installer) if ENV['USE_FRAMEWORKS'] == '1' + codegen_pre_install(installer) if ENV['USE_CODEGEN'] == '1' +end + post_install do |installer| flipper_post_install(installer) end