Set CARGO_TARGET_DIR when compiling the prepare queries (#1910)

* Move compiled query data

I did try to set rustc's --out-dir but encountered a strange error
stating that it can not be set more than once (even though I am unable
to deduce what else is setting it).

This enabled me to set a custom CARGO_TARGET_DIR and still be able to
prepare queries.

* Set CARGO_TARGET_DIR in the rustc invocation
This commit is contained in:
Fredrik Park 2022-07-13 02:25:52 +02:00 committed by GitHub
parent 6de3e09816
commit 7d8ded9a1a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -172,6 +172,7 @@ hint: This command only works in the manifest directory of a Cargo package."#
))
.env("SQLX_OFFLINE", "false")
.env("DATABASE_URL", url)
.env("CARGO_TARGET_DIR", metadata.target_directory.clone())
.status()?
};