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 # Compile a protocol buffer. | 5 # Compile a protocol buffer. |
6 # | 6 # |
7 # Protobuf parameters: | 7 # Protobuf parameters: |
8 # | 8 # |
9 # proto_out_dir (optional) | 9 # proto_out_dir (optional) |
10 # Specifies the path suffix that output files are generated under. This | 10 # Specifies the path suffix that output files are generated under. This |
(...skipping 23 matching lines...) Expand all Loading... |
34 # | 34 # |
35 # generator_plugin_label (optional) | 35 # generator_plugin_label (optional) |
36 # GN label for plugin executable which generates custom cc stubs. | 36 # GN label for plugin executable which generates custom cc stubs. |
37 # | 37 # |
38 # generator_plugin_suffix (required if generator_plugin_label set) | 38 # generator_plugin_suffix (required if generator_plugin_label set) |
39 # Suffix (before extension) for generated .cc and .h files. | 39 # Suffix (before extension) for generated .cc and .h files. |
40 # | 40 # |
41 # generator_plugin_options (optional) | 41 # generator_plugin_options (optional) |
42 # Extra flags passed to the plugin. See cc_generator_options. | 42 # Extra flags passed to the plugin. See cc_generator_options. |
43 # | 43 # |
| 44 # json_converter (optional) |
| 45 # The plugin executable to generate JSON converter. |
| 46 # |
44 # cc_include (optional) | 47 # cc_include (optional) |
45 # String listing an extra include that should be passed. | 48 # String listing an extra include that should be passed. |
46 # Example: cc_include = "foo/bar.h" | 49 # Example: cc_include = "foo/bar.h" |
47 # | 50 # |
48 # deps (optional) | 51 # deps (optional) |
49 # Additional dependencies. | 52 # Additional dependencies. |
50 # | 53 # |
| 54 # inputs (optional) |
| 55 # Additional inputs for dependency checking. |
| 56 # |
51 # Parameters for compiling the generated code: | 57 # Parameters for compiling the generated code: |
52 # | 58 # |
53 # component_build_force_source_set (Default=false) | 59 # component_build_force_source_set (Default=false) |
54 # When set true the generated code will be compiled as a source set in | 60 # When set true the generated code will be compiled as a source set in |
55 # the component build. This does not affect static builds. If you are | 61 # the component build. This does not affect static builds. If you are |
56 # exporting symbols from a component, this is required to prevent those | 62 # exporting symbols from a component, this is required to prevent those |
57 # symbols from being stripped. If you're not using dllexports in | 63 # symbols from being stripped. If you're not using dllexports in |
58 # cc_generator_options, it's usually best to leave this false. | 64 # cc_generator_options, it's usually best to leave this false. |
59 # | 65 # |
60 # defines (optional) | 66 # defines (optional) |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (defined(invoker.proto_out_dir)) { | 102 if (defined(invoker.proto_out_dir)) { |
97 proto_out_dir = invoker.proto_out_dir | 103 proto_out_dir = invoker.proto_out_dir |
98 } else { | 104 } else { |
99 proto_out_dir = "{{source_root_relative_dir}}" | 105 proto_out_dir = "{{source_root_relative_dir}}" |
100 } | 106 } |
101 out_dir = "$root_gen_dir/" + proto_out_dir | 107 out_dir = "$root_gen_dir/" + proto_out_dir |
102 rel_out_dir = rebase_path(out_dir, root_build_dir) | 108 rel_out_dir = rebase_path(out_dir, root_build_dir) |
103 | 109 |
104 outputs = [] | 110 outputs = [] |
105 | 111 |
| 112 inputs = [] |
| 113 if (defined(invoker.inputs)) { |
| 114 inputs += invoker.inputs |
| 115 } |
| 116 |
106 args = [] | 117 args = [] |
107 if (defined(invoker.cc_include)) { | 118 if (defined(invoker.cc_include)) { |
108 args += [ | 119 args += [ |
109 "--include", | 120 "--include", |
110 invoker.cc_include, | 121 invoker.cc_include, |
111 "--protobuf", | 122 "--protobuf", |
112 "$rel_out_dir/{{source_name_part}}.pb.h", | 123 "$rel_out_dir/{{source_name_part}}.pb.h", |
113 ] | 124 ] |
114 } | 125 } |
115 | 126 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
202 protoc_label, | 213 protoc_label, |
203 ] | 214 ] |
204 if (defined(plugin_host_label)) { | 215 if (defined(plugin_host_label)) { |
205 deps += [ plugin_host_label ] | 216 deps += [ plugin_host_label ] |
206 } | 217 } |
207 | 218 |
208 # The deps may have steps that have to run before running protobuf. | 219 # The deps may have steps that have to run before running protobuf. |
209 if (defined(invoker.deps)) { | 220 if (defined(invoker.deps)) { |
210 deps += invoker.deps | 221 deps += invoker.deps |
211 } | 222 } |
| 223 |
| 224 if (defined(invoker.json_converter)) { |
| 225 args += [ |
| 226 "--plugin=protoc-gen-json_converter=" + |
| 227 # It is required to use backslash on Windows for .bat files. |
| 228 rebase_path(invoker.json_converter), |
| 229 "--json_converter_out=output_dir=:$rel_out_dir", |
| 230 ] |
| 231 inputs += [ invoker.json_converter ] |
| 232 outputs += [ "$out_dir/{{source_name_part}}_json_converter.h" ] |
| 233 } |
212 } | 234 } |
213 | 235 |
214 if (defined(invoker.component_build_force_source_set) && | 236 if (defined(invoker.component_build_force_source_set) && |
215 invoker.component_build_force_source_set && | 237 invoker.component_build_force_source_set && is_component_build) { |
216 is_component_build) { | |
217 link_target_type = "source_set" | 238 link_target_type = "source_set" |
218 } else { | 239 } else { |
219 link_target_type = "static_library" | 240 link_target_type = "static_library" |
220 } | 241 } |
221 target(link_target_type, target_name) { | 242 target(link_target_type, target_name) { |
222 forward_variables_from(invoker, | 243 forward_variables_from(invoker, |
223 [ | 244 [ |
224 "visibility", | 245 "visibility", |
225 "defines", | 246 "defines", |
226 ]) | 247 ]) |
(...skipping 18 matching lines...) Expand all Loading... |
245 ":$action_name", | 266 ":$action_name", |
246 ] | 267 ] |
247 | 268 |
248 # This will link any libraries in the deps (the use of invoker.deps in the | 269 # This will link any libraries in the deps (the use of invoker.deps in the |
249 # action won't link it). | 270 # action won't link it). |
250 if (defined(invoker.deps)) { | 271 if (defined(invoker.deps)) { |
251 deps += invoker.deps | 272 deps += invoker.deps |
252 } | 273 } |
253 } | 274 } |
254 } | 275 } |
OLD | NEW |