BUCK 2.8 KB

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