| 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 declare_args() { | 5 declare_args() { |
| 6 # Absolute path to a resource whitelist (generated using | 6 # Absolute path to a resource whitelist (generated using |
| 7 # //tools/resources/find_used_resources.py). | 7 # //tools/resources/find_used_resources.py). |
| 8 repack_whitelist = "" | 8 repack_whitelist = "" |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 args += [ "--whitelist=$repack_whitelist" ] | 44 args += [ "--whitelist=$repack_whitelist" ] |
| 45 } | 45 } |
| 46 args += [ rebase_path(invoker.output, root_build_dir) ] | 46 args += [ rebase_path(invoker.output, root_build_dir) ] |
| 47 args += rebase_path(invoker.sources, root_build_dir) | 47 args += rebase_path(invoker.sources, root_build_dir) |
| 48 | 48 |
| 49 if (defined(invoker.deps)) { | 49 if (defined(invoker.deps)) { |
| 50 deps = invoker.deps | 50 deps = invoker.deps |
| 51 } | 51 } |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 |
| 55 # This template combines repacking resources and defining a bundle_data target |
| 56 # to move them to the application bundle. This is mostly useful on iOS. |
| 57 # |
| 58 # Parameters: |
| 59 # sources [required] |
| 60 # List of pak files that need to be combined. |
| 61 # |
| 62 # output [required] |
| 63 # File name (single string) of the output file. |
| 64 # |
| 65 # bundle_output [optional] |
| 66 # Path of the file in the application bundle, defaults to |
| 67 # {{bundle_resources_dir}}/{{source_file_part}} if omitted. |
| 68 # |
| 69 # deps [optional] |
| 70 # visibility [optional] |
| 71 # Normal meaning. |
| 72 template("repack_and_bundle") { |
| 73 assert(defined(invoker.bundle_output), "Need bundle_output for $target_name") |
| 74 |
| 75 _repack_target_name = target_name + "_repack" |
| 76 _bundle_target_name = target_name |
| 77 |
| 78 repack(_repack_target_name) { |
| 79 visibility = [ ":$_bundle_target_name" ] |
| 80 forward_variables_from(invoker, |
| 81 [ |
| 82 "deps", |
| 83 "output", |
| 84 "sources", |
| 85 ]) |
| 86 } |
| 87 |
| 88 bundle_data(_bundle_target_name) { |
| 89 forward_variables_from(invoker, [ "visibility" ]) |
| 90 |
| 91 public_deps = [ |
| 92 ":$_repack_target_name", |
| 93 ] |
| 94 sources = [ |
| 95 invoker.output, |
| 96 ] |
| 97 if (defined(invoker.bundle_output)) { |
| 98 outputs = [ |
| 99 invoker.bundle_output, |
| 100 ] |
| 101 } else { |
| 102 outputs = [ |
| 103 "{{bundle_resources_dir}}/{{source_file_part}}", |
| 104 ] |
| 105 } |
| 106 } |
| 107 } |
| OLD | NEW |