Skip to content

Commit

Permalink
Set cargo cwd to manifest dir, workaround for cargo issue 10098
Browse files Browse the repository at this point in the history
Cargo documentation for configuration toml says that a .cargo/config
checked into revision control in the project root should be picked up by
cargo, but in fact cargo only searches relative to cwd.  In order to
achieve the documented result, cargo needs to be invoked with the
current working directory already set to the directory containing the
manifest file.

see rust-lang/cargo#10098
  • Loading branch information
William Page committed Jul 26, 2022
1 parent c654f5c commit 9c1b9d9
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion classes/cargo.bbclass
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ oe_cargo_build () {
bbnote "cargo = $(which ${CARGO})"
bbnote "rustc = $(which ${RUSTC})"
bbnote "${CARGO} build ${CARGO_BUILD_FLAGS} $@"
"${CARGO}" build ${CARGO_BUILD_FLAGS} "$@"
# This is needed to pick up .cargo/config.toml in the project git root
# see https://github.com/rust-lang/cargo/issues/10098
CARGO_WORKINGDIR="$(dirname "${MANIFEST_PATH}")"
(cd "${CARGO_WORKINGDIR}"; "${CARGO}" build ${CARGO_BUILD_FLAGS} "$@")
}

do_compile[progress] = "outof:\s+(\d+)/(\d+)"
Expand Down

0 comments on commit 9c1b9d9

Please sign in to comment.