OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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 # Creates a symlink. | 5 # Creates a symlink. |
6 # Args: | 6 # Args: |
7 # source: Path to link to. | 7 # source: Path to link to. |
8 # output: Where to create the symlink. | 8 # output: Where to create the symlink. |
9 template("symlink") { | 9 template("symlink") { |
10 action(target_name) { | 10 action(target_name) { |
(...skipping 17 matching lines...) Expand all Loading... |
28 | 28 |
29 # Creates a symlink from root_build_dir/target_name to |binary_label|. This rule | 29 # Creates a symlink from root_build_dir/target_name to |binary_label|. This rule |
30 # is meant to be used within if (current_toolchain == default_toolchain) blocks | 30 # is meant to be used within if (current_toolchain == default_toolchain) blocks |
31 # and point to targets in the non-default toolchain. | 31 # and point to targets in the non-default toolchain. |
32 # Note that for executables, using a copy (as opposed to a symlink) does not | 32 # Note that for executables, using a copy (as opposed to a symlink) does not |
33 # work when is_component_build=true, since dependent libraries are found via | 33 # work when is_component_build=true, since dependent libraries are found via |
34 # relative location. | 34 # relative location. |
35 # | 35 # |
36 # Args: | 36 # Args: |
37 # binary_label: Target that builds the file to symlink to. e.g.: | 37 # binary_label: Target that builds the file to symlink to. e.g.: |
38 # ":foo($host_toolchain)". | 38 # ":$target_name($host_toolchain)". |
39 # output: Where to create the symlink (default="$root_out_dir/$target_name") | 39 # binary_output_name: The output_name set by the binary_label target |
| 40 # (if applicable). |
| 41 # output_name: Where to create the symlink |
| 42 # (default="$root_out_dir/$binary_output_name"). |
40 # | 43 # |
41 # Example: | 44 # Example: |
42 # if (current_toolchain == host_toolchain) { | 45 # if (current_toolchain == host_toolchain) { |
43 # executable("foo") { ... } | 46 # executable("foo") { ... } |
44 # } else if (current_toolchain == default_toolchain) { | 47 # } else if (current_toolchain == default_toolchain) { |
45 # binary_symlink("foo") { | 48 # binary_symlink("foo") { |
46 # binary_label = ":foo($host_toolchain)" | 49 # binary_label = ":foo($host_toolchain)" |
47 # } | 50 # } |
48 # } | 51 # } |
49 template("binary_symlink") { | 52 template("binary_symlink") { |
50 symlink(target_name) { | 53 symlink(target_name) { |
51 forward_variables_from(invoker, | 54 forward_variables_from(invoker, |
52 [ | 55 [ |
53 "output", | 56 "output", |
54 "testonly", | 57 "testonly", |
55 "visibility", | 58 "visibility", |
56 ]) | 59 ]) |
57 deps = [ | 60 deps = [ |
58 invoker.binary_label, | 61 invoker.binary_label, |
59 ] | 62 ] |
60 | 63 |
61 _out_dir = get_label_info(invoker.binary_label, "root_out_dir") | 64 _out_dir = get_label_info(invoker.binary_label, "root_out_dir") |
62 source = "$_out_dir/" + get_label_info(invoker.binary_label, "name") | 65 if (defined(invoker.binary_output_name)) { |
| 66 _name = invoker.binary_output_name |
| 67 } else { |
| 68 _name = get_label_info(invoker.binary_label, "name") |
| 69 } |
| 70 source = "$_out_dir/$_name" |
63 | 71 |
64 if (!defined(output)) { | 72 _output_name = _name |
65 output = "$root_out_dir/${invoker.target_name}" | 73 if (defined(invoker.output_name)) { |
| 74 _output_name = invoker.output_name |
66 } | 75 } |
| 76 output = "$root_out_dir/$_output_name" |
67 } | 77 } |
68 } | 78 } |
OLD | NEW |