mirror of
https://github.com/klzgrad/naiveproxy.git
synced 2024-11-24 14:26:09 +03:00
78 lines
2.6 KiB
Plaintext
78 lines
2.6 KiB
Plaintext
# 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_type: The type of the features to generate, e.g. APIFeature.
|
|
# method_name: The name of the method to generate, e.g. AddChromeAPIFeatures.
|
|
# deps/public_deps/visibility: normal meaning
|
|
template("json_features") {
|
|
assert(defined(invoker.sources),
|
|
"\"sources\" must be defined for the $target_name template.")
|
|
assert(defined(invoker.feature_type),
|
|
"\"feature_type\" must be defined for the $target_name template.")
|
|
assert(defined(invoker.method_name),
|
|
"\"method_name\" must be defined for the $target_name template.")
|
|
feature_type = invoker.feature_type
|
|
method_name = invoker.method_name
|
|
|
|
compiler_root = "//tools/json_schema_compiler"
|
|
base_filename = target_name
|
|
action_name = "${target_name}_json_features"
|
|
source_set_name = target_name
|
|
generated_files = [
|
|
"$target_gen_dir/$base_filename.cc",
|
|
"$target_gen_dir/$base_filename.h",
|
|
]
|
|
|
|
action(action_name) {
|
|
visibility = [ ":$source_set_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_type",
|
|
"$method_name",
|
|
rebase_path(target_gen_dir, root_build_dir),
|
|
"$base_filename",
|
|
] + rebased
|
|
|
|
# Add the deps in for the action as well, in case the deps generate the
|
|
# inputs used by the action.
|
|
forward_variables_from(invoker,
|
|
[
|
|
"deps",
|
|
"public_deps",
|
|
])
|
|
}
|
|
|
|
source_set(target_name) {
|
|
sources = generated_files
|
|
forward_variables_from(invoker,
|
|
[
|
|
"deps",
|
|
"public_deps",
|
|
"visibility",
|
|
])
|
|
if (!defined(public_deps)) {
|
|
public_deps = []
|
|
}
|
|
public_deps += [ ":$action_name" ]
|
|
|
|
# Append a dependency on the extensions system. Headers in this target
|
|
# are included by the feature compiler automatically.
|
|
if (!defined(deps)) {
|
|
deps = []
|
|
}
|
|
deps += [ "//extensions/common" ]
|
|
}
|
|
}
|