Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(103)

Side by Side Diff: headless/BUILD.gn

Issue 2902583002: Add some closureised JS bindings for DevTools for use by headless embedder (Closed)
Patch Set: Rebased Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | headless/headless_browsertest_resources.grd » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2015 The Chromium Authors. All rights reserved. 1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import("//build/config/chrome_build.gni") 5 import("//build/config/chrome_build.gni")
6 import("//build/util/process_version.gni") 6 import("//build/util/process_version.gni")
7 import("//headless/headless.gni") 7 import("//headless/headless.gni")
8 import("//mojo/public/tools/bindings/mojom.gni") 8 import("//mojo/public/tools/bindings/mojom.gni")
9 import("//printing/features/features.gni") 9 import("//printing/features/features.gni")
10 import("//testing/test.gni") 10 import("//testing/test.gni")
11 import("//third_party/closure_compiler/compile_js.gni")
11 import("//tools/grit/grit_rule.gni") 12 import("//tools/grit/grit_rule.gni")
12 import("//tools/grit/repack.gni") 13 import("//tools/grit/repack.gni")
13 14
14 config("headless_implementation") { 15 config("headless_implementation") {
15 defines = [ "HEADLESS_IMPLEMENTATION" ] 16 defines = [ "HEADLESS_IMPLEMENTATION" ]
16 17
17 if (headless_use_embedded_resources) { 18 if (headless_use_embedded_resources) {
18 defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ] 19 defines += [ "HEADLESS_USE_EMBEDDED_RESOURCES" ]
19 } 20 }
20 } 21 }
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 "page", 154 "page",
154 "profiler", 155 "profiler",
155 "runtime", 156 "runtime",
156 "security", 157 "security",
157 "service_worker", 158 "service_worker",
158 "target", 159 "target",
159 "tracing", 160 "tracing",
160 ] 161 ]
161 162
162 generated_devtools_api = [] 163 generated_devtools_api = []
164 generated_devtools_api_js = []
163 foreach(domain, devtools_domains) { 165 foreach(domain, devtools_domains) {
166 generated_devtools_api_js +=
167 [ "$target_gen_dir/public/devtools_js/" + domain + ".js" ]
164 generated_devtools_api += [ 168 generated_devtools_api += [
165 "$target_gen_dir/public/devtools/domains/" + domain + ".cc", 169 "$target_gen_dir/public/devtools/domains/" + domain + ".cc",
166 "$target_gen_dir/public/devtools/domains/" + domain + ".h", 170 "$target_gen_dir/public/devtools/domains/" + domain + ".h",
167 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h", 171 "$target_gen_dir/public/devtools/domains/types_" + domain + ".h",
168 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc", 172 "$target_gen_dir/public/devtools/domains/types_" + domain + ".cc",
169 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain + 173 "$target_gen_dir/public/devtools/internal/type_conversions_" + domain +
170 ".h", 174 ".h",
171 "$target_gen_dir/public/devtools/internal/" + 175 "$target_gen_dir/public/devtools/internal/" +
172 "types_forward_declarations_" + domain + ".h", 176 "types_forward_declarations_" + domain + ".h",
173 ] 177 ]
174 } 178 }
175 179
176 action("gen_devtools_client_api") { 180 action("gen_devtools_client_api") {
177 script = "lib/browser/devtools_api/client_api_generator.py" 181 script = "lib/browser/devtools_api/client_api_generator.py"
178 deps = [ 182 deps = [
179 "//third_party/WebKit/Source/core/inspector:protocol_version", 183 "//third_party/WebKit/Source/core/inspector:protocol_version",
180 ] 184 ]
181 inputs = [ 185 inputs = [
182 "$root_gen_dir/blink/core/inspector/protocol.json", 186 "$root_gen_dir/blink/core/inspector/protocol.json",
183 ] 187 ]
184 188
185 outputs = generated_devtools_api 189 outputs = generated_devtools_api + generated_devtools_api_js
186 190
187 sources = [ 191 sources = [
188 "lib/browser/devtools_api/domain_cc.template", 192 "lib/browser/devtools_api/domain_cc.template",
189 "lib/browser/devtools_api/domain_h.template", 193 "lib/browser/devtools_api/domain_h.template",
194 "lib/browser/devtools_api/domain_js.template",
190 "lib/browser/devtools_api/domain_type_conversions_h.template", 195 "lib/browser/devtools_api/domain_type_conversions_h.template",
191 "lib/browser/devtools_api/domain_types_cc.template", 196 "lib/browser/devtools_api/domain_types_cc.template",
192 "lib/browser/devtools_api/domain_types_forward_declarations_h.template", 197 "lib/browser/devtools_api/domain_types_forward_declarations_h.template",
193 "lib/browser/devtools_api/domain_types_h.template", 198 "lib/browser/devtools_api/domain_types_h.template",
194 ] 199 ]
195 200
196 args = [ 201 args = [
197 "--protocol", 202 "--protocol",
198 rebase_path(inputs[0], root_build_dir), 203 rebase_path(inputs[0], root_build_dir),
199 "--output_dir", 204 "--output_dir",
200 rebase_path(target_gen_dir, root_build_dir) + "/public", 205 rebase_path(target_gen_dir, root_build_dir) + "/public",
201 ] 206 ]
202 } 207 }
203 208
209 js_library("js_devtools_bindings_lib") {
210 sources = [ "lib/browser/devtools_api/devtools_connection.js" ] +
211 generated_devtools_api_js
212 deps = []
213 extra_deps = [ ":gen_devtools_client_api" ]
Dan Beam 2017/06/01 16:51:45 errrr, why can't these just be deps?
alex clarke (OOO till 29th) 2017/06/02 08:20:50 The problem is js_binary (incorrectly IMO) assumes
214 }
215
204 if (headless_fontconfig_utils) { 216 if (headless_fontconfig_utils) {
205 static_library("headless_fontconfig_utils") { 217 static_library("headless_fontconfig_utils") {
206 sources = [ 218 sources = [
207 "public/util/fontconfig.cc", 219 "public/util/fontconfig.cc",
208 "public/util/fontconfig.h", 220 "public/util/fontconfig.h",
209 ] 221 ]
210 222
211 deps = [ 223 deps = [
212 "//build/linux:fontconfig", 224 "//build/linux:fontconfig",
213 "//third_party/freetype", 225 "//third_party/freetype",
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
498 "//base", 510 "//base",
499 "//third_party/crashpad/crashpad/handler:crashpad_handler", 511 "//third_party/crashpad/crashpad/handler:crashpad_handler",
500 ] 512 ]
501 513
502 outputs = [ 514 outputs = [
503 "$root_out_dir/Helpers/{{source_file_part}}", 515 "$root_out_dir/Helpers/{{source_file_part}}",
504 ] 516 ]
505 } 517 }
506 } 518 }
507 519
520 if (!is_win) {
521 js_binary("js_devtools_bindings_test") {
522 sources = [
523 "test/bindings_test.js",
524 ]
525 deps = [
526 ":js_devtools_bindings_lib",
527 ]
528 extra_deps = []
529 externs_list = [ "lib/tab_socket_externs.js" ]
530 outputs = [
531 "$target_gen_dir/devtools_bindings_test.js",
532 ]
533 config_files = []
534 closure_flags = [
535 "jscomp_error=checkTypes",
536 "dependency_mode=STRICT",
537
538 # Currently the bindings do not support property renaming so we can't use
539 # ADVANCED_OPTIMIZATIONS here. We could add support via either moving all
540 # the types to externs, or via applying the same renaming to the json
541 # dictionaries sent between C++ and JS. The closure compiler can produce
542 # files which contain those mappings with the appropriate flag.
543 "compilation_level=SIMPLE",
544 "language_out=ES5_STRICT",
545 "entry_point=chromium.BindingsTest",
546 ]
547 }
548
549 grit("headless_browsertest_resources_grit") {
550 source = "headless_browsertest_resources.grd"
551 outputs = [
552 "grit/headless_browsertest_resources.h",
553 "$root_gen_dir/headless/headless_browsertest_resources.pak",
554 ]
555 grit_flags = [
556 "-E",
557 "gen_root=" + rebase_path(root_gen_dir),
558 ]
559 deps = [
560 ":js_devtools_bindings_test",
561 ]
562 resource_ids = "lib/headless_browsertest_resource_ids"
563 }
564
565 repack("headless_browser_tests_pak") {
566 sources = [
567 "$root_gen_dir/headless/headless_browsertest_resources.pak",
568 ]
569 output = "$root_out_dir/headless_browser_tests.pak"
570 deps = [
571 ":headless_browsertest_resources_grit",
572 ]
573 }
574 }
575
508 test("headless_browsertests") { 576 test("headless_browsertests") {
509 sources = [ 577 sources = [
510 "lib/frame_id_browsertest.cc", 578 "lib/frame_id_browsertest.cc",
511 "lib/headless_browser_browsertest.cc", 579 "lib/headless_browser_browsertest.cc",
512 "lib/headless_browser_context_browsertest.cc", 580 "lib/headless_browser_context_browsertest.cc",
513 "lib/headless_devtools_client_browsertest.cc", 581 "lib/headless_devtools_client_browsertest.cc",
514 "lib/headless_web_contents_browsertest.cc", 582 "lib/headless_web_contents_browsertest.cc",
515 "public/util/dom_tree_extractor_browsertest.cc", 583 "public/util/dom_tree_extractor_browsertest.cc",
516 "public/util/flat_dom_tree_extractor_browsertest.cc", 584 "public/util/flat_dom_tree_extractor_browsertest.cc",
517 "test/headless_browser_test.cc", 585 "test/headless_browser_test.cc",
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 deps = [ 619 deps = [
552 ":headless_renderer", 620 ":headless_renderer",
553 "//base", 621 "//base",
554 "//components/crash/content/browser", 622 "//components/crash/content/browser",
555 "//components/security_state/content", 623 "//components/security_state/content",
556 "//content/test:test_support", 624 "//content/test:test_support",
557 "//testing/gmock", 625 "//testing/gmock",
558 "//testing/gtest", 626 "//testing/gtest",
559 ] 627 ]
560 628
629 # The js_binary rule doesn't currently work on windows.
630 if (!is_win) {
631 data += [ "$root_out_dir/headless_browser_tests.pak" ]
632 sources += [ "test/headless_js_bindings_browsertest.cc" ]
633 deps += [ ":headless_browser_tests_pak" ]
634 }
635
561 if (enable_basic_printing) { 636 if (enable_basic_printing) {
562 deps += [ 637 deps += [
563 "//components/printing/browser", 638 "//components/printing/browser",
564 "//pdf", 639 "//pdf",
565 ] 640 ]
566 } 641 }
567 } 642 }
568 643
569 if (is_win) { 644 if (is_win) {
570 # Headless library with only browser dependencies. This is used when no child 645 # Headless library with only browser dependencies. This is used when no child
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 executable("headless_example") { 787 executable("headless_example") {
713 sources = [ 788 sources = [
714 "app/headless_example.cc", 789 "app/headless_example.cc",
715 ] 790 ]
716 791
717 deps = [ 792 deps = [
718 ":headless_shell_lib", 793 ":headless_shell_lib",
719 "//build/config:exe_and_shlib_deps", 794 "//build/config:exe_and_shlib_deps",
720 ] 795 ]
721 } 796 }
OLDNEW
« no previous file with comments | « no previous file | headless/headless_browsertest_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698