BUCK 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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_xplat_target",
  12. "rn_xplat_cxx_library",
  13. "subdir_glob",
  14. )
  15. APPLE_COMPILER_FLAGS = get_apple_compiler_flags()
  16. rn_xplat_cxx_library(
  17. name = "text",
  18. srcs = glob(
  19. ["**/*.cpp"],
  20. exclude = glob(["tests/**/*.cpp"]),
  21. ),
  22. headers = glob(
  23. ["**/*.h"],
  24. exclude = glob(["tests/**/*.h"]),
  25. ),
  26. header_namespace = "",
  27. exported_headers = subdir_glob(
  28. [
  29. ("", "*.h"),
  30. ("basetext", "*.h"),
  31. ("paragraph", "*.h"),
  32. ("text", "*.h"),
  33. ("rawtext", "*.h"),
  34. ],
  35. prefix = "react/components/text",
  36. ),
  37. compiler_flags = [
  38. "-fexceptions",
  39. "-frtti",
  40. "-std=c++14",
  41. "-Wall",
  42. ],
  43. cxx_tests = [":tests"],
  44. fbobjc_compiler_flags = APPLE_COMPILER_FLAGS,
  45. fbobjc_labels = ["supermodule:ios/default/public.react_native.infra"],
  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:container_evicting_cache_map",
  57. "//xplat/folly:headers_only",
  58. "//xplat/folly:memory",
  59. "//xplat/folly:molly",
  60. "//xplat/third-party/glog:glog",
  61. YOGA_CXX_TARGET,
  62. react_native_xplat_target("utils:utils"),
  63. react_native_xplat_target("fabric/attributedstring:attributedstring"),
  64. react_native_xplat_target("fabric/core:core"),
  65. react_native_xplat_target("fabric/debug:debug"),
  66. react_native_xplat_target("fabric/graphics:graphics"),
  67. react_native_xplat_target("fabric/textlayoutmanager:textlayoutmanager"),
  68. react_native_xplat_target("fabric/components/view:view"),
  69. react_native_xplat_target("fabric/uimanager:uimanager"),
  70. ],
  71. )
  72. fb_xplat_cxx_test(
  73. name = "tests",
  74. srcs = glob(["tests/**/*.cpp"]),
  75. headers = glob(["tests/**/*.h"]),
  76. compiler_flags = [
  77. "-fexceptions",
  78. "-frtti",
  79. "-std=c++14",
  80. "-Wall",
  81. ],
  82. contacts = ["oncall+react_native@xmail.facebook.com"],
  83. platforms = (
  84. # `Apple` and `Android` flavors are disabled because the module depends on `textlayoutmanager` which requires real an Emulator/Simulator to run.
  85. # 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`.
  86. # (Beware of this option though.)
  87. # ANDROID,
  88. # APPLE,
  89. CXX
  90. ),
  91. deps = [
  92. ":text",
  93. "//xplat/folly:molly",
  94. "//xplat/third-party/gmock:gtest",
  95. ],
  96. )