[go: nahoru, domu]

blob: ac6404a0f9bc0833f83217e6e142974a5fc80899 [file] [log] [blame]
# Copyright 2014 The Chromium Authors
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
if (is_android) {
import("//build/config/android/rules.gni")
}
import("//base/allocator/partition_allocator/partition_alloc.gni")
import("//testing/test.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/gni/v8.gni")
component("gin") {
sources = [
"arguments.cc",
"arguments.h",
"array_buffer.cc",
"array_buffer.h",
"context_holder.cc",
"converter.cc",
"converter.h",
"cppgc.cc",
"data_object_builder.cc",
"data_object_builder.h",
"debug_impl.cc",
"debug_impl.h",
"dictionary.cc",
"dictionary.h",
"function_template.cc",
"function_template.h",
"gin_export.h",
"gin_features.cc",
"gin_features.h",
"handle.h",
"interceptor.cc",
"interceptor.h",
"isolate_holder.cc",
"modules/console.cc",
"modules/console.h",
"object_template_builder.cc",
"object_template_builder.h",
"per_context_data.cc",
"per_context_data.h",
"per_isolate_data.cc",
"per_isolate_data.h",
"public/context_holder.h",
"public/cppgc.h",
"public/debug.h",
"public/gin_embedders.h",
"public/isolate_holder.h",
"public/v8_idle_task_runner.h",
"public/v8_platform.h",
"public/wrapper_info.h",
"runner.cc",
"runner.h",
"shell_runner.cc",
"shell_runner.h",
"thread_isolation.cc",
"thread_isolation.h",
"time_clamper.cc",
"time_clamper.h",
"try_catch.cc",
"try_catch.h",
"v8_foreground_task_runner.cc",
"v8_foreground_task_runner.h",
"v8_foreground_task_runner_base.cc",
"v8_foreground_task_runner_base.h",
"v8_foreground_task_runner_with_locker.cc",
"v8_foreground_task_runner_with_locker.h",
"v8_initializer.cc",
"v8_initializer.h",
"v8_isolate_memory_dump_provider.cc",
"v8_isolate_memory_dump_provider.h",
"v8_platform.cc",
"v8_shared_memory_dump_provider.cc",
"v8_shared_memory_dump_provider.h",
"wrappable.cc",
"wrappable.h",
"wrapper_info.cc",
]
if (use_partition_alloc) {
sources += [
"v8_platform_page_allocator.cc",
"v8_platform_page_allocator.h",
]
if (enable_pkeys) {
sources += [
"v8_platform_thread_isolated_allocator.cc",
"v8_platform_thread_isolated_allocator.h",
]
}
}
if (v8_use_external_startup_data) {
data = [ "$root_out_dir/snapshot_blob.bin" ]
sources += [ "public/v8_snapshot_file_type.h" ]
}
defines = [ "GIN_IMPLEMENTATION" ]
public_deps = [
"//base",
"//base/allocator:buildflags",
"//v8",
]
deps = [
"//base/third_party/dynamic_annotations",
"//third_party/abseil-cpp:absl",
"//tools/v8_context_snapshot:buildflags",
]
if (is_mac) {
frameworks = [ "CoreFoundation.framework" ]
}
configs += [ "//v8:external_startup_data" ]
}
executable("gin_shell") {
sources = [ "shell/gin_main.cc" ]
deps = [
":gin",
"//base",
"//base:i18n",
"//build/win:default_exe_manifest",
"//v8",
]
configs += [ "//v8:external_startup_data" ]
}
if (is_android && enable_java_templates &&
current_toolchain == default_toolchain) {
android_assets("v8_snapshot_assets") {
if (v8_use_external_startup_data) {
disable_compression = true
if (use_v8_context_snapshot) {
deps = [ "//tools/v8_context_snapshot:v8_context_snapshot" ]
sources = [ "$root_build_dir/$v8_context_snapshot_filename" ]
} else {
if (current_cpu == "arm" || current_cpu == "x86") {
_arch_suffix = "32"
} else {
_arch_suffix = "64"
}
renaming_sources = [ "$root_build_dir/snapshot_blob.bin" ]
renaming_destinations = [ "snapshot_blob_$_arch_suffix.bin" ]
deps = [ "//v8:run_mksnapshot_default" ]
}
}
}
if (android_64bit_target_cpu && !skip_secondary_abi_for_cq) {
android_assets("v8_snapshot_secondary_abi_assets") {
# only import asset when v8_use_external_startup_data == true
# like "v8_snapshot_assets" above
if (v8_use_external_startup_data) {
assert(android_64bit_target_cpu,
"32-bit targets shouldn't have secondary abi")
disable_compression = true
if (use_v8_context_snapshot) {
sources = [ "$root_out_dir/v8_context_snapshot_32.bin" ]
deps = [
"//tools/v8_context_snapshot($android_secondary_abi_toolchain)",
]
} else {
_secondary_abi_out_dir =
get_label_info("//v8($android_secondary_abi_toolchain)",
"root_out_dir")
renaming_sources = [ "$_secondary_abi_out_dir/snapshot_blob.bin" ]
renaming_destinations = [ "snapshot_blob_32.bin" ]
deps = [
"//v8:run_mksnapshot_default($android_secondary_abi_toolchain)",
]
}
}
}
}
}
source_set("gin_test") {
testonly = true
sources = [
"test/v8_test.cc",
"test/v8_test.h",
]
public_deps = [
":gin",
"//testing/gtest",
]
deps = [
"//base/test:test_support",
"//v8",
]
configs += [ "//v8:external_startup_data" ]
}
test("gin_unittests") {
sources = [
"arguments_unittest.cc",
"array_buffer_unittest.cc",
"converter_unittest.cc",
"data_object_builder_unittest.cc",
"interceptor_unittest.cc",
"isolate_holder_unittest.cc",
"per_context_data_unittest.cc",
"shell_runner_unittest.cc",
"test/run_all_unittests.cc",
"time_clamper_unittest.cc",
"v8_isolate_memory_dump_provider_unittest.cc",
"v8_platform_unittest.cc",
"v8_shared_memory_dump_provider_unittest.cc",
"wrappable_unittest.cc",
]
deps = [
":gin_test",
"//base/test:test_support",
"//testing/gmock",
"//testing/gtest",
"//v8",
]
if (use_partition_alloc) {
sources += [ "v8_platform_page_allocator_unittest.cc" ]
if (target_cpu == "arm64" && (is_linux || is_android)) {
deps += [ "//base:arm_bti_testfunctions" ]
}
}
configs += [ "//v8:external_startup_data" ]
data_deps = [
"//testing/buildbot/filters:gin_unittests_filters",
"//tools/v8_context_snapshot:v8_context_snapshot",
]
data = []
# gin_shell is not an Android/iOS app.
if (!is_android && !is_ios) {
sources += [ "shell/gin_shell_unittest.cc" ]
deps += [ ":gin_shell" ]
data_deps += [ ":gin_shell" ]
data += [ "shell/hello_world.js" ]
}
# On Android, the APK must bundle the startup data.
if (is_android) {
deps += [ ":v8_snapshot_assets" ]
}
if (is_fuchsia) {
additional_manifest_fragments =
[ "//build/config/fuchsia/test/mark_vmo_executable.shard.test-cml" ]
}
}