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

Unified Diff: tools/json_schema_compiler/json_features.gni

Issue 2151583003: [Extensions] Add extension feature generation code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Compile Fix Created 4 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/json_schema_compiler/json_features.gni
diff --git a/tools/json_schema_compiler/json_features.gni b/tools/json_schema_compiler/json_features.gni
new file mode 100644
index 0000000000000000000000000000000000000000..cdf6c33a30a325550891f72d9e8fb7837cf58dce
--- /dev/null
+++ b/tools/json_schema_compiler/json_features.gni
@@ -0,0 +1,53 @@
+# 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.
+
+# Generates the FeatureProviders files for extension features files.
+# The following variables are required:
+# sources: The features.json files to use.
+# feature_class: The name of the feature class to generate, e.g. APIFeature.
+# provider_class: The name of the provider class to generate, e.g.
+# APIFeatureProvider.
+template("json_features") {
+ assert(defined(invoker.sources),
+ "\"sources\" must be defined for the $target_name template.")
+ assert(defined(invoker.feature_class),
+ "\"feature_class\" must be defined for the $target_name template.")
+ assert(defined(invoker.provider_class),
+ "\"provider_class\" must be defined for the $target_name template.")
+ feature_class = invoker.feature_class
+ provider_class = invoker.provider_class
+
+ compiler_root = "//tools/json_schema_compiler"
+ base_filename = target_name
+ action_name = "${target_name}_json_features"
+ generated_files = [
+ "$target_gen_dir/$base_filename.cc",
+ "$target_gen_dir/$base_filename.h",
+ ]
+
+ action(action_name) {
+ sources = invoker.sources
+ script = "$compiler_root/feature_compiler.py"
+ inputs = [
+ "$compiler_root/code.py",
+ "$compiler_root/json_parse.py",
+ ]
+ outputs = generated_files
+ rebased = rebase_path(sources, root_build_dir)
+ args = [
+ ".",
+ "$feature_class",
+ "$provider_class",
+ rebase_path(target_gen_dir, root_build_dir),
+ "$base_filename",
+ ] + rebased
+ }
+
+ source_set(target_name) {
+ sources = generated_files
+ public_deps = [
+ ":$action_name",
+ ]
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698