Skip to content

Commit

Permalink
Fix Flipper by moving FB_SONARKIT_ENABLED to RCTAppDelegate (#37240)
Browse files Browse the repository at this point in the history
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: #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
  • Loading branch information
djMax authored and facebook-github-bot committed May 4, 2023
1 parent c8a0f19 commit 34d5212
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def test_postInstall_updatesThePodCorrectly
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'])
Expand Down Expand Up @@ -144,6 +144,14 @@ def prepare_mocked_installer
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),
]
)
]
)
Expand Down
4 changes: 2 additions & 2 deletions packages/react-native/scripts/cocoapods/flipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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']
Expand Down

0 comments on commit 34d5212

Please sign in to comment.