Fixes #414: Add rustc + libs to action inputs, add LD_LIBRARY_PATH so that rustc finds its libs on Linux, too.
--
MOS_MIGRATED_REVID=102362939
diff --git a/tools/build_rules/rust/rust.bzl b/tools/build_rules/rust/rust.bzl
index 847775d..943c6c7 100644
--- a/tools/build_rules/rust/rust.bzl
+++ b/tools/build_rules/rust/rust.bzl
@@ -141,6 +141,7 @@
return " ".join([
"set -e;",
" ".join(depinfo.setup_cmd),
+ "LD_LIBRARY_PATH=" + rustc_lib_path,
"DYLD_LIBRARY_PATH=" + rustc_lib_path,
rustc_path + " " + src,
"--crate-name " + ctx.label.name,
@@ -191,7 +192,8 @@
# Compile action.
ctx.action(
- inputs = srcs + ctx.files.data + depinfo.libs,
+ inputs = srcs + ctx.files.data + depinfo.libs + [ctx.file._rustc] +
+ ctx.files._rustc_lib + ctx.files._rustlib,
outputs = [rust_lib],
mnemonic = 'Rustc',
command = cmd,
@@ -239,7 +241,8 @@
# Compile action.
ctx.action(
- inputs = srcs + ctx.files.data + depinfo.libs,
+ inputs = srcs + ctx.files.data + depinfo.libs + [ctx.file._rustc] +
+ ctx.files._rustc_lib + ctx.files._rustlib,
outputs = [rust_binary],
mnemonic = 'Rustc',
command = cmd,