1 # Copyright 2015 The Chromium Authors
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
7 # source: Path to link to.
8 # output: Where to create the symlink.
11 forward_variables_from(invoker,
18 outputs = [ invoker.output ]
19 script = "//build/symlink.py"
22 rebase_path(invoker.source, get_path_info(invoker.output, "dir")),
23 rebase_path(invoker.output, root_build_dir),
25 if (defined(invoker.touch) && invoker.touch) {
26 args += [ "--touch=" + rebase_path(invoker.source, root_build_dir) ]
31 # Creates a symlink from root_build_dir/target_name to |binary_label|. This rule
32 # is meant to be used within if (current_toolchain == default_toolchain) blocks
33 # and point to targets in the non-default toolchain.
34 # Note that for executables, using a copy (as opposed to a symlink) does not
35 # work when is_component_build=true, since dependent libraries are found via
39 # binary_label: Target that builds the file to symlink to. e.g.:
40 # ":$target_name($host_toolchain)".
41 # binary_output_name: The output_name set by the binary_label target
43 # output_name: Where to create the symlink
44 # (default="$root_out_dir/$binary_output_name").
47 # if (current_toolchain == host_toolchain) {
48 # executable("foo") { ... }
49 # } else if (current_toolchain == default_toolchain) {
50 # binary_symlink("foo") {
51 # binary_label = ":foo($host_toolchain)"
54 template("binary_symlink") {
55 symlink(target_name) {
56 forward_variables_from(invoker,
62 deps = [ invoker.binary_label ]
63 data_deps = [ invoker.binary_label ]
64 if (defined(invoker.data_deps)) {
65 data_deps += invoker.data_deps
68 _out_dir = get_label_info(invoker.binary_label, "root_out_dir")
69 if (defined(invoker.binary_output_name)) {
70 _name = invoker.binary_output_name
72 _name = get_label_info(invoker.binary_label, "name")
74 source = "$_out_dir/$_name"
77 if (defined(invoker.output_name)) {
78 _output_name = invoker.output_name
80 output = "$root_out_dir/$_output_name"