diff --git a/ReactAndroid/src/main/jni/react/jni/BUCK b/ReactAndroid/src/main/jni/react/jni/BUCK index 5ce1930b4e2..23c189053a8 100644 --- a/ReactAndroid/src/main/jni/react/jni/BUCK +++ b/ReactAndroid/src/main/jni/react/jni/BUCK @@ -1,4 +1,4 @@ -load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBJNI_TARGET", "IS_OSS_BUILD", "react_native_target", "react_native_xplat_dep", "react_native_xplat_target", "rn_xplat_cxx_library") +load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "FBGLOGINIT_TARGET", "FBJNI_TARGET", "IS_OSS_BUILD", "react_native_target", "react_native_xplat_dep", "react_native_xplat_target", "rn_xplat_cxx_library") EXPORTED_HEADERS = [ "CxxModuleWrapper.h", @@ -48,7 +48,7 @@ rn_xplat_cxx_library( "-DLOG_TAG=\"ReactNativeJNI\"", "-DWITH_FBSYSTRACE=1", "-DWITH_INSPECTOR=1", - ], + ] + ["-DWITH_GLOGINIT=0"] if not IS_OSS_BUILD else [], soname = "libreactnativejni.$(ext)", visibility = [ "PUBLIC", @@ -59,7 +59,6 @@ rn_xplat_cxx_library( "//third-party/glog:glog", "//xplat/folly:dynamic", "//xplat/folly:json", - "//fbandroid/xplat/fbgloginit:fbgloginit", "//xplat/fbsystrace:fbsystrace", react_native_target("jni/react/turbomodule:callinvokerholder"), react_native_xplat_target("cxxreact:bridge"), @@ -71,5 +70,7 @@ rn_xplat_cxx_library( react_native_xplat_target("logger:logger"), react_native_xplat_dep("jsi:jsi"), FBJNI_TARGET, - ] if not IS_OSS_BUILD else [], + ] + ([ + FBGLOGINIT_TARGET, + ] if IS_OSS_BUILD else []), ) diff --git a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp index cbcaa77eb1d..5dd3d186098 100644 --- a/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp +++ b/ReactAndroid/src/main/jni/react/jni/OnLoad.cpp @@ -25,6 +25,10 @@ #include "JInspector.h" #endif +#ifndef WITH_GLOGINIT +#define WITH_GLOGINIT 1 +#endif + using namespace facebook::jni; namespace facebook { @@ -67,8 +71,10 @@ class ProxyJavaScriptExecutorHolder : public HybridClass< extern "C" JNIEXPORT jint JNI_OnLoad(JavaVM *vm, void *reserved) { return initialize(vm, [] { +#if WITH_GLOGINIT gloginit::initialize(); FLAGS_minloglevel = 0; +#endif ProxyJavaScriptExecutorHolder::registerNatives(); CatalystInstanceImpl::registerNatives(); CxxModuleWrapperBase::registerNatives();