Skip to content

Commit

Permalink
Set CARGO_TARGET_DIR when compiling the prepare queries (#1910)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sedrik authored Jul 13, 2022
1 parent 6de3e09 commit 7d8ded9
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions sqlx-cli/src/prepare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()?
};

Expand Down

1 comment on commit 7d8ded9

@ivan
Copy link
Contributor

@ivan ivan commented on 7d8ded9 Jul 14, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.