rust-lang/cargo — pull request #1107 by tomaka (2014-12-30 18:04:10+00:00)
Title: Build a CommandPrototype instead of a ProcessBuilder

The various commands in Cargo now build a `CommandPrototype` instead of a `ProcessBuilder`.

This `CommandPrototype` is then passed to an object that implements the `CommandsExecution` trait to be executed.

Ideally `CommandPrototype` would look like this:

```rust
enum CommandPrototype {
Rustc {
libraries: Vec,
opt_level: uint,
... etc... (all the options that can be passed to rustc)
},
Rustc {
... (all the options that can be passed to rustdoc)
},
Custom {
cmd: ...,
env: ...,
}
}
```

...but that's a bit too much work.

What this enables is using the Cargo library to intercept the build commands and tweak them. I'm planning to write `cargo-emscripten` and `cargo-android` thanks to this change.

With this, you could also imagine embedding rustc and rustdoc directly inside cargo, if that is needed.