Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright 2016 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 | |
| 5 import("closure_args.gni") | |
| 6 | |
| 7 template("compile_js") { | |
| 8 # This template optionally takes these arguments: | |
| 9 # - sources: a list of all of the source files to be compiled. Required. | |
| 10 # - out_file: a file where the compiled output is written to. The default | |
| 11 # is ${target_gen_dir}/closure/${target_name}.js". | |
| 12 # - script_args: additional arguments to pass to compile.py. | |
| 13 # - closure_args: additional arguments to pass to the Closure compiler. | |
| 14 # - disabled_closure_args: additional arguments dealing with the | |
| 15 # strictness of compilation; Non-strict | |
| 16 # defaults are provided that can be overriden. | |
| 17 # - externs: externs required to compile the sources | |
| 18 # - interfaces: interfaces required to compile the sources | |
| 19 forward_variables_from(invoker, | |
| 20 [ | |
| 21 "source_files", | |
| 22 "deps", | |
| 23 "out_file", | |
| 24 "script_args", | |
| 25 "closure_args", | |
| 26 "runner_args", | |
| 27 "disabled_closure_args", | |
| 28 "externs", | |
| 29 "interfaces", | |
| 30 ]) | |
| 31 | |
| 32 CLOSURE_DIR = "//third_party/closure_compiler" | |
| 33 | |
| 34 action(target_name) { | |
|
Dan Beam
2016/09/07 18:18:05
can we just automatically pref targets if we're do
aberent
2016/09/08 10:29:18
We could, and I wondered about this, but given tha
| |
| 35 assert(defined(source_files)) | |
| 36 | |
| 37 if (!defined(runner_args)) { | |
| 38 runner_args = [ "enable-chrome-pass" ] | |
| 39 } | |
| 40 if (!defined(script_args)) { | |
| 41 script_args = [] | |
| 42 } | |
| 43 if (!defined(closure_args)) { | |
| 44 closure_args = common_closure_args + checking_closure_args | |
| 45 } | |
| 46 if (!defined(disabled_closure_args)) { | |
| 47 disabled_closure_args = default_disabled_closure_args | |
| 48 } | |
| 49 if (!defined(out_file)) { | |
| 50 out_file = "${target_gen_dir}/closure/${target_name}.js" | |
|
Dan Beam
2016/09/07 18:18:05
why is this /closure/ here? was this in the old s
| |
| 51 } | |
| 52 inputs = [ | |
| 53 "${CLOSURE_DIR}/compile.py", | |
| 54 "${CLOSURE_DIR}/processor.py", | |
| 55 "${CLOSURE_DIR}/build/inputs.py", | |
|
Dan Beam
2016/09/07 18:18:05
where are inputs.py or outputs.py invoked? they u
aberent
2016/09/08 10:29:19
Unless I have missed something inputs.py isn't act
Dan Beam
2016/09/08 17:53:21
yeah, I just want to remove from inputs = [] if we
| |
| 56 "${CLOSURE_DIR}/build/outputs.py", | |
| 57 "${CLOSURE_DIR}/compiler/compiler.jar", | |
| 58 "${CLOSURE_DIR}/runner/runner.jar", | |
| 59 ] | |
| 60 | |
| 61 sources = source_files | |
|
Dan Beam
2016/09/07 18:18:05
can we not use sources directly rather than "sourc
aberent
2016/09/08 10:29:19
I tried this originally, and it didn't seem to wor
| |
| 62 | |
| 63 if (defined(externs)) { | |
| 64 EXTERNS_DIR = "${CLOSURE_DIR}/externs" | |
| 65 foreach(extern, externs) { | |
| 66 sources += [ "$EXTERNS_DIR/$extern" ] | |
| 67 } | |
| 68 } | |
| 69 if (defined(interfaces)) { | |
| 70 INTERFACES_DIR = "${CLOSURE_DIR}/interfaces" | |
| 71 foreach(interface, interfaces) { | |
| 72 sources += [ "$INTERFACES_DIR/$interface" ] | |
| 73 } | |
| 74 } | |
| 75 outputs = [ | |
| 76 out_file, | |
| 77 ] | |
| 78 | |
| 79 # assign the sources to data to create run-time list of sources from the | |
| 80 # dependency tree | |
| 81 data = sources | |
| 82 source_list_file = | |
| 83 "${target_gen_dir}/closure/${target_name}_source_list_file" | |
| 84 write_runtime_deps = source_list_file | |
| 85 | |
| 86 script = "${CLOSURE_DIR}/compile2.py" | |
| 87 args = script_args + rebase_path(sources) | |
| 88 args += [ | |
| 89 "--out_file", | |
| 90 rebase_path(out_file), | |
| 91 ] | |
| 92 args += [ | |
| 93 "--gn_source_list_file", | |
| 94 rebase_path(source_list_file), | |
| 95 ] | |
| 96 args += [ "--runner_args" ] + runner_args | |
| 97 args += [ "--closure_args" ] + closure_args + disabled_closure_args | |
| 98 } | |
| 99 } | |
| OLD | NEW |