blob: a822828e5981bfd0b8d6c14c3f484b45de1e3831 [file] [log] [blame]
James Robinsona9763132014-10-06 11:18:13 -07001# 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
James Robinsond753aca2015-01-12 13:07:20 -08005import("//build/module_args/v8.gni")
James Robinson5e66a792015-01-21 17:02:08 -08006import("//testing/test.gni")
James Robinsond753aca2015-01-12 13:07:20 -08007
James Robinsona9763132014-10-06 11:18:13 -07008component("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 "debug_impl.cc",
18 "debug_impl.h",
19 "dictionary.cc",
20 "dictionary.h",
21 "function_template.cc",
22 "function_template.h",
23 "gin_export.h",
24 "handle.h",
25 "interceptor.cc",
26 "interceptor.h",
27 "isolate_holder.cc",
28 "modules/console.cc",
29 "modules/console.h",
30 "modules/file_module_provider.cc",
31 "modules/file_module_provider.h",
32 "modules/module_registry.cc",
33 "modules/module_registry.h",
34 "modules/module_registry_observer.h",
35 "modules/module_runner_delegate.cc",
36 "modules/module_runner_delegate.h",
37 "modules/timer.cc",
38 "modules/timer.h",
39 "object_template_builder.cc",
40 "object_template_builder.h",
41 "per_context_data.cc",
42 "per_context_data.h",
43 "per_isolate_data.cc",
44 "per_isolate_data.h",
45 "public/context_holder.h",
46 "public/debug.h",
47 "public/gin_embedders.h",
48 "public/isolate_holder.h",
49 "public/v8_platform.h",
50 "public/wrapper_info.h",
James Robinsona9763132014-10-06 11:18:13 -070051 "run_microtasks_observer.cc",
52 "run_microtasks_observer.h",
James Robinson63d51d02015-04-03 17:17:14 -070053 "runner.cc",
54 "runner.h",
James Robinsona9763132014-10-06 11:18:13 -070055 "shell_runner.cc",
56 "shell_runner.h",
57 "try_catch.cc",
58 "try_catch.h",
59 "v8_platform.cc",
60 "wrappable.cc",
61 "wrappable.h",
62 "wrapper_info.cc",
63 ]
64
65 defines = [ "GIN_IMPLEMENTATION" ]
66
67 public_deps = [
68 "//base",
69 "//v8",
70 ]
71 deps = [
72 "//base/third_party/dynamic_annotations",
James Robinson63d51d02015-04-03 17:17:14 -070073 "//crypto",
James Robinsona9763132014-10-06 11:18:13 -070074 ]
James Robinsond753aca2015-01-12 13:07:20 -080075 if (v8_use_external_startup_data && is_win) {
76 deps += [
77 ":gin_v8_snapshot_fingerprint",
78 "//crypto:crypto",
79 ]
80 sources += [ "$target_gen_dir/v8_snapshot_fingerprint.cc" ]
81 defines += [ "V8_VERIFY_EXTERNAL_STARTUP_DATA" ]
82 }
83}
84
85if (v8_use_external_startup_data) {
86 action("gin_v8_snapshot_fingerprint") {
87 script = "//gin/fingerprint/fingerprint_v8_snapshot.py"
88
89 snapshot_file = "$root_build_dir/snapshot_blob.bin"
90 natives_file = "$root_build_dir/natives_blob.bin"
91 output_file = "$target_gen_dir/v8_snapshot_fingerprint.cc"
92
93 args = [
94 "--snapshot_file",
95 rebase_path(snapshot_file, root_build_dir),
96 "--natives_file",
97 rebase_path(natives_file, root_build_dir),
98 "--output_file",
99 rebase_path(output_file, root_build_dir),
100 ]
101 inputs = [
102 snapshot_file,
103 natives_file,
104 ]
105 outputs = [
106 output_file,
107 ]
108 }
James Robinsona9763132014-10-06 11:18:13 -0700109}
110
111executable("gin_shell") {
112 sources = [
113 "shell/gin_main.cc",
114 ]
115
116 deps = [
117 ":gin",
118 "//base",
119 "//base:i18n",
120 "//v8",
121 ]
122}
123
124source_set("gin_test") {
125 testonly = true
126 sources = [
127 "test/file.cc",
128 "test/file.h",
129 "test/file_runner.cc",
130 "test/file_runner.h",
131 "test/gc.cc",
132 "test/gc.h",
133 "test/gtest.cc",
134 "test/gtest.h",
135 "test/v8_test.cc",
136 "test/v8_test.h",
137 ]
138
139 public_deps = [
140 ":gin",
141 "//testing/gtest",
142 ]
143 deps = [
144 "//v8",
145 ]
146}
147
148test("gin_unittests") {
149 sources = [
150 "converter_unittest.cc",
151 "interceptor_unittest.cc",
152 "modules/module_registry_unittest.cc",
153 "modules/timer_unittest.cc",
154 "per_context_data_unittest.cc",
James Robinsona9763132014-10-06 11:18:13 -0700155 "shell/gin_shell_unittest.cc",
James Robinson63d51d02015-04-03 17:17:14 -0700156 "shell_runner_unittest.cc",
James Robinsona9763132014-10-06 11:18:13 -0700157 "test/run_all_unittests.cc",
158 "test/run_js_tests.cc",
159 "wrappable_unittest.cc",
160 ]
161
162 deps = [
163 ":gin_test",
164 "//base/test:test_support",
165 "//v8",
166 ]
167}