include_defs('//ReactAndroid/DEFS')

# We depend on JSC, support the same platforms
SUPPORTED_PLATFORMS = '^android-(armv7|x86)$'

DEPS = [
  FBGLOGINIT_TARGET,
  '//native/fb:fb',
  '//native/third-party/android-ndk:android',
  '//xplat/folly:molly',
]

def jni_library(**kwargs):
  cxx_library(
    name='jni',
    visibility = [
      'PUBLIC',
    ],
    deps = DEPS + JSC_DEPS + [
      react_native_target('jni/react:react'),
      react_native_target('jni/xreact/jni:jni'),
    ],
    **kwargs
  )

jni_library(
  soname = 'libreactnativejni.so',
  header_namespace = 'react/jni',
  supported_platforms_regex = SUPPORTED_PLATFORMS,
  srcs = [
    'JExecutorToken.cpp',
    'JMessageQueueThread.cpp',
    'JSCPerfLogging.cpp',
    'JSLoader.cpp',
    'JSLogging.cpp',
    'JniJSModulesUnbundle.cpp',
    'OnLoad.cpp',
    'ProxyExecutor.cpp',
  ],
  headers = [
    'JSLoader.h',
    'JExecutorToken.h',
    'JExecutorTokenFactory.h',
    'JMessageQueueThread.h',
    'JNativeRunnable.h',
    'JniJSModulesUnbundle.h',
    'JSCPerfLogging.h',
    'JSLogging.h',
    'ProxyExecutor.h',
    'WebWorkers.h',
  ],
  exported_headers = [
  ],
  preprocessor_flags = [
    '-DLOG_TAG="ReactNativeJNI"',
    '-DWITH_FBSYSTRACE=1',
    '-DWITH_FBJSCEXTENSIONS=1',
  ],
  compiler_flags = [
    '-Wall',
    '-Werror',
    '-fexceptions',
    '-std=c++11',
    '-fvisibility=hidden',
    '-frtti',
  ],
)

project_config(
  src_target = ':jni',
)
