Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Side by Side Diff: tools/json_schema_compiler/json_features.gni

Issue 2479593006: Move enable extensions define to a build flag. (Closed)
Patch Set: Merge Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/grit/grit_rule.gni ('k') | tools/json_schema_compiler/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 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 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # Generates the FeatureProviders files for extension features files. 5 # Generates the FeatureProviders files for extension features files.
6 # The following variables are required: 6 # The following variables are required:
7 # sources: The features.json files to use. 7 # sources: The features.json files to use.
8 # feature_class: The name of the feature class to generate, e.g. APIFeature. 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. 9 # provider_class: The name of the provider class to generate, e.g.
10 # APIFeatureProvider. 10 # APIFeatureProvider.
11 # deps/public_deps/visibility: normal meaning
11 template("json_features") { 12 template("json_features") {
12 assert(defined(invoker.sources), 13 assert(defined(invoker.sources),
13 "\"sources\" must be defined for the $target_name template.") 14 "\"sources\" must be defined for the $target_name template.")
14 assert(defined(invoker.feature_class), 15 assert(defined(invoker.feature_class),
15 "\"feature_class\" must be defined for the $target_name template.") 16 "\"feature_class\" must be defined for the $target_name template.")
16 assert(defined(invoker.provider_class), 17 assert(defined(invoker.provider_class),
17 "\"provider_class\" must be defined for the $target_name template.") 18 "\"provider_class\" must be defined for the $target_name template.")
18 feature_class = invoker.feature_class 19 feature_class = invoker.feature_class
19 provider_class = invoker.provider_class 20 provider_class = invoker.provider_class
20 21
21 compiler_root = "//tools/json_schema_compiler" 22 compiler_root = "//tools/json_schema_compiler"
22 base_filename = target_name 23 base_filename = target_name
23 action_name = "${target_name}_json_features" 24 action_name = "${target_name}_json_features"
25 source_set_name = target_name
24 generated_files = [ 26 generated_files = [
25 "$target_gen_dir/$base_filename.cc", 27 "$target_gen_dir/$base_filename.cc",
26 "$target_gen_dir/$base_filename.h", 28 "$target_gen_dir/$base_filename.h",
27 ] 29 ]
28 30
29 action(action_name) { 31 action(action_name) {
32 visibility = [ ":$source_set_name" ]
30 sources = invoker.sources 33 sources = invoker.sources
31 script = "$compiler_root/feature_compiler.py" 34 script = "$compiler_root/feature_compiler.py"
32 inputs = [ 35 inputs = [
33 "$compiler_root/code.py", 36 "$compiler_root/code.py",
34 "$compiler_root/json_parse.py", 37 "$compiler_root/json_parse.py",
35 ] 38 ]
36 outputs = generated_files 39 outputs = generated_files
37 rebased = rebase_path(sources, root_build_dir) 40 rebased = rebase_path(sources, root_build_dir)
38 args = [ 41 args = [
39 ".", 42 ".",
40 "$feature_class", 43 "$feature_class",
41 "$provider_class", 44 "$provider_class",
42 rebase_path(target_gen_dir, root_build_dir), 45 rebase_path(target_gen_dir, root_build_dir),
43 "$base_filename", 46 "$base_filename",
44 ] + rebased 47 ] + rebased
48
49 # Add the deps in for the action as well, in case the deps generate the
50 # inputs used by the action.
51 forward_variables_from(invoker,
52 [
53 "deps",
54 "public_deps",
55 ])
56
57 # Append a dependency on the extensions system. Headers in this target
58 # are included by the feature compiler automatically.
59 if (!defined(deps)) {
60 deps = []
61 }
62 deps += [ "//extensions/common" ]
45 } 63 }
46 64
47 source_set(target_name) { 65 source_set(target_name) {
48 sources = generated_files 66 sources = generated_files
49 public_deps = [ 67 forward_variables_from(invoker,
50 ":$action_name", 68 [
51 ] 69 "deps",
70 "public_deps",
71 "visibility",
72 ])
73 if (!defined(public_deps)) {
74 public_deps = []
75 }
76 public_deps += [ ":$action_name" ]
52 } 77 }
53 } 78 }
OLDNEW
« no previous file with comments | « tools/grit/grit_rule.gni ('k') | tools/json_schema_compiler/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698