1load( 2 "//tools/build_defs/oss:rn_defs.bzl", 3 "ANDROID", 4 "APPLE", 5 "CXX", 6 "YOGA_CXX_TARGET", 7 "fb_xplat_cxx_test", 8 "get_apple_compiler_flags", 9 "get_apple_inspector_flags", 10 "get_preprocessor_flags_for_build_mode", 11 "react_native_target", 12 "react_native_xplat_target", 13 "rn_xplat_cxx_library", 14 "subdir_glob", 15) 16 17APPLE_COMPILER_FLAGS = get_apple_compiler_flags() 18 19rn_xplat_cxx_library( 20 name = "androidswitch", 21 srcs = glob( 22 ["androidswitch/react/renderer/components/androidswitch/*.cpp"], 23 exclude = glob(["tests/**/*.cpp"]), 24 ), 25 headers = glob( 26 ["androidswitch/react/renderer/components/androidswitch/*.h"], 27 exclude = glob(["tests/**/*.h"]), 28 ), 29 header_namespace = "", 30 exported_headers = subdir_glob( 31 [ 32 ("", "*.h"), 33 ("androidswitch/react/renderer/components/androidswitch", "*.h"), 34 ], 35 prefix = "react/renderer/components/androidswitch", 36 ), 37 cxx_tests = [":tests"], 38 fbandroid_deps = [ 39 react_native_target("jni/react/jni:jni"), 40 ], 41 fbobjc_compiler_flags = APPLE_COMPILER_FLAGS, 42 fbobjc_preprocessor_flags = get_preprocessor_flags_for_build_mode() + get_apple_inspector_flags(), 43 force_static = True, 44 labels = [ 45 "pfh:ReactNative_CommonInfrastructurePlaceholder", 46 "supermodule:xplat/default/public.react_native.infra", 47 ], 48 platforms = (ANDROID, APPLE, CXX), 49 preprocessor_flags = [ 50 "-DLOG_TAG=\"ReactNative\"", 51 "-DWITH_FBSYSTRACE=1", 52 ], 53 visibility = ["PUBLIC"], 54 deps = [ 55 "//third-party/glog:glog", 56 "//xplat/fbsystrace:fbsystrace", 57 "//xplat/folly:headers_only_do_not_use", 58 "//xplat/folly:memory", 59 "//xplat/folly:molly", 60 YOGA_CXX_TARGET, 61 react_native_xplat_target("react/renderer/debug:debug"), 62 react_native_xplat_target("react/renderer/core:core"), 63 react_native_xplat_target("react/renderer/graphics:graphics"), 64 react_native_xplat_target("react/renderer/components/view:view"), 65 react_native_xplat_target("react/renderer/uimanager:uimanager"), 66 react_native_xplat_target("react/renderer/componentregistry:componentregistry"), 67 "//xplat/js/react-native-github:generated_components-rncore", 68 ], 69) 70 71fb_xplat_cxx_test( 72 name = "tests", 73 srcs = glob(["tests/**/*.cpp"]), 74 headers = glob(["tests/**/*.h"]), 75 compiler_flags = [ 76 "-fexceptions", 77 "-frtti", 78 "-std=c++17", 79 "-Wall", 80 ], 81 contacts = ["[email protected]"], 82 platforms = ( 83 # `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run. 84 # At the same time, the code of tests does not rely on the simulator capabilities and it would be wasteful to add `fbandroid_use_instrumentation_test = True`. 85 # (Beware of this option though.) 86 # ANDROID, 87 # APPLE, 88 CXX 89 ), 90 deps = [ 91 ":androidswitch", 92 "//xplat/folly:molly", 93 "//xplat/third-party/gmock:gtest", 94 ], 95) 96