| 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++ and JavaScript source files from mojom files. The output files | 7 # Generate C++ and JavaScript source files from mojom files. The output files |
| 8 # will go under the generated file directory tree with the same path as each | 8 # will go under the generated file directory tree with the same path as each |
| 9 # input file. | 9 # input file. |
| 10 # | 10 # |
| (...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", | 117 "{{source_gen_dir}}/{{source_name_part}}.mojom.h", |
| 118 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", | 118 "{{source_gen_dir}}/{{source_name_part}}.mojom-internal.h", |
| 119 ] | 119 ] |
| 120 generator_dart_outputs = | 120 generator_dart_outputs = |
| 121 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] | 121 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.dart" ] |
| 122 generator_java_outputs = | 122 generator_java_outputs = |
| 123 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] | 123 [ "{{source_gen_dir}}/{{source_name_part}}.mojom.srcjar" ] |
| 124 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] | 124 generator_js_outputs = [ "{{source_gen_dir}}/{{source_name_part}}.mojom.js" ] |
| 125 generator_python_outputs = | 125 generator_python_outputs = |
| 126 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] | 126 [ "{{source_gen_dir}}/{{source_name_part}}_mojom.py" ] |
| 127 generator_python_zip_output = "$target_out_dir/$target_name.pyzip" |
| 127 | 128 |
| 128 if (defined(invoker.visibility)) { | 129 if (defined(invoker.visibility)) { |
| 129 # Need to save this because the the target_name is overwritten inside the | 130 # Need to save this because the the target_name is overwritten inside the |
| 130 # action to be that of the action itself. Only define this in the case the | 131 # action to be that of the action itself. Only define this in the case the |
| 131 # var is used to avoid unused var error. | 132 # var is used to avoid unused var error. |
| 132 target_visibility = [ ":$target_name" ] | 133 target_visibility = [ ":$target_name" ] |
| 133 } | 134 } |
| 134 | 135 |
| 135 generator_target_name = target_name + "__generator" | 136 generator_target_name = target_name + "__generator" |
| 136 action_foreach(generator_target_name) { | 137 action_foreach(generator_target_name) { |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 # invoker.public_deps) are mojom targets themselves. | 213 # invoker.public_deps) are mojom targets themselves. |
| 213 group("${target_name}__check_deps_are_all_mojom") { | 214 group("${target_name}__check_deps_are_all_mojom") { |
| 214 deps = [] | 215 deps = [] |
| 215 foreach(d, all_deps) { | 216 foreach(d, all_deps) { |
| 216 name = get_label_info(d, "label_no_toolchain") | 217 name = get_label_info(d, "label_no_toolchain") |
| 217 toolchain = get_label_info(d, "toolchain") | 218 toolchain = get_label_info(d, "toolchain") |
| 218 deps += [ "${name}__is_mojom(${toolchain})" ] | 219 deps += [ "${name}__is_mojom(${toolchain})" ] |
| 219 } | 220 } |
| 220 } | 221 } |
| 221 | 222 |
| 223 action("${target_name}_python") { |
| 224 script = rebase_path("mojo/public/tools/gn/zip.py", ".", mojo_root) |
| 225 |
| 226 inputs = process_file_template(invoker.sources, generator_python_outputs) |
| 227 |
| 228 deps = [] |
| 229 zip_inputs = [] |
| 230 |
| 231 foreach(d, all_deps) { |
| 232 # Resolve the name, so that a target //mojo/something becomes |
| 233 # //mojo/something:something and we can append "_python" to get the python |
| 234 # dependency name. |
| 235 full_name = get_label_info(d, "label_no_toolchain") |
| 236 dep_name = get_label_info(d, "name") |
| 237 dep_target_out_dir = get_label_info(d, "target_out_dir") |
| 238 deps += [ "${full_name}_python" ] |
| 239 zip_inputs += [ "$dep_target_out_dir/$dep_name.pyzip" ] |
| 240 } |
| 241 |
| 242 output = generator_python_zip_output |
| 243 outputs = [ |
| 244 output, |
| 245 ] |
| 246 |
| 247 rebase_base_dir = rebase_path(target_gen_dir, root_build_dir) |
| 248 rebase_inputs = rebase_path(inputs, root_build_dir) |
| 249 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir) |
| 250 rebase_output = rebase_path(output, root_build_dir) |
| 251 args = [ |
| 252 "--base-dir=$rebase_base_dir", |
| 253 "--inputs=$rebase_inputs", |
| 254 "--zip-inputs=$rebase_zip_inputs", |
| 255 "--output=$rebase_output", |
| 256 ] |
| 257 } |
| 258 |
| 222 if (is_android) { | 259 if (is_android) { |
| 223 import("//build/config/android/rules.gni") | 260 import("//build/config/android/rules.gni") |
| 224 | 261 |
| 225 java_target_name = target_name + "_java" | 262 java_target_name = target_name + "_java" |
| 226 android_library(java_target_name) { | 263 android_library(java_target_name) { |
| 227 deps = rebase_path([ | 264 deps = rebase_path([ |
| 228 "mojo/public/java:bindings", | 265 "mojo/public/java:bindings", |
| 229 "mojo/public/java:system", | 266 "mojo/public/java:system", |
| 230 ], | 267 ], |
| 231 ".", | 268 ".", |
| 232 mojo_root) | 269 mojo_root) |
| 233 | 270 |
| 234 foreach(d, all_deps) { | 271 foreach(d, all_deps) { |
| 235 # Resolve the name, so that a target //mojo/something becomes | 272 # Resolve the name, so that a target //mojo/something becomes |
| 236 # //mojo/something:something and we can append "_java" to get the java | 273 # //mojo/something:something and we can append "_java" to get the java |
| 237 # dependency name. | 274 # dependency name. |
| 238 full_name = get_label_info(d, "label_no_toolchain") | 275 full_name = get_label_info(d, "label_no_toolchain") |
| 239 deps += [ "${full_name}_java" ] | 276 deps += [ "${full_name}_java" ] |
| 240 } | 277 } |
| 241 | 278 |
| 242 srcjars = process_file_template(invoker.sources, generator_java_outputs) | 279 srcjars = process_file_template(invoker.sources, generator_java_outputs) |
| 243 } | 280 } |
| 244 } | 281 } |
| 245 } | 282 } |
| OLD | NEW |