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

Unified Diff: tools/json_schema_compiler/externs.gni

Issue 2583573002: [Closure Externs] Generate closure compiler externs as part of compile
Patch Set: missing Created 4 years 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
Index: tools/json_schema_compiler/externs.gni
diff --git a/tools/json_schema_compiler/externs.gni b/tools/json_schema_compiler/externs.gni
new file mode 100644
index 0000000000000000000000000000000000000000..f3e21248e93c69a4ce8137cd239aea26216d1166
--- /dev/null
+++ b/tools/json_schema_compiler/externs.gni
@@ -0,0 +1,55 @@
+# 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.
+
+template("closure_externs") {
+ assert(defined(invoker.sources),
+ "\"sources\" must be defined for the $target_name template.")
+ print("running closure")
+
+ compiler_root = "//tools/json_schema_compiler"
+ compiler_script = "$compiler_root/compiler.py"
+ compiler_sources = [
+ "$compiler_root/code.py",
+ "$compiler_root/compiler.py",
+ "$compiler_root/idl_schema.py",
+ "$compiler_root/js_externs_generator.py",
+ "$compiler_root/model.py",
+ ]
+
+ action_name = "${target_name}_externs"
+ action_foreach(action_name) {
+ print("running")
+ print("gen: " + root_gen_dir)
+ print("build: " + root_build_dir)
+ print("source name: {{source_name_part}}")
+ foreach(i, invoker.sources) {
+ print(i)
+ }
+ sources = invoker.sources
+ script = compiler_script
+ inputs = compiler_sources
+ outputs = [
+ "$target_gen_dir/{{source_name_part}}.js",
+ ]
+ print("outputs")
+ foreach(o, outputs) {
+ print(o)
+ }
+ args = [
+ "{{source}}",
+ "--root=" + rebase_path("//", root_build_dir),
+ "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
+ "--output-dir=third_party/closure_compiler/externs",
+ "--generator=externs",
+ ]
+ }
+
+ source_set(target_name) {
+ sources = invoker.sources
+ if (!defined(public_deps)) {
+ public_deps = []
+ }
+ public_deps += [ ":$action_name" ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698