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

Side by Side Diff: extensions/generated_extensions_api.gni

Issue 487533005: Add support for references in different paths in apis (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 months 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 | « extensions/common/api/schemas.gypi ('k') | tools/json_schema_compiler/cc_generator.py » ('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 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 # Defines a static library corresponding to the output of schema compiler tools 5 # Defines a static library corresponding to the output of schema compiler tools
6 # over a set of extensions API schemas (IDL or JSON format.) The library target 6 # over a set of extensions API schemas (IDL or JSON format.) The library target
7 # has implicit hard dependencies on all schema files listed by the invoker and 7 # has implicit hard dependencies on all schema files listed by the invoker and
8 # is itself a hard dependency. 8 # is itself a hard dependency.
9 # 9 #
10 # Invocations of this template may use the following variables: 10 # Invocations of this template may use the following variables:
11 # 11 #
12 # sources [required] A list of schema files to be compiled. 12 # sources [required] A list of schema files to be compiled.
13 # 13 #
14 # root_namespace [required] 14 # root_namespace [required]
15 # A Python string substituion pattern used to generate the C++ 15 # A Python string substituion pattern used to generate the C++
16 # namespace for each API. Use %(namespace)s to replace with the API 16 # namespace for each API. Use %(namespace)s to replace with the API
17 # namespace, like "toplevel::%(namespace)s_api". 17 # namespace, like "toplevel::%(namespace)s_api".
18 # 18 #
19 # schema_include_rules [optional]
20 # A list of paths to include when searching for referenced objects,
21 # with the namespace separated by a :.
22 # Example:
23 # [ '/foo/bar:Foo::Bar::%(namespace)s' ]
24 #
19 # schemas [optional, default = false] 25 # schemas [optional, default = false]
20 # Boolean indicating if the schema files should be generated. 26 # Boolean indicating if the schema files should be generated.
21 # 27 #
22 # bundle [optional, default = false] 28 # bundle [optional, default = false]
23 # Boolean indicating if the schema bundle files should be generated. 29 # Boolean indicating if the schema bundle files should be generated.
24 # 30 #
25 # bundle_registration [optional, default = false] 31 # bundle_registration [optional, default = false]
26 # Boolean indicating if the API registration bundle files should be generated. 32 # Boolean indicating if the API registration bundle files should be generated.
27 # 33 #
28 # impl_dir [required if bundle_registration = true, otherwise unused] 34 # impl_dir [required if bundle_registration = true, otherwise unused]
(...skipping 18 matching lines...) Expand all
47 assert(defined(invoker.sources), 53 assert(defined(invoker.sources),
48 "\"sources\" must be defined for the $target_name template.") 54 "\"sources\" must be defined for the $target_name template.")
49 assert(defined(invoker.root_namespace), 55 assert(defined(invoker.root_namespace),
50 "\"root_namespace\" must be defined for the $target_name template.") 56 "\"root_namespace\" must be defined for the $target_name template.")
51 57
52 schemas = defined(invoker.schemas) && invoker.schemas 58 schemas = defined(invoker.schemas) && invoker.schemas
53 bundle = defined(invoker.bundle) && invoker.bundle 59 bundle = defined(invoker.bundle) && invoker.bundle
54 bundle_registration = defined(invoker.bundle_registration) && 60 bundle_registration = defined(invoker.bundle_registration) &&
55 invoker.bundle_registration 61 invoker.bundle_registration
56 62
63 schema_include_rules = ""
64 if (defined(invoker.schema_include_rules)) {
65 schema_include_rules = invoker.schema_include_rules
66 }
67
57 # Keep a copy of the target_name here since it will be trampled 68 # Keep a copy of the target_name here since it will be trampled
58 # in nested targets. 69 # in nested targets.
59 target_visibility = ":$target_name" 70 target_visibility = ":$target_name"
60 71
61 generated_config_name = target_name + "_generated_config" 72 generated_config_name = target_name + "_generated_config"
62 config(generated_config_name) { 73 config(generated_config_name) {
63 include_dirs = [ target_gen_dir ] 74 include_dirs = [ target_gen_dir ]
64 visibility = target_visibility 75 visibility = target_visibility
65 } 76 }
66 77
(...skipping 22 matching lines...) Expand all
89 inputs = compiler_sources 100 inputs = compiler_sources
90 outputs = [ 101 outputs = [
91 "$target_gen_dir/{{source_name_part}}.cc", 102 "$target_gen_dir/{{source_name_part}}.cc",
92 "$target_gen_dir/{{source_name_part}}.h", 103 "$target_gen_dir/{{source_name_part}}.h",
93 ] 104 ]
94 args = [ 105 args = [
95 "{{source}}", 106 "{{source}}",
96 "--root=" + rebase_path("//", root_build_dir), 107 "--root=" + rebase_path("//", root_build_dir),
97 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), 108 "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
98 "--namespace=$root_namespace", 109 "--namespace=$root_namespace",
99 "--generator=cpp" ] 110 "--generator=cpp",
111 "--include-rules=$schema_include_rules" ]
100 visibility = target_visibility 112 visibility = target_visibility
101 } 113 }
102 } 114 }
103 115
104 if (bundle) { 116 if (bundle) {
105 uncompiled_sources = [] 117 uncompiled_sources = []
106 if (defined(invoker.uncompiled_sources)) { 118 if (defined(invoker.uncompiled_sources)) {
107 uncompiled_sources = invoker.uncompiled_sources 119 uncompiled_sources = invoker.uncompiled_sources
108 } 120 }
109 121
110 bundle_generator_schema_name = target_name + "_bundle_generator_schema" 122 bundle_generator_schema_name = target_name + "_bundle_generator_schema"
111 action(bundle_generator_schema_name) { 123 action(bundle_generator_schema_name) {
112 script = compiler_script 124 script = compiler_script
113 inputs = compiler_sources + sources + uncompiled_sources 125 inputs = compiler_sources + sources + uncompiled_sources
114 outputs = [ 126 outputs = [
115 "$target_gen_dir/generated_schemas.cc", 127 "$target_gen_dir/generated_schemas.cc",
116 "$target_gen_dir/generated_schemas.h", 128 "$target_gen_dir/generated_schemas.h",
117 ] 129 ]
118 args = [ 130 args = [
119 "--root=" + rebase_path("//", root_build_dir), 131 "--root=" + rebase_path("//", root_build_dir),
120 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), 132 "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
121 "--namespace=$root_namespace", 133 "--namespace=$root_namespace",
122 "--generator=cpp-bundle-schema", 134 "--generator=cpp-bundle-schema",
123 ] + 135 "--include-rules=$schema_include_rules" ]
124 rebase_path(sources, root_build_dir) + 136 + rebase_path(sources, root_build_dir)
125 rebase_path(uncompiled_sources, root_build_dir) 137 + rebase_path(uncompiled_sources, root_build_dir)
126 } 138 }
127 } 139 }
128 140
129 if (bundle_registration) { 141 if (bundle_registration) {
130 uncompiled_sources = [] 142 uncompiled_sources = []
131 if (defined(invoker.uncompiled_sources)) { 143 if (defined(invoker.uncompiled_sources)) {
132 uncompiled_sources = invoker.uncompiled_sources 144 uncompiled_sources = invoker.uncompiled_sources
133 } 145 }
134 146
135 assert(defined(invoker.impl_dir), 147 assert(defined(invoker.impl_dir),
136 "\"impl_dir\" must be defined for the $target_name template.") 148 "\"impl_dir\" must be defined for the $target_name template.")
137 impl_dir = invoker.impl_dir 149 impl_dir = invoker.impl_dir
138 150
139 bundle_generator_registration_name = target_name + 151 bundle_generator_registration_name = target_name +
140 "_bundle_generator_registration" 152 "_bundle_generator_registration"
141 action(bundle_generator_registration_name) { 153 action(bundle_generator_registration_name) {
142 script = compiler_script 154 script = compiler_script
143 inputs = compiler_sources + sources + uncompiled_sources 155 inputs = compiler_sources + sources + uncompiled_sources
144 outputs = [ 156 outputs = [
145 "$root_gen_dir/$impl_dir/generated_api_registration.cc", 157 "$root_gen_dir/$impl_dir/generated_api_registration.cc",
146 "$root_gen_dir/$impl_dir/generated_api_registration.h", 158 "$root_gen_dir/$impl_dir/generated_api_registration.h",
147 ] 159 ]
148 args = [ 160 args = [
149 "--root=" + rebase_path("//", root_build_dir), 161 "--root=" + rebase_path("//", root_build_dir),
150 "--destdir=" + rebase_path(root_gen_dir, root_build_dir), 162 "--destdir=" + rebase_path(root_gen_dir, root_build_dir),
151 "--namespace=$root_namespace", 163 "--namespace=$root_namespace",
152 "--generator=cpp-bundle-registration", 164 "--generator=cpp-bundle-registration",
153 "--impl-dir=" + rebase_path(impl_dir, "//"), 165 "--impl-dir=" + rebase_path(impl_dir, "//"),
154 ] + 166 "--include-rules=$schema_include_rules" ]
155 rebase_path(sources, root_build_dir) + 167 + rebase_path(sources, root_build_dir)
156 rebase_path(uncompiled_sources, root_build_dir) 168 + rebase_path(uncompiled_sources, root_build_dir)
157 } 169 }
158 } 170 }
159 171
160 source_set(target_name) { 172 source_set(target_name) {
161 sources = [] 173 sources = []
162 deps = [] 174 deps = []
163 175
164 if (schemas) { 176 if (schemas) {
165 sources += get_target_outputs(":$schema_generator_name") 177 sources += get_target_outputs(":$schema_generator_name")
166 deps += [ 178 deps += [
(...skipping 18 matching lines...) Expand all
185 direct_dependent_configs = [ ":$generated_config_name" ] 197 direct_dependent_configs = [ ":$generated_config_name" ]
186 198
187 if (defined(invoker.visibility)) { 199 if (defined(invoker.visibility)) {
188 visibility = invoker.visibility 200 visibility = invoker.visibility
189 } 201 }
190 if (defined(invoker.output_name)) { 202 if (defined(invoker.output_name)) {
191 output_name = invoker.output_name 203 output_name = invoker.output_name
192 } 204 }
193 } 205 }
194 } 206 }
OLDNEW
« no previous file with comments | « extensions/common/api/schemas.gypi ('k') | tools/json_schema_compiler/cc_generator.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698