Re: Specifying the location of the Cargo.lock file

Can you avoid placing Cargo.lock inside the source tree for packages that don't ship with one?

In response to the thread in Specifying the location of the Cargo.lock file I can offer a solution: Define your SOURCE_DIR and BUILD_DIR environment variables as appropriate and run the following:

mkdir -p "$BUILD_DIR" && cd "$BUILD_DIR"
ln -s "$SOURCE_DIR" $(basename "$SOURCE_DIR")
printf "[workspace]\nmembers = [ \"%s\" ]\n" $(basename $SOURCE_DIR) > "Cargo.toml"
cargo build

The above makes the build directory into a workspace; to account for the fact that the source and build directories may not be hierarchically inside one another, we use a symlink to fool cargo into completing the build anyway.

That's what I'm doing above :+1: