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("//base/android/linker/config.gni") | 5 import("//base/android/linker/config.gni") |
6 import("//build/config/android/config.gni") | 6 import("//build/config/android/config.gni") |
7 import("//build/config/android/internal_rules.gni") | 7 import("//build/config/android/internal_rules.gni") |
8 import("//build/config/sanitizers/sanitizers.gni") | 8 import("//build/config/sanitizers/sanitizers.gni") |
9 import("//build/toolchain/toolchain.gni") | 9 import("//build/toolchain/toolchain.gni") |
10 import("//third_party/android_platform/config.gni") | 10 import("//third_party/android_platform/config.gni") |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 rebase_path(depfile, root_build_dir), | 360 rebase_path(depfile, root_build_dir), |
361 "--srcjar=$_rebased_srcjar_path", | 361 "--srcjar=$_rebased_srcjar_path", |
362 ] + _rebased_sources | 362 ] + _rebased_sources |
363 outputs = [ | 363 outputs = [ |
364 depfile, | 364 depfile, |
365 _srcjar_path, | 365 _srcjar_path, |
366 ] | 366 ] |
367 } | 367 } |
368 } | 368 } |
369 | 369 |
| 370 # Declare a target for generating Java classes from C++ strings. |
| 371 # |
| 372 # This target generates Java files from C++ strings using a script. |
| 373 # |
| 374 # This target will create a single .srcjar. Adding this target to an |
| 375 # android_library target's srcjar_deps will make the generated java files be |
| 376 # included in that library's final outputs. |
| 377 # |
| 378 # Variables |
| 379 # sources: list of files to be processed by the script. For each source |
| 380 # file the script will generate a .java file including all the strings |
| 381 # in the source file with the name indicated in the derectives. |
| 382 # |
| 383 # Example |
| 384 # java_cpp_string("foo_generated_string") { |
| 385 # sources = [ |
| 386 # "src/native_foo.cc", |
| 387 # ] |
| 388 # } |
| 389 template("java_cpp_string") { |
| 390 action(target_name) { |
| 391 # The sources aren't compiled so don't check their dependencies. |
| 392 check_includes = false |
| 393 set_sources_assignment_filter([]) |
| 394 |
| 395 assert(defined(invoker.sources)) |
| 396 forward_variables_from(invoker, |
| 397 [ |
| 398 "sources", |
| 399 "testonly", |
| 400 "visibility", |
| 401 ]) |
| 402 |
| 403 script = "//build/android/gyp/java_cpp_string.py" |
| 404 depfile = "$target_gen_dir/$target_name.d" |
| 405 |
| 406 _srcjar_path = "${target_gen_dir}/${target_name}.srcjar" |
| 407 _rebased_srcjar_path = rebase_path(_srcjar_path, root_build_dir) |
| 408 _rebased_sources = rebase_path(invoker.sources, root_build_dir) |
| 409 |
| 410 args = [ |
| 411 "--depfile", |
| 412 rebase_path(depfile, root_build_dir), |
| 413 "--srcjar=$_rebased_srcjar_path", |
| 414 ] + _rebased_sources |
| 415 outputs = [ |
| 416 depfile, |
| 417 _srcjar_path, |
| 418 ] |
| 419 } |
| 420 } |
| 421 |
370 # Declare a target for processing a Jinja template. | 422 # Declare a target for processing a Jinja template. |
371 # | 423 # |
372 # Variables | 424 # Variables |
373 # input: The template file to be processed. | 425 # input: The template file to be processed. |
374 # output: Where to save the result. | 426 # output: Where to save the result. |
375 # variables: (Optional) A list of variables to make available to the template | 427 # variables: (Optional) A list of variables to make available to the template |
376 # processing environment, e.g. ["name=foo", "color=red"]. | 428 # processing environment, e.g. ["name=foo", "color=red"]. |
377 # | 429 # |
378 # Example | 430 # Example |
379 # jinja_template("chrome_public_manifest") { | 431 # jinja_template("chrome_public_manifest") { |
(...skipping 2036 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2416 "--target", | 2468 "--target", |
2417 rebase_path(invoker.target, root_build_dir), | 2469 rebase_path(invoker.target, root_build_dir), |
2418 "--output-directory", | 2470 "--output-directory", |
2419 rebase_path(root_out_dir, root_build_dir), | 2471 rebase_path(root_out_dir, root_build_dir), |
2420 ] | 2472 ] |
2421 if (defined(invoker.flag_name)) { | 2473 if (defined(invoker.flag_name)) { |
2422 args += [ "--flag-name=${invoker.flag_name}" ] | 2474 args += [ "--flag-name=${invoker.flag_name}" ] |
2423 } | 2475 } |
2424 } | 2476 } |
2425 } | 2477 } |
OLD | NEW |