use exe/exepath in our genrules

Pull Request resolved: https://github.com/pytorch/pytorch/pull/79626

Buck does not properly handle caching when the executable is
identified with `$(location ...)`. See
https://fb.workplace.com/groups/askbuck/posts/8600146743367198 for
more information.

Differential Revision: [D37179273](https://our.internmc.facebook.com/intern/diff/D37179273/)

**NOTE FOR REVIEWERS**: This PR has internal Facebook specific changes or comments, please review them on [Phabricator](https://our.internmc.facebook.com/intern/diff/D37179273/)!

Approved by: https://github.com/malfet
This commit is contained in:
Michael Andreas Dagitses
2022-06-15 17:36:32 -07:00
committed by PyTorch MergeBot
parent 86606fbe22
commit e21c0ac9a5

View File

@ -46,7 +46,7 @@ def define_targets(rules):
] + rules.glob(["aten/src/ATen/templates/*"])
gen_aten_cmd = " ".join([
"$(location //torchgen:gen)",
"$(execpath //torchgen:gen)",
"--install_dir=$(RULEDIR)",
"--source-path aten/src/ATen",
] + (["--static_dispatch_backend CPU"] if rules.is_cpu_static_dispatch_build() else []))
@ -119,7 +119,7 @@ def define_targets(rules):
":version.txt",
],
outs = ["torch/csrc/api/include/torch/version.h"],
cmd = "$(location //tools/setup_helpers:gen_version_header) " +
cmd = "$(execpath //tools/setup_helpers:gen_version_header) " +
"--template-path $(location :torch/csrc/api/include/torch/version.h.in) " +
"--version-path $(location :version.txt) --output-path $@ ",
tools = ["//tools/setup_helpers:gen_version_header"],