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..017accfca242c24c3d338eb5bb832a7e0c7de4b0 |
--- /dev/null |
+++ b/tools/json_schema_compiler/json_features.gni |
@@ -0,0 +1,49 @@ |
+# 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" |
+ target = "${target_name}_json_features" |
+ |
+ action(target) { |
+ sources = invoker.sources |
+ script = "$compiler_root/feature_compiler.py" |
+ inputs = [] |
+ outputs = [ |
+ "$target_gen_dir/$target_name.cc", |
+ "$target_gen_dir/$target_name.h", |
+ ] |
+ rebased = rebase_path(invoker.sources, root_build_dir) |
+ args = [ |
+ ".", |
+ "$feature_class", |
+ "$provider_class", |
+ rebase_path(target_gen_dir, root_build_dir), |
+ "$target", |
+ ] + rebased |
+ } |
+ |
+ lib_sources = invoker.sources + get_target_outputs(":$target") |
+ source_set(target_name) { |
+ sources = lib_sources |
+ public_deps = [ |
+ ":$target", |
+ ] |
+ } |
+} |