1# Creates a symlink (or, on Windows, copies).
2# Args:
3#   source: Path to link to.
4#   output: Where to create the symlink.
5template("symlink_or_copy") {
6  action(target_name) {
7    forward_variables_from(invoker, [ "deps" ])
8
9    # Make a stamp file the output to work around
10    # https://github.com/ninja-build/ninja/issues/1186
11    stamp =
12        "$target_gen_dir/" + get_path_info(invoker.output, "file") + ".stamp"
13    outputs = [ stamp ]
14    script = "//llvm/utils/gn/build/symlink_or_copy.py"
15    args = [
16      "--stamp",
17      rebase_path(stamp, root_build_dir),
18      invoker.source,
19      rebase_path(invoker.output, root_build_dir),
20    ]
21  }
22}
23