Chromium Code Reviews| Index: build/json_features.gni |
| diff --git a/build/json_features.gni b/build/json_features.gni |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..0170877665816d8fae983bb552a73f344709d12d |
| --- /dev/null |
| +++ b/build/json_features.gni |
| @@ -0,0 +1,49 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
|
Dirk Pranke
2016/07/14 23:16:36
Where is this template actually going to be used?
Devlin
2016/07/15 16:19:07
This is going to be used from //chrome and //exten
Dirk Pranke
2016/07/15 19:16:37
including //tools/json_schema_compiler is totally
|
| +# 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" |
| + compiler_script = "$compiler_root/feature_compiler.py" |
| + target = "${target_name}_json_features" |
| + |
| + action(target) { |
| + sources = invoker.sources |
| + script = compiler_script |
|
Dirk Pranke
2016/07/14 23:16:35
I would get rid of compiler script and just refer
Devlin
2016/07/15 16:19:07
Done.
|
| + 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") |
| + lib_public_deps = [ ":$target" ] |
| + source_set(target_name) { |
| + sources = lib_sources |
| + public_deps = lib_public_deps |
|
Dirk Pranke
2016/07/14 23:16:36
similarly, just inline the values here.
Devlin
2016/07/15 16:19:07
This seems to work for public deps, but trying to
Dirk Pranke
2016/07/15 19:16:37
Did you drop the "$" ? I think (but am not positiv
Devlin
2016/07/15 21:03:01
Works now using generated_files var.
|
| + } |
| +} |