mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Enable Flipper for custom Xcode configurations (#34333)
Summary: Fixed Flipper not recognizing app when using custom Xcode configuration names. This fixes the problem that renaming the "Debug" Xcode configuration causes Flipper to not work. Despite using the recommended `:configurations` parameters and instructing Cocoapods that it was a debug build (see https://github.com/facebook/react-native/issues/34332), it still wouldn't recognize the app due to missing C preprocessor flags, specifically it was missing `-DFB_SONARKIT_ENABLED=1`. ## Changelog <!-- Help reviewers and the release process by writing your own changelog entry. For an example, see: https://github.com/facebook/react-native/wiki/Changelog --> [General] [Fixed] - Flipper now supports custom Xcode build configuration names Pull Request resolved: https://github.com/facebook/react-native/pull/34333 Test Plan: I applied the PR change to 0.68.2 (which work similarly but code was refactored since then). I then used `patch-package` to test the change and the fix worked on 2 separate projects. Patch-package change equivalent: ```diff diff --git a/node_modules/react-native/scripts/react_native_pods.rb b/node_modules/react-native/scripts/react_native_pods.rb index f2ceeda..2ea57d6 100644 --- a/node_modules/react-native/scripts/react_native_pods.rb +++ b/node_modules/react-native/scripts/react_native_pods.rb @@ -180,7 +180,7 @@ def flipper_post_install(installer) # Enable flipper for React-Core Debug configuration if target.name == 'React-Core' target.build_configurations.each do |config| - if config.name == 'Debug' + if config.debug? config.build_settings['OTHER_CFLAGS'] = "$(inherited) -DFB_SONARKIT_ENABLED=1" end end ``` **Screen shot of Xcode after the patch has been applied, for RN v0.68.2:**  Reviewed By: dmitryrykun Differential Revision: D38373812 Pulled By: cipolleschi fbshipit-source-id: d2949927084160bf0c6f8af37a7966dd22fea9a6
This commit is contained in:
committed by
Facebook GitHub Bot
parent
665b5bedd3
commit
1bc9ddbce3
@@ -85,7 +85,7 @@ class FlipperTests < Test::Unit::TestCase
|
||||
|
||||
reactCore_target = installer.target_with_name("React-Core")
|
||||
reactCore_target.build_configurations.each do |config|
|
||||
if config.name == 'Debug' then
|
||||
if config.name == 'Debug' || config.name == 'CustomConfig' then
|
||||
assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
|
||||
else
|
||||
assert_true(config.build_settings.empty?)
|
||||
@@ -134,15 +134,17 @@ class FlipperTests < Test::Unit::TestCase
|
||||
TargetMock.new(
|
||||
"YogaKit",
|
||||
[
|
||||
BuildConfigurationMock.new("Debug"),
|
||||
BuildConfigurationMock.new("Release"),
|
||||
BuildConfigurationMock.new("Debug", is_debug: true),
|
||||
BuildConfigurationMock.new("Release", is_debug: false),
|
||||
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
||||
]
|
||||
),
|
||||
TargetMock.new(
|
||||
"React-Core",
|
||||
[
|
||||
BuildConfigurationMock.new("Debug"),
|
||||
BuildConfigurationMock.new("Release"),
|
||||
BuildConfigurationMock.new("Debug", is_debug: true),
|
||||
BuildConfigurationMock.new("Release", is_debug: false),
|
||||
BuildConfigurationMock.new("CustomConfig", is_debug: true),
|
||||
]
|
||||
)
|
||||
]
|
||||
|
||||
@@ -174,10 +174,16 @@ end
|
||||
class BuildConfigurationMock
|
||||
attr_reader :name
|
||||
attr_reader :build_settings
|
||||
@is_debug
|
||||
|
||||
def initialize(name, build_settings = {})
|
||||
def initialize(name, build_settings = {}, is_debug: false)
|
||||
@name = name
|
||||
@build_settings = build_settings
|
||||
@is_debug = is_debug
|
||||
end
|
||||
|
||||
def debug?
|
||||
return @is_debug
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -83,7 +83,7 @@ def flipper_post_install(installer)
|
||||
# Enable flipper for React-Core Debug configuration
|
||||
if target.name == 'React-Core'
|
||||
target.build_configurations.each do |config|
|
||||
if config.name == 'Debug'
|
||||
if config.debug?
|
||||
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1']
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user