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](6a43fafd78/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: https://github.com/facebook/flipper/pull/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
35 lines
1.2 KiB
Ruby
35 lines
1.2 KiB
Ruby
# Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
#
|
|
# This source code is licensed under the MIT license found in the
|
|
# LICENSE file in the root directory of this source tree.
|
|
|
|
require "json"
|
|
|
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
compiler_flags = '-DFB_SONARKIT_ENABLED=1'
|
|
|
|
Pod::Spec.new do |s|
|
|
s.name = "react-native-flipper"
|
|
s.version = package["version"]
|
|
s.summary = package["description"]
|
|
s.description = <<-DESC
|
|
react-native-flipper
|
|
DESC
|
|
s.homepage = "https://fbflipper.com/"
|
|
s.license = "MIT"
|
|
s.license = { :type => "MIT", :file => "LICENSE" }
|
|
s.authors = { "Michel Weststrate" => "mweststrate@fb.com" }
|
|
s.platforms = { :ios => "9.0" }
|
|
s.source = { :git => "https://github.com/facebook/flipper.git", :tag => "#{s.version}" }
|
|
|
|
s.source_files = "ios/**/*.{h,m,swift}"
|
|
s.pod_target_xcconfig = { "HEADER_SEARCH_PATHS" => "\"${PODS_ROOT}/Headers/Public/FlipperKit\"" }
|
|
s.requires_arc = true
|
|
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
|