react-native icon indicating copy to clipboard operation
react-native copied to clipboard

feat: set Swift active compilation conditions build setting to DEBUG

Open okwasniewski opened this issue 1 year ago • 4 comments

Summary:

This PR adds cocoapods utility to set SWIFT_ACTIVE_COMPILATION_CONDITIONS to DEBUG, which is set to this value by default (when generating a new native Xcode project).

This allows to use the #if DEBUG compilator directive in Swift to work out of the box, without any changes on user's side:

override func bundleURL() -> URL? {
#if DEBUG
    RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
#else
    Bundle.main.url(forResource: "main", withExtension: "jsbundle")
#endif
  }

Changelog:

[IOS] [ADDED] - Set SWIFT_ACTIVE_COMPILATION_CONDITIONS to DEBUG

Test Plan:

Run bundle exec pod install and check if the active compilation flags are populated:

CleanShot 2024-01-17 at 13 11 03@2x

okwasniewski avatar Jan 17 '24 12:01 okwasniewski

Platform Engine Arch Size (bytes) Diff
android hermes arm64-v8a 16,803,066 -435,494
android hermes armeabi-v7a n/a --
android hermes x86 n/a --
android hermes x86_64 n/a --
android jsc arm64-v8a 20,190,312 -410,683
android jsc armeabi-v7a n/a --
android jsc x86 n/a --
android jsc x86_64 n/a --

Base commit: b41a33ede99826aa6b100e5fb53b1a918a5b8bba Branch: main

analysis-bot avatar Jan 17 '24 12:01 analysis-bot

Hey @cipolleschi, anything I can do to help you get this one merged?

okwasniewski avatar Feb 12 '24 09:02 okwasniewski

@cipolleschi I've refactored the method to set_build_setting which accepts necessary arguments to set proper build settings. This method can remove set_use_hermes_build_setting and set_node_modules_user_settings methods (less code to maintain). I've also changed the tests to only test the utility

okwasniewski avatar Feb 12 '24 16:02 okwasniewski

/rebase - this command rebase the pr on top of main automatically

cipolleschi avatar Feb 19 '24 15:02 cipolleschi

Hey @cipolleschi, is there anything more we need to get done in order to merge this PR?

okwasniewski avatar May 22 '24 12:05 okwasniewski

/rebase - this comment automatically rebase on top of main

cipolleschi avatar Jun 05 '24 13:06 cipolleschi

@cipolleschi has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

facebook-github-bot avatar Jun 05 '24 13:06 facebook-github-bot

@cipolleschi merged this pull request in facebook/react-native@756f89aa59cba78cba39b22a338a3a48bcb38f1b.

facebook-github-bot avatar Jun 06 '24 11:06 facebook-github-bot

This pull request was successfully merged by @okwasniewski in 756f89aa59cba78cba39b22a338a3a48bcb38f1b.

When will my fix make it into a release? | How to file a pick request?

github-actions[bot] avatar Jun 06 '24 11:06 github-actions[bot]