OLD | NEW |
---|---|
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 mojom_generator_root = "//mojo/public/tools/bindings" | 5 mojom_generator_root = "//mojo/public/tools/bindings" |
6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" | 6 mojom_generator_script = "$mojom_generator_root/mojom_bindings_generator.py" |
7 mojom_generator_sources = [ | 7 mojom_generator_sources = [ |
8 "$mojom_generator_root/generators/mojom_cpp_generator.py", | 8 "$mojom_generator_root/generators/mojom_cpp_generator.py", |
9 "$mojom_generator_root/generators/mojom_js_generator.py", | 9 "$mojom_generator_root/generators/mojom_js_generator.py", |
10 "$mojom_generator_root/generators/mojom_java_generator.py", | 10 "$mojom_generator_root/generators/mojom_java_generator.py", |
(...skipping 19 matching lines...) Expand all Loading... | |
30 # input file. | 30 # input file. |
31 # | 31 # |
32 # Parameters: | 32 # Parameters: |
33 # | 33 # |
34 # sources (optional if one of the deps sets listed below is present) | 34 # sources (optional if one of the deps sets listed below is present) |
35 # List of source .mojom files to compile. | 35 # List of source .mojom files to compile. |
36 # | 36 # |
37 # deps (optional) | 37 # deps (optional) |
38 # Note: this can contain only other mojom targets. | 38 # Note: this can contain only other mojom targets. |
39 # | 39 # |
40 # DEPRECATED: This is synonymous with public_deps because all mojom | |
41 # dependencies must be public by design. Please use public_deps. | |
jam
2016/02/01 17:53:48
is there a bug on removing this? if not, please cr
| |
42 # | |
40 # public_deps (optional) | 43 # public_deps (optional) |
41 # Note: this can contain only other mojom targets. | 44 # Note: this can contain only other mojom targets. |
42 # | 45 # |
43 # import_dirs (optional) | 46 # import_dirs (optional) |
44 # List of import directories that will get added when processing sources. | 47 # List of import directories that will get added when processing sources. |
45 # | 48 # |
46 # with_environment (optional) | 49 # with_environment (optional) |
47 # Set to |false| to omit an implicit bindings dependency on the Chromium | 50 # Set to |false| to omit an implicit bindings dependency on the Chromium |
48 # Mojo environment implementation. Defaults to |true| and in general | 51 # Mojo environment implementation. Defaults to |true| and in general |
49 # should only be overridden by mojom targets within the Mojo EDK. | 52 # should only be overridden by mojom targets within the Mojo EDK. |
50 # | 53 # |
51 # typemaps (optional) | 54 # typemaps (optional) |
52 # A list of typemap files to apply during bindings generation. | 55 # A list of typemap files to apply during bindings generation. |
53 # | 56 # |
57 # typemap_deps (optional) | |
58 # A list of public dependencies needed to support active typemaps. | |
59 # | |
54 # variant (optional) | 60 # variant (optional) |
55 # A variant name to apply to generated bindings. Variant influences | 61 # A variant name to apply to generated bindings. Variant influences |
56 # generated source filenames as wells the symbols they define. | 62 # generated source filenames as wells the symbols they define. |
57 # | 63 # |
58 # testonly (optional) | 64 # testonly (optional) |
59 # | 65 # |
60 # visibility (optional) | 66 # visibility (optional) |
61 template("mojom") { | 67 template("mojom") { |
62 assert( | 68 assert( |
63 defined(invoker.sources) || defined(invoker.deps) || | 69 defined(invoker.sources) || defined(invoker.deps) || |
64 defined(invoker.public_deps), | 70 defined(invoker.public_deps), |
65 "\"sources\" or \"deps\" must be defined for the $target_name template.") | 71 "\"sources\" or \"deps\" must be defined for the $target_name template.") |
66 | 72 |
67 cpp_sources_suffix = "cpp_sources" | 73 cpp_sources_suffix = "cpp_sources" |
68 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" | 74 cpp_sources_target_name = "${target_name}_${cpp_sources_suffix}" |
75 cpp_only = false | |
69 if (defined(invoker.sources)) { | 76 if (defined(invoker.sources)) { |
70 if (defined(invoker.variant)) { | 77 if (defined(invoker.variant)) { |
71 variant = invoker.variant | 78 variant = invoker.variant |
79 cpp_only = true | |
72 generator_cpp_outputs = [ | 80 generator_cpp_outputs = [ |
73 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc", | 81 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.cc", |
74 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h", | 82 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}.h", |
75 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h", | 83 "{{source_gen_dir}}/{{source_name_part}}.mojom-${variant}-internal.h", |
76 ] | 84 ] |
77 generator_js_outputs = [] | |
78 generator_java_outputs = [] | |
79 } else { | 85 } else { |
80 generator_cpp_outputs = [ | 86 generator_cpp_outputs = [ |
81 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", | 87 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", |
82 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | 88 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", |
83 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | 89 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", |
84 ] | 90 ] |
85 generator_js_outputs = | |
86 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | |
87 generator_java_outputs = | |
88 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | |
89 } | 91 } |
90 } | 92 } |
91 | 93 |
94 if (cpp_only) { | |
95 generator_js_outputs = [] | |
96 generator_java_outputs = [] | |
97 } else { | |
98 generator_js_outputs = | |
99 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | |
100 generator_java_outputs = | |
101 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | |
102 } | |
103 | |
92 if (defined(invoker.sources)) { | 104 if (defined(invoker.sources)) { |
93 generator_target_name = target_name + "__generator" | 105 generator_target_name = target_name + "__generator" |
94 action_foreach(generator_target_name) { | 106 action_foreach(generator_target_name) { |
95 script = mojom_generator_script | 107 script = mojom_generator_script |
96 inputs = mojom_generator_sources | 108 inputs = mojom_generator_sources |
97 sources = invoker.sources | 109 sources = invoker.sources |
98 deps = [ | 110 deps = [ |
99 "//mojo/public/tools/bindings:precompile_templates", | 111 "//mojo/public/tools/bindings:precompile_templates", |
100 ] | 112 ] |
101 outputs = | 113 outputs = |
(...skipping 14 matching lines...) Expand all Loading... | |
116 | 128 |
117 if (defined(invoker.import_dirs)) { | 129 if (defined(invoker.import_dirs)) { |
118 foreach(import_dir, invoker.import_dirs) { | 130 foreach(import_dir, invoker.import_dirs) { |
119 args += [ | 131 args += [ |
120 "-I", | 132 "-I", |
121 rebase_path(import_dir, root_build_dir), | 133 rebase_path(import_dir, root_build_dir), |
122 ] | 134 ] |
123 } | 135 } |
124 } | 136 } |
125 | 137 |
126 if (defined(invoker.variant)) { | 138 if (cpp_only) { |
127 args += [ | 139 args += [ |
128 "--variant", | |
129 invoker.variant, | |
130 "-g", | 140 "-g", |
131 "c++", | 141 "c++", |
132 ] | 142 ] |
133 } else { | 143 } else { |
134 args += [ | 144 args += [ |
135 "-g", | 145 "-g", |
136 "c++,javascript,java", | 146 "c++,javascript,java", |
137 ] | 147 ] |
138 } | 148 } |
139 | 149 |
150 if (defined(invoker.variant)) { | |
151 args += [ | |
152 "--variant", | |
153 invoker.variant, | |
154 ] | |
155 } | |
156 | |
140 if (defined(invoker.typemaps)) { | 157 if (defined(invoker.typemaps)) { |
141 foreach(typemap, invoker.typemaps) { | 158 foreach(typemap, invoker.typemaps) { |
142 args += [ | 159 args += [ |
143 "--typemap", | 160 "--typemap", |
144 rebase_path(typemap, root_build_dir), | 161 rebase_path(typemap, root_build_dir), |
145 ] | 162 ] |
146 } | 163 } |
164 inputs += invoker.typemaps | |
147 } | 165 } |
148 } | 166 } |
149 } | 167 } |
150 | 168 |
151 source_set(target_name) { | 169 source_set(target_name) { |
152 if (defined(invoker.visibility)) { | 170 if (defined(invoker.visibility)) { |
153 visibility = invoker.visibility | 171 visibility = invoker.visibility |
154 } | 172 } |
155 if (defined(invoker.testonly)) { | 173 if (defined(invoker.testonly)) { |
156 testonly = invoker.testonly | 174 testonly = invoker.testonly |
157 } | 175 } |
158 if (defined(invoker.sources) && !defined(invoker.variant)) { | 176 if (defined(invoker.sources) && !defined(invoker.variant)) { |
159 data = process_file_template(invoker.sources, generator_js_outputs) | 177 data = process_file_template(invoker.sources, generator_js_outputs) |
160 } | 178 } |
161 | 179 |
162 public_deps = [ | 180 public_deps = [ |
163 "//mojo/public/cpp/bindings", | 181 "//mojo/public/cpp/bindings", |
164 ] | 182 ] |
165 if (defined(invoker.sources)) { | 183 if (defined(invoker.sources)) { |
166 public_deps += [ ":${cpp_sources_target_name}" ] | 184 public_deps += [ ":${cpp_sources_target_name}" ] |
167 } | 185 } |
186 if (defined(invoker.deps)) { | |
187 public_deps += invoker.deps | |
188 } | |
168 if (defined(invoker.public_deps)) { | 189 if (defined(invoker.public_deps)) { |
169 public_deps += invoker.public_deps | 190 public_deps += invoker.public_deps |
170 } | 191 } |
192 if (defined(invoker.typemap_deps)) { | |
193 public_deps += invoker.typemap_deps | |
194 } | |
171 | 195 |
172 deps = [] | 196 deps = [] |
173 if (defined(invoker.sources)) { | 197 if (defined(invoker.sources)) { |
174 public_deps += [ ":$generator_target_name" ] | 198 public_deps += [ ":$generator_target_name" ] |
175 } | 199 } |
176 if (defined(invoker.deps)) { | |
177 deps += invoker.deps | |
178 } | |
179 } | 200 } |
180 | 201 |
181 all_deps = [] | 202 all_deps = [] |
182 if (defined(invoker.deps)) { | 203 if (defined(invoker.deps)) { |
183 all_deps += invoker.deps | 204 all_deps += invoker.deps |
184 } | 205 } |
185 if (defined(invoker.public_deps)) { | 206 if (defined(invoker.public_deps)) { |
186 all_deps += invoker.public_deps | 207 all_deps += invoker.public_deps |
187 } | 208 } |
188 | 209 |
(...skipping 18 matching lines...) Expand all Loading... | |
207 # on mojo/public/cpp/bindings. No external targets should depend directly on | 228 # on mojo/public/cpp/bindings. No external targets should depend directly on |
208 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources | 229 # this target *except* mojo/public/cpp/bindings and other *_cpp_sources |
209 # targets. | 230 # targets. |
210 source_set(cpp_sources_target_name) { | 231 source_set(cpp_sources_target_name) { |
211 if (defined(invoker.testonly)) { | 232 if (defined(invoker.testonly)) { |
212 testonly = invoker.testonly | 233 testonly = invoker.testonly |
213 } | 234 } |
214 sources = process_file_template(invoker.sources, generator_cpp_outputs) | 235 sources = process_file_template(invoker.sources, generator_cpp_outputs) |
215 deps = [ | 236 deps = [ |
216 ":$generator_target_name", | 237 ":$generator_target_name", |
217 "//base", | |
218 "//mojo/public/interfaces/bindings:bindings__generator", | 238 "//mojo/public/interfaces/bindings:bindings__generator", |
219 ] | 239 ] |
240 public_deps = [ | |
241 "//base", | |
242 ] | |
243 if (defined(invoker.typemap_deps)) { | |
244 public_deps += invoker.typemap_deps | |
245 } | |
220 foreach(d, all_deps) { | 246 foreach(d, all_deps) { |
221 # Resolve the name, so that a target //mojo/something becomes | 247 # Resolve the name, so that a target //mojo/something becomes |
222 # //mojo/something:something and we can append cpp_sources_suffix to | 248 # //mojo/something:something and we can append cpp_sources_suffix to |
223 # get the cpp dependency name. | 249 # get the cpp dependency name. |
224 full_name = get_label_info(d, "label_no_toolchain") | 250 full_name = get_label_info(d, "label_no_toolchain") |
225 deps += [ "${full_name}_${cpp_sources_suffix}" ] | 251 deps += [ "${full_name}_${cpp_sources_suffix}" ] |
226 } | 252 } |
227 if (!defined(invoker.with_environment) || invoker.with_environment) { | 253 if (!defined(invoker.with_environment) || invoker.with_environment) { |
228 deps += [ "//mojo/environment:chromium" ] | 254 deps += [ "//mojo/environment:chromium" ] |
229 } | 255 } |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
265 # //mojo/something:something and we can append "_java" to get the java | 291 # //mojo/something:something and we can append "_java" to get the java |
266 # dependency name. | 292 # dependency name. |
267 full_name = get_label_info(d, "label_no_toolchain") | 293 full_name = get_label_info(d, "label_no_toolchain") |
268 deps += [ "${full_name}_java" ] | 294 deps += [ "${full_name}_java" ] |
269 } | 295 } |
270 | 296 |
271 srcjar_deps = [ ":$java_srcjar_target_name" ] | 297 srcjar_deps = [ ":$java_srcjar_target_name" ] |
272 } | 298 } |
273 } | 299 } |
274 } | 300 } |
OLD | NEW |