OLD | NEW |
(Empty) | |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Generates the FeatureProviders files for extension features files. |
| 6 # The following variables are required: |
| 7 # sources: The features.json files to use. |
| 8 # feature_class: The name of the feature class to generate, e.g. APIFeature. |
| 9 # provider_class: The name of the provider class to generate, e.g. |
| 10 # APIFeatureProvider. |
| 11 template("json_features") { |
| 12 assert(defined(invoker.sources), |
| 13 "\"sources\" must be defined for the $target_name template.") |
| 14 assert(defined(invoker.feature_class), |
| 15 "\"feature_class\" must be defined for the $target_name template.") |
| 16 assert(defined(invoker.provider_class), |
| 17 "\"provider_class\" must be defined for the $target_name template.") |
| 18 feature_class = invoker.feature_class |
| 19 provider_class = invoker.provider_class |
| 20 |
| 21 compiler_root = "//tools/json_schema_compiler" |
| 22 target = "${target_name}_json_features" |
| 23 |
| 24 action(target) { |
| 25 sources = invoker.sources |
| 26 script = "$compiler_root/feature_compiler.py" |
| 27 inputs = [] |
| 28 outputs = [ |
| 29 "$target_gen_dir/$target_name.cc", |
| 30 "$target_gen_dir/$target_name.h", |
| 31 ] |
| 32 rebased = rebase_path(invoker.sources, root_build_dir) |
| 33 args = [ |
| 34 ".", |
| 35 "$feature_class", |
| 36 "$provider_class", |
| 37 rebase_path(target_gen_dir, root_build_dir), |
| 38 "$target", |
| 39 ] + rebased |
| 40 } |
| 41 |
| 42 lib_sources = invoker.sources + get_target_outputs(":$target") |
| 43 source_set(target_name) { |
| 44 sources = lib_sources |
| 45 public_deps = [ |
| 46 ":$target", |
| 47 ] |
| 48 } |
| 49 } |
OLD | NEW |