Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # 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
| |
| 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 compiler_script = "$compiler_root/feature_compiler.py" | |
| 23 target = "${target_name}_json_features" | |
| 24 | |
| 25 action(target) { | |
| 26 sources = invoker.sources | |
| 27 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.
| |
| 28 inputs = [] | |
| 29 outputs = [ | |
| 30 "$target_gen_dir/$target_name.cc", | |
| 31 "$target_gen_dir/$target_name.h", | |
| 32 ] | |
| 33 rebased = rebase_path(invoker.sources, root_build_dir) | |
| 34 args = [ | |
| 35 ".", | |
| 36 "$feature_class", | |
| 37 "$provider_class", | |
| 38 rebase_path(target_gen_dir, root_build_dir), | |
| 39 "$target", | |
| 40 ] + rebased | |
| 41 } | |
| 42 | |
| 43 lib_sources = invoker.sources + get_target_outputs(":$target") | |
| 44 lib_public_deps = [ ":$target" ] | |
| 45 source_set(target_name) { | |
| 46 sources = lib_sources | |
| 47 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.
| |
| 48 } | |
| 49 } | |
| OLD | NEW |