1load("@fbsource//tools/build_defs:glob_defs.bzl", "subdir_glob") 2load("//tools/build_defs/oss:rn_defs.bzl", "ANDROID", "APPLE", "CXX", "get_android_inspector_flags", "get_apple_compiler_flags", "get_apple_inspector_flags", "get_preprocessor_flags_for_build_mode", "react_native_xplat_target", "rn_xplat_cxx_library") 3 4rn_xplat_cxx_library( 5 name = "module", 6 header_namespace = "", 7 exported_headers = subdir_glob( 8 [ 9 ("", "CxxModule.h"), 10 ("", "JsArgumentHelpers.h"), 11 ("", "JsArgumentHelpers-inl.h"), 12 ], 13 prefix = "cxxreact", 14 ), 15 fbobjc_compiler_flags = get_apple_compiler_flags(), 16 force_static = True, 17 labels = [ 18 "pfh:ReactNative_CommonInfrastructurePlaceholder", 19 "supermodule:xplat/default/public.react_native.infra", 20 ], 21 visibility = [ 22 "PUBLIC", 23 ], 24 deps = [ 25 "//xplat/folly:molly", 26 ], 27) 28 29rn_xplat_cxx_library( 30 name = "jsbigstring", 31 srcs = [ 32 "JSBigString.cpp", 33 ], 34 header_namespace = "", 35 exported_headers = subdir_glob( 36 [("", "JSBigString.h")], 37 prefix = "cxxreact", 38 ), 39 fbobjc_compiler_flags = get_apple_compiler_flags(), 40 force_static = True, 41 labels = [ 42 "pfh:ReactNative_CommonInfrastructurePlaceholder", 43 "supermodule:xplat/default/public.react_native.infra", 44 ], 45 visibility = [ 46 "PUBLIC", 47 ], 48 deps = [ 49 "//xplat/folly:memory", 50 "//xplat/folly:molly", 51 "//xplat/folly:scope_guard", 52 ], 53) 54 55rn_xplat_cxx_library( 56 name = "samplemodule", 57 srcs = ["SampleCxxModule.cpp"], 58 header_namespace = "", 59 exported_headers = ["SampleCxxModule.h"], 60 compiler_flags = [ 61 "-fno-omit-frame-pointer", 62 ], 63 fbobjc_compiler_flags = get_apple_compiler_flags(), 64 labels = [ 65 "pfh:ReactNative_CommonInfrastructurePlaceholder", 66 "supermodule:xplat/default/public.react_native.infra", 67 ], 68 soname = "libxplat_react_module_samplemodule.$(ext)", 69 visibility = [ 70 "PUBLIC", 71 ], 72 deps = [ 73 ":module", 74 "//third-party/glog:glog", 75 "//xplat/folly:memory", 76 "//xplat/folly:molly", 77 ], 78) 79 80CXXREACT_PUBLIC_HEADERS = [ 81 "CxxNativeModule.h", 82 "ErrorUtils.h", 83 "Instance.h", 84 "JSBundleType.h", 85 "JSExecutor.h", 86 "JSIndexedRAMBundle.h", 87 "JSModulesUnbundle.h", 88 "MessageQueueThread.h", 89 "MethodCall.h", 90 "ModuleRegistry.h", 91 "NativeModule.h", 92 "NativeToJsBridge.h", 93 "RAMBundleRegistry.h", 94 "ReactMarker.h", 95 "RecoverableError.h", 96 "SharedProxyCxxModule.h", 97 "SystraceSection.h", 98] 99 100rn_xplat_cxx_library( 101 name = "bridge", 102 srcs = glob( 103 ["*.cpp"], 104 exclude = [ 105 "JSBigString.cpp", 106 "SampleCxxModule.cpp", 107 ], 108 ), 109 headers = glob( 110 ["*.h"], 111 exclude = CXXREACT_PUBLIC_HEADERS, 112 ), 113 header_namespace = "", 114 exported_headers = dict([ 115 ( 116 "cxxreact/%s" % header, 117 header, 118 ) 119 for header in CXXREACT_PUBLIC_HEADERS 120 ]), 121 fbandroid_preprocessor_flags = get_android_inspector_flags(), 122 fbobjc_compiler_flags = get_apple_compiler_flags(), 123 fbobjc_force_static = True, 124 fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), 125 labels = [ 126 "pfh:ReactNative_CommonInfrastructurePlaceholder", 127 "supermodule:xplat/default/public.react_native.infra", 128 ], 129 macosx_tests_override = [], 130 platforms = (ANDROID, APPLE, CXX), 131 preprocessor_flags = [ 132 "-DLOG_TAG=\"ReactNative\"", 133 "-DWITH_FBSYSTRACE=1", 134 ], 135 tests = [ 136 react_native_xplat_target("cxxreact/tests:tests"), 137 ], 138 visibility = ["PUBLIC"], 139 deps = [ 140 ":jsbigstring", 141 ":module", 142 "//xplat/fbsystrace:fbsystrace", 143 "//xplat/folly:headers_only_do_not_use", 144 "//xplat/folly:memory", 145 "//xplat/folly:molly", 146 "//xplat/jsi:jsi", 147 react_native_xplat_target("callinvoker:callinvoker"), 148 react_native_xplat_target("jsinspector:jsinspector"), 149 react_native_xplat_target("runtimeexecutor:runtimeexecutor"), 150 react_native_xplat_target("reactperflogger:reactperflogger"), 151 react_native_xplat_target("logger:logger"), 152 "//third-party/glog:glog", 153 "//xplat/folly:optional", 154 ], 155) 156