]> git.proxmox.com Git - cargo.git/commit
Auto merge of #4764 - matklad:yo-dawg, r=alexcrichton
authorbors <bors@rust-lang.org>
Wed, 29 Nov 2017 20:57:15 +0000 (20:57 +0000)
committerbors <bors@rust-lang.org>
Wed, 29 Nov 2017 20:57:15 +0000 (20:57 +0000)
commitc01695721be8b7562365d4bf6f202642dddadb00
tree2c37c030c010b1a1de0e2c5f56998938b09fdfe7
parent806e487c0e3b6af6203ef8bebf5d6f49faf8909d
parent94db2d127a51d5b17d389dc29055c2df24314ec6
Auto merge of #4764 - matklad:yo-dawg, r=alexcrichton

Document that cargo sets `CARGO` for build scripts

This documents and tests the current behavior.

However, I have two questions:

* Do we support recursively invoking Cargo from the build script?

* Do we support recursively invoking Cargo on the crate's own sources (ie, stuff inside `CARGO_HOME` which gets extracted from `.crate` files, and which in general is not byte-equal to the original sources).

Here's an interesting problem that Servo faced:

* Servo is a workspace.
* Servo's `CARGO_HOME` is inside sources.
* One of Servo's deps uses cbindgen from build.rs
* cbindgen [invokes](https://github.com/eqrion/cbindgen/blob/ef3bd8d307f01ad1171ab69cf911b712fbd73583/src/bindgen/cargo/cargo_metadata.rs#L106) Cargo to read Cargo.toml from a crate inside CARGO_HOME (which is inside worksapce).

This all failed to work as expected, because Cargo invoked by bindgen thought that workspace configuration was wrong.

The problem was fixed on the Servo side by using `exclude` key for workspace.

But do we actually guarantee that this is supposed to work? :) If we do, we might want to apply fix suggested by @nox and avoid looking for workspace root if we are inside `CARGO_HOME`.

Note that cbindgen will probably be broken for crates which are workspaces themselves, because we rewrite members to path dependencies, but, if you have an explicit `members` key, `cargo metadata` inside such workspace in `CARGO_HOME` will complain.

Original IRC discussion: https://botbot.me/mozilla/cargo/2017-11-29/?msg=94061970&page=3

cc @nox