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

Unified Diff: third_party/closure_compiler/compile_js2.gni

Issue 2247353004: GN files for running Closure Compiler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add script to generate polymer gn files Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/closure_compiler/compile2.py ('k') | third_party/closure_compiler/run_compiler » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/closure_compiler/compile_js2.gni
diff --git a/third_party/closure_compiler/compile_js2.gni b/third_party/closure_compiler/compile_js2.gni
new file mode 100644
index 0000000000000000000000000000000000000000..007cefe94a5c8215040210371a35a901fa973dfd
--- /dev/null
+++ b/third_party/closure_compiler/compile_js2.gni
@@ -0,0 +1,99 @@
+# Copyright 2016 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+import("closure_args.gni")
+
+template("compile_js") {
+ # This template optionally takes these arguments:
+ # - sources: a list of all of the source files to be compiled. Required.
+ # - out_file: a file where the compiled output is written to. The default
+ # is ${target_gen_dir}/closure/${target_name}.js".
+ # - script_args: additional arguments to pass to compile.py.
+ # - closure_args: additional arguments to pass to the Closure compiler.
+ # - disabled_closure_args: additional arguments dealing with the
+ # strictness of compilation; Non-strict
+ # defaults are provided that can be overriden.
+ # - externs: externs required to compile the sources
+ # - interfaces: interfaces required to compile the sources
+ forward_variables_from(invoker,
+ [
+ "source_files",
+ "deps",
+ "out_file",
+ "script_args",
+ "closure_args",
+ "runner_args",
+ "disabled_closure_args",
+ "externs",
+ "interfaces",
+ ])
+
+ CLOSURE_DIR = "//third_party/closure_compiler"
+
+ action(target_name) {
+ assert(defined(source_files))
+
+ if (!defined(runner_args)) {
+ runner_args = [ "enable-chrome-pass" ]
+ }
+ if (!defined(script_args)) {
+ script_args = []
+ }
+ if (!defined(closure_args)) {
+ closure_args = common_closure_args + checking_closure_args
+ }
+ if (!defined(disabled_closure_args)) {
+ disabled_closure_args = default_disabled_closure_args
+ }
+ if (!defined(out_file)) {
+ out_file = "${target_gen_dir}/closure/${target_name}.js"
+ }
+ inputs = [
+ "${CLOSURE_DIR}/compile.py",
+ "${CLOSURE_DIR}/processor.py",
+ "${CLOSURE_DIR}/build/inputs.py",
+ "${CLOSURE_DIR}/build/outputs.py",
+ "${CLOSURE_DIR}/compiler/compiler.jar",
+ "${CLOSURE_DIR}/runner/runner.jar",
+ ]
+
+ sources = source_files
+
+ if (defined(externs)) {
+ EXTERNS_DIR = "${CLOSURE_DIR}/externs"
+ foreach(extern, externs) {
+ sources += [ "$EXTERNS_DIR/$extern" ]
+ }
+ }
+ if (defined(interfaces)) {
+ INTERFACES_DIR = "${CLOSURE_DIR}/interfaces"
+ foreach(interface, interfaces) {
+ sources += [ "$INTERFACES_DIR/$interface" ]
+ }
+ }
+ outputs = [
+ out_file,
+ ]
+
+ # assign the sources to data to create run-time list of sources from the
+ # dependency tree
+ data = sources
+ source_list_file =
+ "${target_gen_dir}/closure/${target_name}_source_list_file"
+ write_runtime_deps = source_list_file
+
+ script = "${CLOSURE_DIR}/compile2.py"
+ args = script_args + rebase_path(sources)
+ args += [
+ "--out_file",
+ rebase_path(out_file),
+ ]
+ args += [
+ "--gn_source_list_file",
+ rebase_path(source_list_file),
+ ]
+ args += [ "--runner_args" ] + runner_args
+ args += [ "--closure_args" ] + closure_args + disabled_closure_args
+ }
+}
« no previous file with comments | « third_party/closure_compiler/compile2.py ('k') | third_party/closure_compiler/run_compiler » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698