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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 visibility = target_visibility + invoker.visibility | 174 visibility = target_visibility + invoker.visibility |
175 } | 175 } |
176 script = generator_script | 176 script = generator_script |
177 inputs = generator_sources | 177 inputs = generator_sources |
178 sources = invoker.sources | 178 sources = invoker.sources |
179 outputs = generator_cpp_outputs + generator_dart_outputs + | 179 outputs = generator_cpp_outputs + generator_dart_outputs + |
180 generator_go_outputs + generator_java_outputs + | 180 generator_go_outputs + generator_java_outputs + |
181 generator_js_outputs + generator_python_outputs | 181 generator_js_outputs + generator_python_outputs |
182 args = [ | 182 args = [ |
183 "{{source}}", | 183 "{{source}}", |
184 "--dart_mojo_root=${mojo_root}", | |
185 "--use_bundled_pylibs", | 184 "--use_bundled_pylibs", |
186 "-d", | 185 "-d", |
187 rebase_path("//", root_build_dir), | 186 rebase_path("//", root_build_dir), |
188 "-I", | 187 "-I", |
189 rebase_path("//", root_build_dir), | 188 rebase_path("//", root_build_dir), |
190 "-I", | 189 "-I", |
191 rebase_path(mojo_root, root_build_dir), | 190 rebase_path(mojo_root, root_build_dir), |
192 "-o", | 191 "-o", |
193 rebase_path(root_gen_dir), | 192 rebase_path(root_gen_dir), |
194 ] | 193 ] |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
329 dep_target_out_dir = get_label_info(d, "target_out_dir") | 328 dep_target_out_dir = get_label_info(d, "target_out_dir") |
330 deps += [ "${full_name}_dart" ] | 329 deps += [ "${full_name}_dart" ] |
331 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] | 330 zip_inputs += [ "$dep_target_out_dir/$dep_name.dartzip" ] |
332 } | 331 } |
333 | 332 |
334 output = generator_dart_zip_output | 333 output = generator_dart_zip_output |
335 outputs = [ | 334 outputs = [ |
336 output, | 335 output, |
337 ] | 336 ] |
338 | 337 |
339 invoker_import_from = "" | |
340 if (defined(invoker.import_from)) { | |
341 invoker_import_from = | |
342 rebase_path(invoker.import_from, "$root_build_dir/../../", ".") | |
343 } | |
344 | |
345 rebase_import_from = | 338 rebase_import_from = |
346 rebase_path("$root_build_dir/gen/$invoker_import_from", root_build_dir) | 339 rebase_path("$root_build_dir/gen/dart-gen", root_build_dir) |
347 if (defined(invoker.sources)) { | 340 if (defined(invoker.sources)) { |
348 rebase_inputs = rebase_path(inputs, root_build_dir) | 341 rebase_inputs = rebase_path(inputs, root_build_dir) |
349 } | 342 } |
350 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir) | 343 rebase_zip_inputs = rebase_path(zip_inputs, root_build_dir) |
351 rebase_output = rebase_path(output, root_build_dir) | 344 rebase_output = rebase_path(output, root_build_dir) |
352 args = [ | 345 args = [ |
353 "--base-dir=$rebase_import_from", | 346 "--base-dir=$rebase_import_from", |
354 "--zip-inputs=$rebase_zip_inputs", | 347 "--zip-inputs=$rebase_zip_inputs", |
355 "--output=$rebase_output", | 348 "--output=$rebase_output", |
356 ] | 349 ] |
357 if (defined(invoker.sources)) { | 350 if (defined(invoker.sources)) { |
358 args += [ "--inputs=$rebase_inputs" ] | 351 args += [ "--link-inputs=$rebase_inputs" ] |
359 } | 352 } |
360 } | 353 } |
361 | 354 |
362 if (is_android) { | 355 if (is_android) { |
363 import("//build/config/android/rules.gni") | 356 import("//build/config/android/rules.gni") |
364 | 357 |
365 java_target_name = target_name + "_java" | 358 java_target_name = target_name + "_java" |
366 android_library(java_target_name) { | 359 android_library(java_target_name) { |
367 deps = rebase_path([ | 360 deps = rebase_path([ |
368 "mojo/public/java:bindings", | 361 "mojo/public/java:bindings", |
369 "mojo/public/java:system", | 362 "mojo/public/java:system", |
370 ], | 363 ], |
371 ".", | 364 ".", |
372 mojo_root) | 365 mojo_root) |
373 | 366 |
374 foreach(d, all_deps) { | 367 foreach(d, all_deps) { |
375 # Resolve the name, so that a target //mojo/something becomes | 368 # Resolve the name, so that a target //mojo/something becomes |
376 # //mojo/something:something and we can append "_java" to get the java | 369 # //mojo/something:something and we can append "_java" to get the java |
377 # dependency name. | 370 # dependency name. |
378 full_name = get_label_info(d, "label_no_toolchain") | 371 full_name = get_label_info(d, "label_no_toolchain") |
379 deps += [ "${full_name}_java" ] | 372 deps += [ "${full_name}_java" ] |
380 } | 373 } |
381 | 374 |
382 if (defined(invoker.sources)) { | 375 if (defined(invoker.sources)) { |
383 srcjars = process_file_template(invoker.sources, generator_java_outputs) | 376 srcjars = process_file_template(invoker.sources, generator_java_outputs) |
384 } | 377 } |
385 } | 378 } |
386 } | 379 } |
387 } | 380 } |
OLD | NEW |