BUILD.gn 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. # Copyright 2014 The Chromium Authors. All rights reserved.
  2. # Use of this source code is governed by a BSD-style license that can be
  3. # found in the LICENSE file.
  4. import("//base/allocator/allocator.gni")
  5. import("//testing/test.gni")
  6. import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
  7. import("//v8/gni/v8.gni")
  8. component("gin") {
  9. sources = [
  10. "arguments.cc",
  11. "arguments.h",
  12. "array_buffer.cc",
  13. "array_buffer.h",
  14. "context_holder.cc",
  15. "converter.cc",
  16. "converter.h",
  17. "cppgc.cc",
  18. "data_object_builder.cc",
  19. "data_object_builder.h",
  20. "debug_impl.cc",
  21. "debug_impl.h",
  22. "dictionary.cc",
  23. "dictionary.h",
  24. "function_template.cc",
  25. "function_template.h",
  26. "gin_export.h",
  27. "gin_features.cc",
  28. "gin_features.h",
  29. "handle.h",
  30. "interceptor.cc",
  31. "interceptor.h",
  32. "isolate_holder.cc",
  33. "modules/console.cc",
  34. "modules/console.h",
  35. "object_template_builder.cc",
  36. "object_template_builder.h",
  37. "per_context_data.cc",
  38. "per_context_data.h",
  39. "per_isolate_data.cc",
  40. "per_isolate_data.h",
  41. "public/context_holder.h",
  42. "public/cppgc.h",
  43. "public/debug.h",
  44. "public/gin_embedders.h",
  45. "public/isolate_holder.h",
  46. "public/v8_idle_task_runner.h",
  47. "public/v8_platform.h",
  48. "public/wrapper_info.h",
  49. "runner.cc",
  50. "runner.h",
  51. "shell_runner.cc",
  52. "shell_runner.h",
  53. "try_catch.cc",
  54. "try_catch.h",
  55. "v8_foreground_task_runner.cc",
  56. "v8_foreground_task_runner.h",
  57. "v8_foreground_task_runner_base.cc",
  58. "v8_foreground_task_runner_base.h",
  59. "v8_foreground_task_runner_with_locker.cc",
  60. "v8_foreground_task_runner_with_locker.h",
  61. "v8_initializer.cc",
  62. "v8_initializer.h",
  63. "v8_isolate_memory_dump_provider.cc",
  64. "v8_isolate_memory_dump_provider.h",
  65. "v8_platform.cc",
  66. "v8_shared_memory_dump_provider.cc",
  67. "v8_shared_memory_dump_provider.h",
  68. "wrappable.cc",
  69. "wrappable.h",
  70. "wrapper_info.cc",
  71. ]
  72. if (use_partition_alloc) {
  73. sources += [
  74. "v8_platform_page_allocator.cc",
  75. "v8_platform_page_allocator.h",
  76. ]
  77. }
  78. if (v8_use_external_startup_data) {
  79. data = [ "$root_out_dir/snapshot_blob.bin" ]
  80. sources += [ "public/v8_snapshot_file_type.h" ]
  81. }
  82. defines = [ "GIN_IMPLEMENTATION" ]
  83. public_deps = [
  84. "//base",
  85. "//base/allocator:buildflags",
  86. "//v8",
  87. ]
  88. deps = [
  89. "//base/third_party/dynamic_annotations",
  90. "//third_party/abseil-cpp:absl",
  91. ]
  92. if (is_mac) {
  93. frameworks = [ "CoreFoundation.framework" ]
  94. }
  95. configs += [
  96. "//tools/v8_context_snapshot:use_v8_context_snapshot",
  97. "//v8:external_startup_data",
  98. ]
  99. }
  100. executable("gin_shell") {
  101. sources = [ "shell/gin_main.cc" ]
  102. deps = [
  103. ":gin",
  104. "//base",
  105. "//base:i18n",
  106. "//build/win:default_exe_manifest",
  107. "//v8",
  108. ]
  109. configs += [ "//v8:external_startup_data" ]
  110. }
  111. source_set("gin_test") {
  112. testonly = true
  113. sources = [
  114. "test/v8_test.cc",
  115. "test/v8_test.h",
  116. ]
  117. public_deps = [
  118. ":gin",
  119. "//testing/gtest",
  120. ]
  121. deps = [
  122. "//base/test:test_support",
  123. "//v8",
  124. ]
  125. configs += [ "//v8:external_startup_data" ]
  126. }
  127. test("gin_unittests") {
  128. sources = [
  129. "arguments_unittest.cc",
  130. "array_buffer_unittest.cc",
  131. "converter_unittest.cc",
  132. "data_object_builder_unittest.cc",
  133. "interceptor_unittest.cc",
  134. "per_context_data_unittest.cc",
  135. "shell_runner_unittest.cc",
  136. "test/run_all_unittests.cc",
  137. "v8_isolate_memory_dump_provider_unittest.cc",
  138. "v8_platform_unittest.cc",
  139. "v8_shared_memory_dump_provider_unittest.cc",
  140. "wrappable_unittest.cc",
  141. ]
  142. deps = [
  143. ":gin_test",
  144. "//base/test:test_support",
  145. "//testing/gmock",
  146. "//testing/gtest",
  147. "//v8",
  148. ]
  149. if (use_partition_alloc) {
  150. sources += [ "v8_platform_page_allocator_unittest.cc" ]
  151. if (target_cpu == "arm64" && (is_linux || is_android)) {
  152. deps += [ "//base:arm_bti_testfunctions" ]
  153. }
  154. }
  155. configs += [
  156. "//tools/v8_context_snapshot:use_v8_context_snapshot",
  157. "//v8:external_startup_data",
  158. ]
  159. data_deps = [
  160. "//testing/buildbot/filters:gin_unittests_filters",
  161. "//tools/v8_context_snapshot:v8_context_snapshot",
  162. ]
  163. data = []
  164. # gin_shell is not an Android app.
  165. if (!is_android) {
  166. sources += [ "shell/gin_shell_unittest.cc" ]
  167. deps += [ ":gin_shell" ]
  168. data_deps += [ ":gin_shell" ]
  169. data += [ "shell/hello_world.js" ]
  170. }
  171. # On Android, the APK must bundle the startup data.
  172. if (is_android) {
  173. deps += [ "//v8:v8_external_startup_data_assets" ]
  174. }
  175. if (is_fuchsia) {
  176. # TODO(https://crbug.com/1185811): Investigate removing the requirement for
  177. # job_policy_ambient_mark_vmo_exec for the sake of V8's allocator in tests.
  178. test_runner_shard = "//build/config/fuchsia/test/elf_test_ambient_exec_runner.shard.test-cml"
  179. }
  180. }