Skip to content

Commit

Permalink
iOS: only exclude i386 while using hermes (#38132)
Browse files Browse the repository at this point in the history
Summary:
- if an existing iOS project specifies `EXCLUDED_ARCHS`, these settings are overwritten by the `react_native_post_install` step as part of the Cocoapods install
- closes #35544

### Existing Behaviour

- one of the functions called as part of the `react_native_post_install` step is `exclude_i386_architecture_while_using_hermes`
  - see [/packages/react-native/scripts/cocoapods/utils.rb](https://github.com/facebook/react-native/blob/v0.72.1/packages/react-native/scripts/cocoapods/utils.rb#L56-L69)
```
    def self.exclude_i386_architecture_while_using_hermes(installer)
        projects = self.extract_projects(installer)

        # Hermes does not support `i386` architecture
        excluded_archs_default = self.has_pod(installer, 'hermes-engine') ? "i386" : ""

        projects.each do |project|
            project.build_configurations.each do |config|
                config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
            end

            project.save()
        end
    end
```

🐛 **However** 🐛

- this function is currently called regardless of whether or not you are **actually** using Hermes
- this means existing projects that have `EXCLUDED_ARCHS` set, the existing value will be changed either to `"i386"` or a blank string

### Changed Behaviour

- moved the function call inside an `if ReactNativePodsUtils.has_pod(installer, "React-hermes")` block
- `EXCLUDED_ARCHS` should only be modified if needed now

## Changelog:

<!-- Help reviewers and the release process by writing your own changelog entry.

Pick one each for the category and type tags:

[ANDROID|GENERAL|IOS|INTERNAL] [BREAKING|ADDED|CHANGED|DEPRECATED|REMOVED|FIXED|SECURITY] - Message

For more details, see:
https://reactnative.dev/contributing/changelogs-in-pull-requests
-->

[IOS] [FIXED] Only modify EXCLUDED_ARCHS when needed for Hermes

Pull Request resolved: #38132

Reviewed By: cortinico

Differential Revision: D47149618

Pulled By: cipolleschi

fbshipit-source-id: cffc2a0d4bc35fa4e933d3f4df6ee85e2f5c4486
  • Loading branch information
jpdriver authored and facebook-github-bot committed Jul 4, 2023
1 parent f92ed27 commit ee1cd13
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/react-native/scripts/react_native_pods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -238,9 +238,9 @@ def react_native_post_install(

if ReactNativePodsUtils.has_pod(installer, "React-hermes")
ReactNativePodsUtils.set_gcc_preprocessor_definition_for_React_hermes(installer)
ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
end

ReactNativePodsUtils.exclude_i386_architecture_while_using_hermes(installer)
ReactNativePodsUtils.fix_library_search_paths(installer)
ReactNativePodsUtils.update_search_paths(installer)
ReactNativePodsUtils.set_node_modules_user_settings(installer, react_native_path)
Expand Down

0 comments on commit ee1cd13

Please sign in to comment.