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

Unified Diff: tools/variations/fieldtrial_to_struct.gni

Issue 1209743002: Generate a static struct from fieldtrial_testing_config (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@codegen_nested_structs
Patch Set: add another unittest Created 5 years, 5 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
Index: tools/variations/fieldtrial_to_struct.gni
diff --git a/tools/json_to_struct/json_to_struct.gni b/tools/variations/fieldtrial_to_struct.gni
similarity index 69%
copy from tools/json_to_struct/json_to_struct.gni
copy to tools/variations/fieldtrial_to_struct.gni
index 814392258b5beb7675f6a4e6271ce8bac320bff7..63b6900600e7ba682f755775d89d73dae47cd708 100644
--- a/tools/json_to_struct/json_to_struct.gni
+++ b/tools/variations/fieldtrial_to_struct.gni
@@ -1,8 +1,8 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
+# Copyright 2015 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.
+# found in the LICENSE file.
-# Converts a .json file to a C++ struct.
+# Converts a fieldtrial_testing_config.json file to a C++ struct.
#
# Variables:
#
@@ -15,28 +15,37 @@
# namespace (required)
# Namespace name to put result in.
#
+# output (required)
+# Name of the output file.
+#
+# out_dir (required)
+# Name of the output directory.
+#
# visibility (optional)
# Normal meaning.
-template("json_to_struct") {
+template("fieldtrial_to_struct") {
assert(defined(invoker.source), "source required in $target_name")
assert(defined(invoker.schema_file), "schema_file required in $target_name")
assert(defined(invoker.namespace), "namespace required in $target_name")
+ assert(defined(invoker.output), "output required in $target_name")
+ assert(defined(invoker.out_dir), "out_dir required in $target_name")
action_name = target_name + "_action"
source_set_name = target_name
action(action_name) {
visibility = [ ":$source_set_name" ]
- script = "//tools/json_to_struct/json_to_struct.py"
+ script = "//tools/variations/fieldtrial_to_struct.py"
inputs = [
"//tools/json_to_struct/element_generator.py",
+ "//tools/json_to_struct/json_to_struct.py",
"//tools/json_to_struct/struct_generator.py",
invoker.source,
]
- out_dir = get_path_info(invoker.source, "gen_dir")
- out_name = get_path_info(invoker.source, "name")
+ out_dir = get_path_info(invoker.out_dir, "gen_dir")
+ out_name = invoker.output
outputs = [
"$out_dir/$out_name.cc",
"$out_dir/$out_name.h",
@@ -47,6 +56,7 @@ template("json_to_struct") {
"--destbase=" + rebase_path(out_dir, root_build_dir),
"--namespace=" + invoker.namespace,
"--schema=" + rebase_path(invoker.schema_file, root_build_dir),
+ "--output=" + invoker.output,
]
}

Powered by Google App Engine
This is Rietveld 408576698