Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: support relative TARGET_DIR in near-test-contracts
near-test-contracts builds some wasm contracts for use in testing. It does so by recursively invoking `cargo` from `build.rs`. Before this commit, we tried to re-use parent's `CARGO_TARGET_DIR` to figure out where we should put the data. That was rather hacky, as cargo doesn't expose that information to the build scripts in a reliable way: rust-lang/cargo#9661 (comment) Naturally, our hacks broken when when the `CARGO_TARGET_DIR` was set to a relative path, because build.rs doesn't know where workspace root lives. The fix is to use `OUT_DIR` rather than `CARGO_TARGET_DIR`, which I think is the supported way to this in the first place. Eg, the `cc` crate uses `OUT_DIR` to store intermediate `.o` files, which I think matches our use case pretty closely.
- Loading branch information