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
This commit is contained in:
Héctor Ramos
2020-07-01 22:45:12 -07:00
committed by Facebook GitHub Bot
parent 4776ebd7c3
commit e255748d12
+16 -9
View File
@@ -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