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

Side by Side Diff: third_party/closure_compiler/compile_js.gni

Issue 2902583002: Add some closureised JS bindings for DevTools for use by headless embedder (Closed)
Patch Set: Try and fix python test 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 | « headless/test/headless_js_bindings_browsertest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2017 The Chromium Authors. All rights reserved. 1 # Copyright 2017 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("//third_party/closure_compiler/closure_args.gni") 5 import("//third_party/closure_compiler/closure_args.gni")
6 6
7 script_path = "//third_party/closure_compiler" 7 script_path = "//third_party/closure_compiler"
8 compiler_path = "$script_path/compiler/compiler.jar" 8 compiler_path = "$script_path/compiler/compiler.jar"
9 9
10 # Defines a target that creates an ordering for .js files to be used by 10 # Defines a target that creates an ordering for .js files to be used by
11 # js_binary to compile. 11 # js_binary to compile.
12 # 12 #
13 # Variables: 13 # Variables:
14 # sources: 14 # sources:
15 # List of Javascript files to include in the library 15 # List of Javascript files to include in the library
16 # 16 #
17 # deps: 17 # deps:
18 # List of js_library targets to depend on 18 # List of js_library targets to depend on
19 # 19 #
20 # extra_deps:
21 # List of any other rules to depend on. E.g. a rule that generates js source
22 # files
23 #
20 # Example: 24 # Example:
21 # js_library("apple_tree") { 25 # js_library("apple_tree") {
22 # sources = ["tree_main.js"] 26 # sources = ["tree_main.js"]
23 # deps = [ 27 # deps = [
24 # ":branch", 28 # ":branch",
25 # ":trunk", 29 # ":trunk",
26 # ":root", 30 # ":root",
27 # ] 31 # ]
28 # } 32 # }
29 33
30 template("js_library") { 34 template("js_library") {
31 assert(defined(invoker.sources) || defined(invoker.deps), 35 assert(defined(invoker.sources) || defined(invoker.deps),
32 "Need sources or deps in $target_name for js_library") 36 "Need sources or deps in $target_name for js_library")
33 action(target_name) { 37 action(target_name) {
34 script = "$script_path/js_library.py" 38 script = "$script_path/js_library.py"
35 forward_variables_from(invoker, 39 forward_variables_from(invoker,
36 [ 40 [
37 "sources", 41 "sources",
38 "deps", 42 "deps",
43 "extra_deps",
39 ]) 44 ])
40 output_file = "$target_gen_dir/$target_name.js_library" 45 output_file = "$target_gen_dir/$target_name.js_library"
41 outputs = [ 46 outputs = [
42 output_file, 47 output_file,
43 ] 48 ]
44 args = [ "--output" ] + [ rebase_path(output_file, root_build_dir) ] 49 args = [ "--output" ] + [ rebase_path(output_file, root_build_dir) ]
45 if (defined(sources)) { 50 if (defined(sources)) {
46 args += [ "--sources" ] + rebase_path(sources, root_build_dir) 51 args += [ "--sources" ] + rebase_path(sources, root_build_dir)
47 } 52 }
48 if (defined(deps)) { 53 if (defined(deps)) {
49 args += [ "--deps" ] 54 args += [ "--deps" ]
50 foreach(dep, deps) { 55 foreach(dep, deps) {
51 # Get the output path for each dep 56 # Get the output path for each dep
52 dep_gen_dir = get_label_info(dep, "target_gen_dir") 57 dep_gen_dir = get_label_info(dep, "target_gen_dir")
53 dep_name = get_label_info(dep, "name") 58 dep_name = get_label_info(dep, "name")
54 dep_output_path = "$dep_gen_dir/$dep_name.js_library" 59 dep_output_path = "$dep_gen_dir/$dep_name.js_library"
55 args += [ rebase_path(dep_output_path, root_build_dir) ] 60 args += [ rebase_path(dep_output_path, root_build_dir) ]
56 } 61 }
57 } 62 }
63 if (defined(extra_deps)) {
64 if (!defined(deps)) {
65 deps = []
66 }
67 deps += extra_deps
68 }
58 } 69 }
59 } 70 }
60 71
61 # Defines a target that compiles javascript files using the Closure compiler. 72 # Defines a target that compiles javascript files using the Closure compiler.
62 # This will produce a minified javascript output file. Additional checks and 73 # This will produce a minified javascript output file. Additional checks and
63 # optimizations can be configured using the closure_flags attribute. 74 # optimizations can be configured using the closure_flags attribute.
64 # 75 #
65 # Variables: 76 # Variables:
66 # sources: 77 # sources:
67 # List of .js files to compile 78 # List of .js files to compile
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 if (defined(closure_flags)) { 167 if (defined(closure_flags)) {
157 args += closure_flags 168 args += closure_flags
158 } 169 }
159 if (defined(externs_list)) { 170 if (defined(externs_list)) {
160 args += [ "--externs" ] 171 args += [ "--externs" ]
161 args += rebase_path(externs_list, root_build_dir) 172 args += rebase_path(externs_list, root_build_dir)
162 sources += externs_list 173 sources += externs_list
163 } 174 }
164 } 175 }
165 } 176 }
OLDNEW
« no previous file with comments | « headless/test/headless_js_bindings_browsertest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698