OLD | NEW |
(Empty) | |
| 1 # Copyright 2017 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 # Creates an action that aggregates vector icon files (.icon) into a C++ file. |
| 6 # In addition to running the action, the outputs should be added to another |
| 7 # target's sources for compilation. |
| 8 # |
| 9 # Parameters |
| 10 # |
| 11 # icons (required) |
| 12 # A list of icon filenames to use as inputs. |
| 13 # |
| 14 # icon_directory (required) |
| 15 # The path component of the location of the icons, relative to the current |
| 16 # directory. For example, if the invoking BUILD file exists in //foo/bar |
| 17 # and the icons are in //foo/bar/vector_icons/, then icon_directory should |
| 18 # be set to "vector_icons". There must also be template files in this |
| 19 # directory. |
| 20 # |
| 21 # Example |
| 22 # |
| 23 # See BUILD.gn in this directory (//ui/vector_icons/) for an example. |
| 24 template("aggregate_vector_icons") { |
| 25 assert(defined(invoker.icons), |
| 26 "Need icons in $target_name listing the icon files.") |
| 27 assert( |
| 28 defined(invoker.icon_directory), |
| 29 "Need icon_directory in $target_name where the icons and templates live.") |
| 30 |
| 31 action(target_name) { |
| 32 visibility = [ ":*" ] |
| 33 |
| 34 script = "//ui/gfx/vector_icons/aggregate_vector_icons.py" |
| 35 |
| 36 output_cc = "$target_gen_dir/vector_icons.cc" |
| 37 output_h = "$target_gen_dir/vector_icons.h" |
| 38 |
| 39 templates = [ |
| 40 "vector_icons.cc.template", |
| 41 "vector_icons.h.template", |
| 42 ] |
| 43 inputs = rebase_path(templates + invoker.icons, ".", invoker.icon_directory) |
| 44 |
| 45 outputs = [ |
| 46 output_cc, |
| 47 output_h, |
| 48 ] |
| 49 |
| 50 response_file_contents = |
| 51 rebase_path(invoker.icons, root_build_dir, invoker.icon_directory) |
| 52 |
| 53 args = [ |
| 54 "--working_directory=" + rebase_path(invoker.icon_directory), |
| 55 "--file_list={{response_file_name}}", |
| 56 "--output_cc=" + rebase_path(output_cc, root_build_dir), |
| 57 "--output_h=" + rebase_path(output_h, root_build_dir), |
| 58 ] |
| 59 } |
| 60 } |
OLD | NEW |