From 7d8ded9a1afa3775d14ee00fd12b30636d7a0a7f Mon Sep 17 00:00:00 2001 From: Fredrik Park Date: Wed, 13 Jul 2022 02:25:52 +0200 Subject: [PATCH] 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 --- sqlx-cli/src/prepare.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/sqlx-cli/src/prepare.rs b/sqlx-cli/src/prepare.rs index d3bddef5c..1061b8243 100644 --- a/sqlx-cli/src/prepare.rs +++ b/sqlx-cli/src/prepare.rs @@ -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()? };