Skip to content

Commit

Permalink
Use GCC_PREPROCESSOR_DEFINITIONS to set FB_SONARKIT_ENABLED (#33972)
Browse files Browse the repository at this point in the history
Summary:
`OTHER_CFLAGS` doesn't seem to work when the file is imported from Objc++. This causes flipper to not be included.

## Changelog

[iOS] [Fixed] - Use `GCC_PREPROCESSOR_DEFINITIONS` to set `FB_SONARKIT_ENABLED`

Pull Request resolved: #33972

Test Plan: Tested the change in an app. Used a breakpoint to see that flipper code is not executed before this change, and is after. Also made sure other `GCC_PREPROCESSOR_DEFINITIONS` set by cocoapods are still properly inherited.

Reviewed By: cipolleschi

Differential Revision: D37001624

Pulled By: dmitryrykun

fbshipit-source-id: 920f3fe368a9fbe2cde9aa1e6d5b3b883c42119d
  • Loading branch information
janicduplessis authored and facebook-github-bot committed Jun 8, 2022
1 parent edb27e3 commit 77e6bff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scripts/cocoapods/__tests__/flipper-test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ def test_postInstall_updatesThePodCorrectly
reactCore_target = installer.target_with_name("React-Core")
reactCore_target.build_configurations.each do |config|
if config.name == 'Debug' then
assert_equal(config.build_settings['OTHER_CFLAGS'], "$(inherited) -DFB_SONARKIT_ENABLED=1")
assert_equal(config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'], ['$(inherited)', 'FB_SONARKIT_ENABLED=1'])
else
assert_true(config.build_settings.empty?)
end
Expand Down
2 changes: 1 addition & 1 deletion scripts/cocoapods/flipper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def flipper_post_install(installer)
if target.name == 'React-Core'
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['OTHER_CFLAGS'] = "$(inherited) -DFB_SONARKIT_ENABLED=1"
config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = ['$(inherited)', 'FB_SONARKIT_ENABLED=1']
end
end
end
Expand Down

0 comments on commit 77e6bff

Please sign in to comment.