mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
More robust hermes-engine lookup logic in makefiles (#26820)
Summary: The Android makefiles had hard-coded paths to hermes-engine, sometimes looking in `node_modules` and other times looking in `..`. This commit implements the Node module resolution algorithm (see common.mk), which handles both of these cases and also looks further up the root if necessary, handling the case when the `hermes-engine` npm package is hoisted. This commit does three things: - Defines `find-node-module` and uses it in the makefiles to find `hermes-engine` - Removes the unused `/path/to/hermes-engine/include` paths since this directory does not exist and should be `/path/to/hermes-engine/android/include` (`android`) - Moves the definition of `REACT_NATIVE` in the makefiles to the top. It was defined after every `$(CLEAR_VARS)` invocation but was not actually cleared anyway. `$(CLEAR_VARS)` resets only `LOCAL_*` variables in this list: https://android.googlesource.com/platform/build/+/7dc45a8/core/clear_vars.mk ## Changelog [Internal] [Changed] - Android Makefiles look for hermes-engine using Node's module resolution algorithm Pull Request resolved: https://github.com/facebook/react-native/pull/26820 Test Plan: Run `./gradlew :ReactAndroid:installArchives`, which requires the hermes-engine paths to be correct in order to find the headers. Differential Revision: D17923671 Pulled By: cpojer fbshipit-source-id: 9238b8718a94080db1abbba6375a6a1d484c871d
This commit is contained in:
committed by
Facebook Github Bot
parent
63e58a375e
commit
df653a9dc2
@@ -5,15 +5,16 @@
|
||||
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
REACT_NATIVE := $(LOCAL_PATH)/../../../../../../../..
|
||||
|
||||
include $(REACT_NATIVE)/ReactCommon/common.mk
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := jsijniprofiler
|
||||
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(REACT_NATIVE)/node_modules/hermes-engine/android/include $(REACT_NATIVE)/../hermes-engine/android/include $(REACT_NATIVE)/../node_modules/hermes-engine/include
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
|
||||
|
||||
LOCAL_CPP_FEATURES := exceptions
|
||||
|
||||
@@ -24,4 +25,3 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
REACT_NATIVE := $(LOCAL_PATH)/../../../../../../../..
|
||||
|
||||
@@ -4,15 +4,16 @@
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
REACT_NATIVE := $(LOCAL_PATH)/../../../../../../../..
|
||||
|
||||
include $(REACT_NATIVE)/ReactCommon/common.mk
|
||||
include $(CLEAR_VARS)
|
||||
|
||||
LOCAL_MODULE := hermes-executor-release
|
||||
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(REACT_NATIVE)/node_modules/hermes-engine/android/include $(REACT_NATIVE)/../hermes-engine/android/include $(REACT_NATIVE)/../node_modules/hermes-engine/include
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
|
||||
|
||||
LOCAL_CPP_FEATURES := exceptions
|
||||
|
||||
@@ -23,14 +24,13 @@ include $(BUILD_SHARED_LIBRARY)
|
||||
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
REACT_NATIVE := $(LOCAL_PATH)/../../../../../../../..
|
||||
|
||||
LOCAL_MODULE := hermes-executor-debug
|
||||
LOCAL_CFLAGS := -DHERMES_ENABLE_DEBUGGER=1
|
||||
|
||||
LOCAL_SRC_FILES := $(wildcard $(LOCAL_PATH)/*.cpp)
|
||||
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(REACT_NATIVE)/node_modules/hermes-engine/android/include $(REACT_NATIVE)/../hermes-engine/android/include $(REACT_NATIVE)/../node_modules/hermes-engine/include
|
||||
LOCAL_C_INCLUDES := $(LOCAL_PATH) $(REACT_NATIVE)/ReactCommon/jsi $(call find-node-module,$(LOCAL_PATH),hermes-engine)/android/include
|
||||
|
||||
LOCAL_CPP_FEATURES := exceptions
|
||||
|
||||
|
||||
Reference in New Issue
Block a user