Fix OSS build

Summary:
`CatalystInstanceImpl.cpp` now depends on `JSCallInvoker` and `JavaJSCallInvokerHolder`. Therefore, we need to correctly adjust the OSS builds to include these dependencies into the `libreactnativejni.so` file.

I made `ReactCommon/turbomodule/jscallinvoker` a static library `libjscallinvoker.a`. I then made `ReactAndroid/src/main/jni/react/jni`'s `libreactnativejni.so` depend on that static library. Also, because the Android NDK build system doesn't support header namespaces, I had to use the filesystem to simulate them. This is why all the `.cpp` and `.h` files for `JSCallInvoker` were moved to a `jsireact` folder.

Reviewed By: mdvacca

Differential Revision: D15194821

fbshipit-source-id: 0cee682e41db53d0619f56ad017d5882f6d554aa
This commit is contained in:
Ramanpreet Nara
2019-05-03 13:25:56 -07:00
committed by Facebook Github Bot
parent cba205b82c
commit d77adcadbe
14 changed files with 74 additions and 18 deletions
@@ -0,0 +1,29 @@
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
# Header search path for all source files in this module.
LOCAL_C_INCLUDES := $(LOCAL_PATH)/jsireact
# Header search path for modules that depend on this module
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)
LOCAL_CFLAGS += -fexceptions -frtti -std=c++14 -Wall
LOCAL_STATIC_LIBRARIES = libjscallinvoker
LOCAL_SHARED_LIBRARIES = libfb
# Name of this module.
LOCAL_MODULE := jscallinvokerholder
# Compile all local c++ files under ./platform/android/jsireact
LOCAL_SRC_FILES := $(LOCAL_PATH)/jsireact/JSCallInvokerHolder.cpp
# Build the files in this directory as a shared library
include $(BUILD_STATIC_LIBRARY)
@@ -3,13 +3,13 @@ load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "
rn_xplat_cxx_library(
name = "jni",
srcs = [
"OnLoad.cpp",
"TurboModuleManager.cpp",
"jsireact/OnLoad.cpp",
"jsireact/TurboModuleManager.cpp",
],
header_namespace = "",
exported_headers = {
"jsireact/TurboModuleManager.h": "TurboModuleManager.h",
"jsireact/TurboModuleManagerDelegate.h": "TurboModuleManagerDelegate.h",
"jsireact/TurboModuleManager.h": "jsireact/TurboModuleManager.h",
"jsireact/TurboModuleManagerDelegate.h": "jsireact/TurboModuleManagerDelegate.h",
},
compiler_flags = [
"-fexceptions",
@@ -39,11 +39,11 @@ rn_xplat_cxx_library(
rn_xplat_cxx_library(
name = "jscallinvokerholder",
srcs = [
"JSCallInvokerHolder.cpp",
"jsireact/JSCallInvokerHolder.cpp",
],
header_namespace = "",
exported_headers = {
"jsireact/JSCallInvokerHolder.h": "JSCallInvokerHolder.h",
"jsireact/JSCallInvokerHolder.h": "jsireact/JSCallInvokerHolder.h",
},
compiler_flags = [
"-fexceptions",