Fix Flipper by moving FB_SONARKIT_ENABLED to RCTAppDelegate (#37240)

Summary:
An out-of-the-box react-native init project no longer enables Flipper properly as of 0.72.0-rc1.

## Changelog:

[IOS] [FIXED] Fix Flipper by moving podfile modification of preprocessor def `FB_SONARKIT_ENABLED` from React-Core to React-RCTAppDelegate where it is now used.

Pull Request resolved: https://github.com/facebook/react-native/pull/37240

Test Plan: Generated an app and verified Flipper cannot see the app. Made the modification and generated another app and verified Flipper now sees it and can enable plugins. Verified that runtime (non-test) use of FB_SONARKIT_ENABLED is limited to Libraries/AppDelegate in this project.

Reviewed By: dmytrorykun

Differential Revision: D45563282

Pulled By: cipolleschi

fbshipit-source-id: d760c5ae123cc7c967b19c6c626801d6db28d052
This commit is contained in:
Max Metral
2023-05-04 07:54:01 -07:00
committed by Facebook GitHub Bot
parent c8a0f19f1a
commit 34d5212f5c
2 changed files with 11 additions and 3 deletions
@@ -82,7 +82,7 @@ class FlipperTests < Test::Unit::TestCase
assert_equal(config.build_settings['SWIFT_VERSION'], '4.1')
end
reactCore_target = installer.target_with_name("React-Core")
reactCore_target = installer.target_with_name("React-RCTAppDelegate")
reactCore_target.build_configurations.each do |config|
if config.name == 'Debug' || config.name == 'CustomConfig' then
assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
@@ -144,6 +144,14 @@ class FlipperTests < Test::Unit::TestCase
BuildConfigurationMock.new("Release", is_debug: false),
BuildConfigurationMock.new("CustomConfig", is_debug: true),
]
),
TargetMock.new(
"React-RCTAppDelegate",
[
BuildConfigurationMock.new("Debug", is_debug: true),
BuildConfigurationMock.new("Release", is_debug: false),
BuildConfigurationMock.new("CustomConfig", is_debug: true),
]
)
]
)
@@ -77,8 +77,8 @@ def flipper_post_install(installer)
end
end
# Enable flipper for React-Core Debug configuration
if target.name == 'React-Core'
# Enable flipper for React-RCTAppDelegate Debug configuration
if target.name == 'React-RCTAppDelegate'
target.build_configurations.each do |config|
if config.debug?
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1']