-
Notifications
You must be signed in to change notification settings - Fork 954
Fix searching for FlipperClient.h headers in productions builds if PRODUCTION=1 passed #4275
Conversation
dc3d946
to
f0b00f0
Compare
Pull Request Test Coverage Report for Build 3409071923
💛 - Coveralls |
98449d6
to
10f131e
Compare
10f131e
to
38c47af
Compare
@mweststrate has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
38c47af
to
5ba399f
Compare
@MuhmdRaouf has updated the pull request. You must reimport the pull request before landing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We deliberately do not want to be included in production builds, as it is a huge risk to both security and performance. If you want to include Flipper in prod builds at your own risk, feel free, but we don't want to provide any infra to encourage such thing as we consider it a really bad idea.
Let me know if I misunderstood the PR :)
@mweststrate Hey, this PR was focused on fixing the problem located here flipper/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m Line 8 in 1adcf2b
as you can see you check if
which leads Flipper to always work even in a production env because of the OR condition I hope that makes sense so far. so to this PR, If I make react-native will exclude Flipper pods from installing and when making iOS build the condition
so this PR prevents this error from happing as it's removing the also, I would suggest changing the condition here flipper/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m Line 8 in 1adcf2b
to be nested instead #if defined(DEBUG)
#if defined(FB_SONARKIT_ENABLED)
// logic goes here
#endif // FB_SONARKIT_ENABLED
#endif // DEBUG or change the condition to be AND #if defined(DEBUG) && defined(FB_SONARKIT_ENABLED)
// logic goes here
#endif // DEBUG && FB_SONARKIT_ENABLED I would love to make that PR too, just let me know how it will go with this PR and we can go from there. |
…ODUCTION=1 passed
5ba399f
to
60e9c18
Compare
@MuhmdRaouf has updated the pull request. You must reimport the pull request before landing. |
@lblasa would you mind taking a closer look on the above? thanks! |
When setting I think this error should not occur when disabling Flipper, regardless of the environment variable ( In our case, our Podfile looks something like this:
|
@mweststrate merged this pull request in 0c442bf. |
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
so when building ios
react-native-flipper
setcompiler_flags = '-DFB_SONARKIT_ENABLED=1'
in the podspec filewhich 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 problemsTest Plan
To reproduce
yarn add react-native-flipper
env PRODUCTION=1 npx pod-install
yarn ios
Before patch:
node_modules/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h:12:9: 'FlipperKit/FlipperClient.h' file not found
After patch: