OLD | NEW |
(Empty) | |
| 1 # Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. |
| 4 |
| 5 # Runs the resources map generation script other the given header files to |
| 6 # produce an output file and a source_set to build it. |
| 7 # |
| 8 # Parameters: |
| 9 # inputs: |
| 10 # List of file name to read. Each file should be an header file generated |
| 11 # by grit with line like "#define IDS_FOO 12345". |
| 12 # |
| 13 # namespace (optional): |
| 14 # Namespace in which the generated code should be scoped. If left empty, |
| 15 # the code will be in the global namespace. |
| 16 # |
| 17 # header_filename: |
| 18 # Name of the generated header file. |
| 19 # |
| 20 # source_filename: |
| 21 # Name of the generated source file. |
| 22 # |
| 23 # deps (optional): |
| 24 # List of targets to depend on. |
| 25 # |
| 26 template("generate_ui_string_overrider") { |
| 27 # Copy "target_name" to allow restrict the visibility of the generation |
| 28 # target to that target (as ":$target_name" will have a different meaning |
| 29 # in the "action" block). |
| 30 source_set_target_name = target_name |
| 31 gen_action_target_name = target_name + "_gen_sources" |
| 32 |
| 33 action(gen_action_target_name) { |
| 34 header_filename = "$target_gen_dir/" + invoker.header_filename |
| 35 source_filename = "$target_gen_dir/" + invoker.source_filename |
| 36 |
| 37 visibility = [ ":$source_set_target_name" ] |
| 38 script = "//components/variations/service/generate_ui_string_overrider.py" |
| 39 outputs = [ |
| 40 header_filename, |
| 41 source_filename, |
| 42 ] |
| 43 |
| 44 inputs = invoker.inputs |
| 45 if (defined(invoker.deps)) { |
| 46 deps = invoker.deps |
| 47 } |
| 48 |
| 49 args = [ |
| 50 "-N" + invoker.namespace, |
| 51 "-o" + rebase_path(root_gen_dir, root_build_dir), |
| 52 "-H" + rebase_path(header_filename, root_gen_dir), |
| 53 "-S" + rebase_path(source_filename, root_gen_dir), |
| 54 ] + rebase_path(inputs, root_build_dir) |
| 55 } |
| 56 |
| 57 source_set(target_name) { |
| 58 sources = get_target_outputs(":$gen_action_target_name") |
| 59 deps = [ |
| 60 "//components/variations/service", |
| 61 ":$gen_action_target_name", |
| 62 ] |
| 63 |
| 64 forward_variables_from(invoker, [ "visibility" ]) |
| 65 } |
| 66 } |
OLD | NEW |