Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Fix searching for FlipperClient.h headers in productions builds if PR…
Browse files Browse the repository at this point in the history
…ODUCTION=1 passed (#4275)

Summary:
In newer builds of react-native if you passed parameters PRODUCTION=1, flipper pods won't get installed
you can see that in their codebase here [react_native_pods.rb](https://github.com/facebook/react-native/blob/6a43fafd78d581f63c664b9af6d10828ac7f77fa/scripts/react_native_pods.rb#L140)

so when building ios `react-native-flipper` set `compiler_flags = '-DFB_SONARKIT_ENABLED=1'` in the podspec file
which initializeFlipper and lead to the following error:
`node_modules/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h:12:9: 'FlipperKit/FlipperClient.h' file not found`

## Changelog
use same condition as react-native to wrap `s.compiler_flags = compiler_flags`
and conditionally pass `compiler_flags = '-DFB_SONARKIT_ENABLED=1'` to compiler_flags to avoid build problems

Pull Request resolved: #4275

Test Plan:
To reproduce
- create new react-native app
- install react-native-flipper `yarn add react-native-flipper`
- run `env PRODUCTION=1  npx pod-install `
- run `yarn ios`

Before patch:
```sh
node_modules/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h:12:9: 'FlipperKit/FlipperClient.h' file not found
```

After patch:
```sh
▸ Build Succeeded
success Successfully built the app
```

Reviewed By: jknoxville

Differential Revision: D41298345

Pulled By: mweststrate

fbshipit-source-id: fb46772d46b8105fccb1abb673502bca428eea1d
  • Loading branch information
MuhmdRaouf authored and facebook-github-bot committed Mar 2, 2023
1 parent fa987e4 commit 0c442bf
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ Pod::Spec.new do |s|
s.source_files = "ios/**/*.{h,m,swift}"
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/Headers/Public/FlipperKit\"" }
s.requires_arc = true
s.compiler_flags = compiler_flags
if ENV['PRODUCTION'] == '1'
Pod::UI.puts "#{s.name}: Found PRODUCTION=1, #{s.name} will be disabled for production builds"
else
s.compiler_flags = compiler_flags
end
s.dependency "React-Core"
end

0 comments on commit 0c442bf

Please sign in to comment.