From dd111076c9f6bcfbbc0b0be454b16395dab8fcaf Mon Sep 17 00:00:00 2001 From: Michel Weststrate Date: Thu, 28 May 2020 09:54:17 -0700 Subject: [PATCH] Only use Flipper in DEBUG builds Summary: as discussed in https://github.com/facebook/flipper/issues/976#issuecomment-634917766, this solves the issue that FlipperKit is accidentally included in production builds ones react-native-flipper is installed, due to it's dependency on Flipper kit This change is safe because the bindings did already have a check to verify that the Flipper bindings are available at all, and silenty skips their absence in production builds: https://www.internalfb.com/intern/diffusion/FBS/browse/master/xplat/sonar/react-native/react-native-flipper/index.js?commit=b7dd7e05b177&lines=128 Reviewed By: passy Differential Revision: D21749213 fbshipit-source-id: 2c4435c7a375fbc24f89159855d3e0297f3aa9a4 --- react-native/ReactNativeFlipperExample/ios/Podfile.lock | 2 +- react-native/react-native-flipper/ios/FlipperModule.m | 3 +++ .../ios/FlipperReactNativeJavaScriptPlugin.h | 3 +++ .../ios/FlipperReactNativeJavaScriptPlugin.m | 4 ++++ .../ios/FlipperReactNativeJavaScriptPluginManager.h | 4 ++++ .../ios/FlipperReactNativeJavaScriptPluginManager.m | 4 ++++ 6 files changed, 19 insertions(+), 1 deletion(-) diff --git a/react-native/ReactNativeFlipperExample/ios/Podfile.lock b/react-native/ReactNativeFlipperExample/ios/Podfile.lock index e2ff536d3..628824a9f 100644 --- a/react-native/ReactNativeFlipperExample/ios/Podfile.lock +++ b/react-native/ReactNativeFlipperExample/ios/Podfile.lock @@ -457,6 +457,6 @@ SPEC CHECKSUMS: Yoga: e0448a3eecac22245fae6ce1b291c557b93b06af YogaKit: f782866e155069a2cca2517aafea43200b01fd5a -PODFILE CHECKSUM: ec00bac18470bff6bf1d2db889337b72b34a474a +PODFILE CHECKSUM: f9f57fc88aa93cb64e0b46441cad586698bdfbef COCOAPODS: 1.9.2 diff --git a/react-native/react-native-flipper/ios/FlipperModule.m b/react-native/react-native-flipper/ios/FlipperModule.m index 467ecf6ba..e6e591b6c 100644 --- a/react-native/react-native-flipper/ios/FlipperModule.m +++ b/react-native/react-native-flipper/ios/FlipperModule.m @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +#ifdef DEBUG #import "FlipperModule.h" #import "FlipperReactNativeJavaScriptPluginManager.h" @@ -93,3 +94,5 @@ RCT_EXPORT_METHOD(respondError } @end + +#endif diff --git a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.h b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.h index 0aeb95eea..e25fdcab8 100644 --- a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.h +++ b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.h @@ -5,6 +5,7 @@ * LICENSE file in the root directory of this source tree. */ +#if DEBUG #import #import @@ -28,3 +29,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m index 03394b7e2..89c6c2c4f 100644 --- a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m +++ b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPlugin.m @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#if DEBUG + #import "FlipperReactNativeJavaScriptPlugin.h" #import @@ -61,3 +63,5 @@ } @end + +#endif diff --git a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h index a16d0dca6..508468039 100644 --- a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h +++ b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.h @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#ifdef DEBUG + #import #import @@ -44,3 +46,5 @@ NS_ASSUME_NONNULL_BEGIN @end NS_ASSUME_NONNULL_END + +#endif diff --git a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.m b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.m index a62f7a481..3d37c9bb5 100644 --- a/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.m +++ b/react-native/react-native-flipper/ios/FlipperReactNativeJavaScriptPluginManager.m @@ -5,6 +5,8 @@ * LICENSE file in the root directory of this source tree. */ +#ifdef DEBUG + #import "FlipperReactNativeJavaScriptPluginManager.h" #import #import @@ -147,3 +149,5 @@ static uint32_t FlipperResponderKeyGenerator = 0; } @end + +#endif