| 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 import("../../mojo_sdk.gni") | 5 import("../../mojo_sdk.gni") |
| 6 | 6 |
| 7 # Generate C++/JavaScript/Java/Python/Dart/Go source files from mojom files. The | 7 # Generate C++/JavaScript/Java/Python/Dart/Go source files from mojom files. The |
| 8 # output files will go under the generated file directory tree with the same | 8 # output files will go under the generated file directory tree with the same |
| 9 # path as each input file. | 9 # path as each input file. |
| 10 # | 10 # |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 140 ] | 140 ] |
| 141 generator_cpp_outputs = [ | 141 generator_cpp_outputs = [ |
| 142 "{{source_gen_dir}}/{{source_name_part}}.mojom-common.cc", | 142 "{{source_gen_dir}}/{{source_name_part}}.mojom-common.cc", |
| 143 "{{source_gen_dir}}/{{source_name_part}}.mojom-common.h", | 143 "{{source_gen_dir}}/{{source_name_part}}.mojom-common.h", |
| 144 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | 144 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", |
| 145 "{{source_gen_dir}}/{{source_name_part}}.mojom-sync.cc", | 145 "{{source_gen_dir}}/{{source_name_part}}.mojom-sync.cc", |
| 146 "{{source_gen_dir}}/{{source_name_part}}.mojom-sync.h", | 146 "{{source_gen_dir}}/{{source_name_part}}.mojom-sync.h", |
| 147 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | 147 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", |
| 148 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", | 148 "{{source_gen_dir}}/{{source_name_part}}.mojom.cc", |
| 149 ] | 149 ] |
| 150 generator_c_outputs = [ |
| 151 "{{source_gen_dir}}/{{source_name_part}}.mojom-c.c", |
| 152 "{{source_gen_dir}}/{{source_name_part}}.mojom-c.h", |
| 153 ] |
| 150 generator_js_outputs = | 154 generator_js_outputs = |
| 151 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | 155 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] |
| 152 generator_dart_outputs = | 156 generator_dart_outputs = |
| 153 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] | 157 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] |
| 154 generator_go_outputs = [ "${root_gen_dir}/go/src/{{source_dir}}/{{source_nam
e_part}}/{{source_name_part}}.mojom.go" ] | 158 generator_go_outputs = [ "${root_gen_dir}/go/src/{{source_dir}}/{{source_nam
e_part}}/{{source_name_part}}.mojom.go" ] |
| 155 generator_python_outputs = | 159 generator_python_outputs = |
| 156 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] | 160 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] |
| 157 generator_java_outputs = | 161 generator_java_outputs = |
| 158 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | 162 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] |
| 159 } | 163 } |
| (...skipping 21 matching lines...) Expand all Loading... |
| 181 generator_target_name = target_name + "__generator" | 185 generator_target_name = target_name + "__generator" |
| 182 action_foreach(generator_target_name) { | 186 action_foreach(generator_target_name) { |
| 183 script = mojom_tool | 187 script = mojom_tool |
| 184 inputs = generator_sources | 188 inputs = generator_sources |
| 185 if (defined(invoker.generate_type_info) && invoker.generate_type_info) { | 189 if (defined(invoker.generate_type_info) && invoker.generate_type_info) { |
| 186 deps = [ | 190 deps = [ |
| 187 rebase_path("mojo/public/interfaces/bindings", ".", mojo_root), | 191 rebase_path("mojo/public/interfaces/bindings", ".", mojo_root), |
| 188 ] | 192 ] |
| 189 } | 193 } |
| 190 sources = invoker.sources | 194 sources = invoker.sources |
| 191 outputs = generator_cpp_outputs + generator_dart_outputs + | 195 outputs = |
| 192 generator_go_outputs + generator_java_outputs + | 196 generator_cpp_outputs + generator_dart_outputs + |
| 193 generator_js_outputs + generator_python_outputs | 197 generator_go_outputs + generator_java_outputs + generator_js_outputs + |
| 198 generator_python_outputs + generator_c_outputs |
| 194 args = [ | 199 args = [ |
| 195 "gen", | 200 "gen", |
| 196 "--src-root-path", | 201 "--src-root-path", |
| 197 rebase_path("//", root_build_dir), | 202 rebase_path("//", root_build_dir), |
| 198 "-I", | 203 "-I", |
| 199 rebase_path("//", root_build_dir), | 204 rebase_path("//", root_build_dir), |
| 200 "-I", | 205 "-I", |
| 201 rebase_path(mojo_root, root_build_dir), | 206 rebase_path(mojo_root, root_build_dir), |
| 202 "--output-dir", | 207 "--output-dir", |
| 203 rebase_path(root_gen_dir), | 208 rebase_path(root_gen_dir), |
| 204 "--no-gen-imports", | 209 "--no-gen-imports", |
| 205 "--generators", | 210 "--generators", |
| 206 "legacy", | 211 "legacy,c", |
| 207 ] | 212 ] |
| 208 | 213 |
| 209 if (defined(invoker.generate_type_info) && invoker.generate_type_info) { | 214 if (defined(invoker.generate_type_info) && invoker.generate_type_info) { |
| 210 args += [ | 215 args += [ |
| 211 "--gen-arg", | 216 "--gen-arg", |
| 212 "generate-type-info", | 217 "generate-type-info", |
| 213 ] | 218 ] |
| 214 } else { | |
| 215 args += [ | |
| 216 "--gen-arg", | |
| 217 "no-generate-type-info", | |
| 218 ] | |
| 219 } | 219 } |
| 220 | 220 |
| 221 if (defined(invoker.import_dirs)) { | 221 if (defined(invoker.import_dirs)) { |
| 222 foreach(import_dir, invoker.import_dirs) { | 222 foreach(import_dir, invoker.import_dirs) { |
| 223 args += [ | 223 args += [ |
| 224 "-I", | 224 "-I", |
| 225 rebase_path(import_dir, root_build_dir), | 225 rebase_path(import_dir, root_build_dir), |
| 226 ] | 226 ] |
| 227 } | 227 } |
| 228 } | 228 } |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 265 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root) | 265 public_deps = rebase_path([ "mojo/public/cpp/bindings" ], ".", mojo_root) |
| 266 public_deps += cpp_public_deps | 266 public_deps += cpp_public_deps |
| 267 if (defined(invoker.sources)) { | 267 if (defined(invoker.sources)) { |
| 268 public_deps += [ ":${cpp_sources_target_name}" ] | 268 public_deps += [ ":${cpp_sources_target_name}" ] |
| 269 data = process_file_template(invoker.sources, generator_js_outputs) | 269 data = process_file_template(invoker.sources, generator_js_outputs) |
| 270 } | 270 } |
| 271 | 271 |
| 272 deps = cpp_deps | 272 deps = cpp_deps |
| 273 } | 273 } |
| 274 | 274 |
| 275 # This target is used to generate and build the C mojom bindings. |
| 276 source_set("${target_name}_c") { |
| 277 if (defined(invoker.visibility)) { |
| 278 visibility = invoker.visibility |
| 279 } |
| 280 if (defined(invoker.testonly)) { |
| 281 testonly = invoker.testonly |
| 282 } |
| 283 |
| 284 public_configs = |
| 285 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root) |
| 286 |
| 287 public_deps = rebase_path([ "mojo/public/c/bindings" ], ".", mojo_root) |
| 288 foreach(d, rebased_mojo_sdk_public_deps) { |
| 289 full_name = get_label_info(d, "label_no_toolchain") |
| 290 public_deps += [ "${full_name}_c" ] |
| 291 } |
| 292 |
| 293 deps = [] |
| 294 foreach(d, rebased_mojo_sdk_deps) { |
| 295 # Resolve the name, so that a target //mojo/something becomes |
| 296 # //mojo/something:something and we can append "_c" to get the C |
| 297 # dependency name. |
| 298 full_name = get_label_info(d, "label_no_toolchain") |
| 299 deps += [ "${full_name}_c" ] |
| 300 } |
| 301 |
| 302 if (defined(invoker.sources)) { |
| 303 deps += [ ":$generator_target_name" ] |
| 304 sources = process_file_template( |
| 305 invoker.sources, |
| 306 [ |
| 307 "{{source_gen_dir}}/{{source_name_part}}.mojom-c.c", |
| 308 "{{source_gen_dir}}/{{source_name_part}}.mojom-c.h", |
| 309 ]) |
| 310 } |
| 311 } |
| 312 |
| 275 source_set("${target_name}_sync") { | 313 source_set("${target_name}_sync") { |
| 276 if (defined(invoker.visibility)) { | 314 if (defined(invoker.visibility)) { |
| 277 visibility = invoker.visibility | 315 visibility = invoker.visibility |
| 278 } | 316 } |
| 279 if (defined(invoker.testonly)) { | 317 if (defined(invoker.testonly)) { |
| 280 testonly = invoker.testonly | 318 testonly = invoker.testonly |
| 281 } | 319 } |
| 282 | 320 |
| 283 public_configs = | 321 public_configs = |
| 284 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root) | 322 rebase_path([ "mojo/public/build/config:mojo_sdk" ], ".", mojo_root) |
| (...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 509 # //mojo/something:something and we can append "_java" to get the java | 547 # //mojo/something:something and we can append "_java" to get the java |
| 510 # dependency name. | 548 # dependency name. |
| 511 full_name = get_label_info(d, "label_no_toolchain") | 549 full_name = get_label_info(d, "label_no_toolchain") |
| 512 deps += [ "${full_name}_java" ] | 550 deps += [ "${full_name}_java" ] |
| 513 } | 551 } |
| 514 | 552 |
| 515 srcjar_deps = [ ":$java_srcjar_target_name" ] | 553 srcjar_deps = [ ":$java_srcjar_target_name" ] |
| 516 } | 554 } |
| 517 } | 555 } |
| 518 } | 556 } |
| OLD | NEW |