Skip to content

Commit

Permalink
[core] fix use_frameworks with new arch (#28451)
Browse files Browse the repository at this point in the history
# Why

fix header not found issue when using frameworks on new architecture
fixes #28209

# How

the header search path is from `EXJavaScriptRuntime.mm ->
HermesExecutorFactory.h -> <jsinspector-modern/InspectorInterfaces.h>`.
the correct import should be underlined "jsinspector_modern" in the
import. the code is inside react-native core that we cannot touch.
this pr tries to use the `add_dependency()` from react-native core that
we specify extra ":framework_name".

also cleanup some unused search paths that are added through
`install_modules_dependencies()`.
we also have to wait 0.74.1 for
facebook/react-native#44252
  • Loading branch information
Kudo committed May 3, 2024
1 parent 532010b commit df3fb83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 24 deletions.
2 changes: 2 additions & 0 deletions packages/expo-modules-core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@

### 🐛 Bug fixes

- Fixed building error when use_frameworks on new architecture. ([#28451](https://github.com/expo/expo/pull/28451) by [@kudo](https://github.com/kudo))

### 💡 Others

## 1.12.7 — 2024-05-02
Expand Down
31 changes: 7 additions & 24 deletions packages/expo-modules-core/ExpoModulesCore.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,6 @@ Pod::Spec.new do |s|
s.header_dir = 'ExpoModulesCore'

header_search_paths = [
# EXJavaScriptRuntime -> Hermes
'"$(PODS_ROOT)/boost"',
'"$(PODS_ROOT)/DoubleConversion"',
'"$(PODS_ROOT)/RCT-Folly"',
'"${PODS_ROOT}/Headers/Public/React-hermes"',
'"${PODS_ROOT}/Headers/Public/hermes-engine"',

# EXAppDelegateWrapper -> RCTAppDelegate -> RCTCxxBridgeDelegate
'"${PODS_ROOT}/Headers/Private/React-Core"',
]

# Swift/Objective-C compatibility
Expand All @@ -53,37 +44,29 @@ Pod::Spec.new do |s|
'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
'SWIFT_COMPILATION_MODE' => 'wholemodule',
'HEADER_SEARCH_PATHS' => header_search_paths.join(' '),
"FRAMEWORK_SEARCH_PATHS" => "\"${PODS_CONFIGURATION_BUILD_DIR}/React-hermes\"",
'OTHER_SWIFT_FLAGS' => "$(inherited) #{fabric_enabled ? fabric_compiler_flags : ''}"
}
user_header_search_paths = [
'"${PODS_CONFIGURATION_BUILD_DIR}/ExpoModulesCore/Swift Compatibility Header"',
'"$(PODS_ROOT)/Headers/Private/React-bridging/react/bridging"',
'"$(PODS_CONFIGURATION_BUILD_DIR)/React-bridging/react_bridging.framework/Headers"',
'"$(PODS_ROOT)/Headers/Private/Yoga"',
'"$(PODS_ROOT)/Headers/Private/Yoga"', # Expo.h -> ExpoModulesCore-umbrella.h -> Fabric ViewProps.h -> Private Yoga headers
]
if fabric_enabled && ENV['USE_FRAMEWORKS']
user_header_search_paths << "\"$(PODS_ROOT)/DoubleConversion\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-graphics/React_graphics.framework/Headers/react/renderer/graphics/platform/ios\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-Fabric/React_Fabric.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/ReactCommon/ReactCommon.framework/Headers/react/nativemodule/core\""
user_header_search_paths << "\"${PODS_CONFIGURATION_BUILD_DIR}/React-RCTFabric/RCTFabric.framework/Headers\""
end
s.user_target_xcconfig = {
"HEADER_SEARCH_PATHS" => user_header_search_paths,
}

compiler_flags = folly_compiler_flags + ' ' + "-DREACT_NATIVE_TARGET_VERSION=#{reactNativeTargetVersion}"
if ENV['USE_HERMES'] == nil || ENV['USE_HERMES'] == '1'
compiler_flags += ' -DUSE_HERMES'
s.dependency 'hermes-engine'
add_dependency(s, "React-jsinspector", :framework_name => 'jsinspector_modern')
else
s.dependency 'React-jsc'
end

s.dependency 'React-Core'
s.dependency 'ReactCommon/turbomodule/core'
s.dependency 'React-RCTAppDelegate' if reactNativeTargetVersion >= 71
s.dependency 'React-NativeModulesApple' if reactNativeTargetVersion >= 72
s.dependency 'React-RCTAppDelegate'
s.dependency 'React-NativeModulesApple'

if fabric_enabled
compiler_flags << ' ' << fabric_compiler_flags
Expand Down

0 comments on commit df3fb83

Please sign in to comment.