BUCK 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. # Copyright 2004-present Facebook. All Rights Reserved.
  2. load("@fbsource//tools/build_defs:fb_xplat_cxx_binary.bzl", "fb_xplat_cxx_binary")
  3. load("@fbsource//tools/build_defs:fb_xplat_cxx_library.bzl", "fb_xplat_cxx_library")
  4. load("@fbsource//tools/build_defs:fb_xplat_cxx_test.bzl", "fb_xplat_cxx_test")
  5. load("@fbsource//tools/build_defs:platform_defs.bzl", "APPLE", "CXX")
  6. load("@fbsource//tools/build_defs/oss:rn_defs.bzl", "react_native_xplat_target")
  7. load("@fbsource//xplat/hermes/defs:hermes.bzl", "hermes_build_mode", "hermes_optimize_flag")
  8. CFLAGS_BY_MODE = {
  9. "dbg": [
  10. "-fexceptions",
  11. "-frtti",
  12. hermes_optimize_flag("dbg"),
  13. "-g",
  14. ],
  15. "dev": [
  16. "-fexceptions",
  17. "-frtti",
  18. hermes_optimize_flag("dev"),
  19. "-g",
  20. ],
  21. "opt": [
  22. "-fexceptions",
  23. "-frtti",
  24. hermes_optimize_flag("opt"),
  25. ],
  26. }
  27. CHROME_EXPORTED_HEADERS = [
  28. "chrome/AutoAttachUtils.h",
  29. "chrome/Connection.h",
  30. "chrome/ConnectionDemux.h",
  31. "chrome/MessageConverters.h",
  32. "chrome/MessageInterfaces.h",
  33. "chrome/MessageTypes.h",
  34. "chrome/Registration.h",
  35. "chrome/RemoteObjectsTable.h",
  36. ]
  37. fb_xplat_cxx_library(
  38. name = "chrome",
  39. srcs = glob(["chrome/*.cpp"]),
  40. headers = glob(
  41. [
  42. "chrome/*.h",
  43. ],
  44. exclude = CHROME_EXPORTED_HEADERS,
  45. ),
  46. header_namespace = "hermes/inspector",
  47. exported_headers = CHROME_EXPORTED_HEADERS,
  48. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  49. fbobjc_header_path_prefix = "hermes/inspector/chrome",
  50. macosx_tests_override = [],
  51. tests = [":chrome-tests"],
  52. visibility = [
  53. "PUBLIC",
  54. ],
  55. xcode_public_headers_symlinks = True,
  56. deps = [
  57. react_native_xplat_target("jsinspector:jsinspector"),
  58. ":detail",
  59. ":inspectorlib",
  60. "//xplat/folly:futures",
  61. "//xplat/folly:molly",
  62. "//xplat/hermes/API:HermesAPI",
  63. "//xplat/jsi:JSIDynamic",
  64. "//xplat/jsi:jsi",
  65. "//xplat/third-party/glog:glog",
  66. ],
  67. )
  68. fb_xplat_cxx_test(
  69. name = "chrome-tests",
  70. srcs = glob([
  71. "chrome/tests/*.cpp",
  72. ]),
  73. headers = glob([
  74. "chrome/tests/*.h",
  75. ]),
  76. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  77. cxx_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  78. fbandroid_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  79. fbobjc_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  80. visibility = [
  81. "PUBLIC",
  82. ],
  83. deps = [
  84. ":chrome",
  85. ":detail",
  86. "//xplat/third-party/gmock:gtest",
  87. ],
  88. )
  89. DETAIL_EXPORTED_HEADERS = [
  90. "detail/CallbackOStream.h",
  91. "detail/SerialExecutor.h",
  92. "detail/Thread.h",
  93. ]
  94. fb_xplat_cxx_library(
  95. name = "detail",
  96. srcs = glob(["detail/*.cpp"]),
  97. headers = glob(
  98. [
  99. "detail/*.h",
  100. ],
  101. exclude = DETAIL_EXPORTED_HEADERS,
  102. ),
  103. header_namespace = "hermes/inspector",
  104. exported_headers = DETAIL_EXPORTED_HEADERS,
  105. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  106. # This is required by lint, but must be False, because there is
  107. # no JNI_Onload.
  108. fbandroid_allow_jni_merging = False,
  109. fbandroid_deps = [
  110. "//fbandroid/native/fb:fb",
  111. ],
  112. fbobjc_header_path_prefix = "hermes/inspector/detail",
  113. macosx_tests_override = [],
  114. tests = [":detail-tests"],
  115. visibility = [
  116. "PUBLIC",
  117. ],
  118. xcode_public_headers_symlinks = True,
  119. deps = [
  120. "//xplat/folly:molly",
  121. ],
  122. )
  123. fb_xplat_cxx_test(
  124. name = "detail-tests",
  125. srcs = glob([
  126. "detail/tests/*.cpp",
  127. ]),
  128. headers = glob([
  129. "detail/tests/*.h",
  130. ]),
  131. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  132. visibility = [
  133. "PUBLIC",
  134. ],
  135. deps = [
  136. ":detail",
  137. "//xplat/third-party/gmock:gmock",
  138. "//xplat/third-party/gmock:gtest",
  139. ],
  140. )
  141. fb_xplat_cxx_binary(
  142. name = "hermes-chrome-debug-server",
  143. srcs = glob([
  144. "chrome/cli/*.cpp",
  145. ]),
  146. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  147. cxx_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  148. fbandroid_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  149. fbobjc_deps = [react_native_xplat_target("jsinspector:jsinspector")],
  150. visibility = [
  151. "PUBLIC",
  152. ],
  153. deps = [
  154. ":chrome",
  155. ":inspectorlib",
  156. "//xplat/hermes/API:HermesAPI",
  157. ],
  158. )
  159. INSPECTOR_EXPORTED_HEADERS = [
  160. "AsyncPauseState.h",
  161. "Exceptions.h",
  162. "Inspector.h",
  163. "RuntimeAdapter.h",
  164. ]
  165. # can't be named "inspector" since JSC already uses it, causing a buck rulekey
  166. # collision: P58794155
  167. fb_xplat_cxx_library(
  168. name = "inspectorlib",
  169. srcs = glob(["*.cpp"]),
  170. headers = glob(
  171. [
  172. "*.h",
  173. ],
  174. exclude = INSPECTOR_EXPORTED_HEADERS,
  175. ),
  176. header_namespace = "hermes/inspector",
  177. exported_headers = INSPECTOR_EXPORTED_HEADERS,
  178. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  179. cxx_tests = [":inspector-tests"],
  180. fbobjc_header_path_prefix = "hermes/inspector",
  181. macosx_tests_override = [],
  182. visibility = [
  183. "PUBLIC",
  184. ],
  185. xcode_public_headers_symlinks = True,
  186. deps = [
  187. ":detail",
  188. "//xplat/folly:futures",
  189. "//xplat/folly:molly",
  190. "//xplat/hermes/API:HermesAPI",
  191. "//xplat/jsi:jsi",
  192. "//xplat/third-party/glog:glog",
  193. ],
  194. )
  195. fb_xplat_cxx_test(
  196. name = "inspector-tests",
  197. srcs = glob([
  198. "tests/*.cpp",
  199. ]),
  200. headers = glob([
  201. "tests/*.h",
  202. ]),
  203. compiler_flags = CFLAGS_BY_MODE[hermes_build_mode()],
  204. platforms = (CXX, APPLE),
  205. visibility = [
  206. "PUBLIC",
  207. ],
  208. deps = [
  209. ":inspectorlib",
  210. "//xplat/third-party/gmock:gtest",
  211. ],
  212. )