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) { |
11 forward_variables_from(invoker, | 11 forward_variables_from(invoker, |
12 [ | 12 [ |
13 "deps", | 13 "deps", |
14 "testonly", | 14 "testonly", |
15 "visibility", | 15 "visibility", |
16 ]) | 16 ]) |
| 17 |
| 18 # Can't use the symlink itself as an output since ninja does not properly |
| 19 # process the symlink's mtime. |
| 20 # https://github.com/ninja-build/ninja/issues/1186 |
17 outputs = [ | 21 outputs = [ |
18 invoker.output, | 22 "$target_gen_dir/$target_name.stamp", |
19 ] | 23 ] |
20 script = "//build/symlink.py" | 24 script = "//build/symlink.py" |
21 args = [ | 25 args = [ |
| 26 "--touch", |
| 27 rebase_path(outputs[0], root_build_dir), |
22 "-f", | 28 "-f", |
23 rebase_path(invoker.source, get_path_info(invoker.output, "dir")), | 29 rebase_path(invoker.source, get_path_info(invoker.output, "dir")), |
24 rebase_path(invoker.output, root_build_dir), | 30 rebase_path(invoker.output, root_build_dir), |
25 ] | 31 ] |
26 } | 32 } |
27 } | 33 } |
28 | 34 |
29 # Creates a symlink from root_build_dir/target_name to |binary_label|. This rule | 35 # 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 | 36 # is meant to be used within if (current_toolchain == default_toolchain) blocks |
31 # and point to targets in the non-default toolchain. | 37 # and point to targets in the non-default toolchain. |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 } | 75 } |
70 source = "$_out_dir/$_name" | 76 source = "$_out_dir/$_name" |
71 | 77 |
72 _output_name = _name | 78 _output_name = _name |
73 if (defined(invoker.output_name)) { | 79 if (defined(invoker.output_name)) { |
74 _output_name = invoker.output_name | 80 _output_name = invoker.output_name |
75 } | 81 } |
76 output = "$root_out_dir/$_output_name" | 82 output = "$root_out_dir/$_output_name" |
77 } | 83 } |
78 } | 84 } |
OLD | NEW |