mirror of
https://github.com/rust-lang/cargo
synced 2024-09-13 21:11:44 +00:00
cbf25a9b0a
This commit adds a GNU make jobserver implementation to Cargo, both as a client of existing jobservers and also a creator of new jobservers. The jobserver is actually just an IPC semaphore which manifests itself as a pipe with N bytes of tokens on Unix and a literal IPC semaphore on Windows. The rough protocol is then if you want to run a job you read acquire the semaphore (read a byte on Unix or wait on the semaphore on Windows) and then you release it when you're done. All the hairy details of the jobserver implementation are housed in the `jobserver` crate on crates.io instead of Cargo. This should hopefully make it much easier for the compiler to also share a jobserver implementation eventually. The main tricky bit here is that on Unix and Windows acquiring a jobserver token will block the calling thread. We need to either way for a running job to exit or to acquire a new token when we want to spawn a new job. To handle this the current implementation spawns a helper thread that does the blocking and sends a message back to Cargo when it receives a token. It's a little trickier with shutting down this thread gracefully as well but more details can be found in the `jobserver` crate. Unfortunately crates are unlikely to see an immediate benefit of this once implemented. Most crates are run with a manual `make -jN` and this overrides the jobserver in the environment, creating a new jobserver in the sub-make. If the `-jN` argument is removed, however, then `make` will share Cargo's jobserver and properly limit parallelism. Closes #1744
70 lines
1.4 KiB
TOML
70 lines
1.4 KiB
TOML
[package]
|
|
name = "cargo"
|
|
version = "0.20.0"
|
|
authors = ["Yehuda Katz <wycats@gmail.com>",
|
|
"Carl Lerche <me@carllerche.com>",
|
|
"Alex Crichton <alex@alexcrichton.com>"]
|
|
license = "MIT/Apache-2.0"
|
|
homepage = "https://crates.io"
|
|
repository = "https://github.com/rust-lang/cargo"
|
|
documentation = "https://docs.rs/cargo"
|
|
description = """
|
|
Cargo, a package manager for Rust.
|
|
"""
|
|
|
|
[lib]
|
|
name = "cargo"
|
|
path = "src/cargo/lib.rs"
|
|
|
|
[dependencies]
|
|
crates-io = { path = "src/crates-io", version = "0.9" }
|
|
crossbeam = "0.2"
|
|
curl = "0.4.6"
|
|
docopt = "0.7"
|
|
env_logger = "0.4"
|
|
error-chain = "0.10.0"
|
|
filetime = "0.1"
|
|
flate2 = "0.2"
|
|
fs2 = "0.4"
|
|
git2 = "0.6"
|
|
git2-curl = "0.7"
|
|
glob = "0.2"
|
|
jobserver = "0.1.2"
|
|
libc = "0.2"
|
|
libgit2-sys = "0.6"
|
|
log = "0.3"
|
|
num_cpus = "1.0"
|
|
rustc-serialize = "0.3"
|
|
semver = { version = "0.7.0", features = ["serde"] }
|
|
serde = "1.0"
|
|
serde_derive = "1.0"
|
|
serde_ignored = "0.0.3"
|
|
serde_json = "1.0"
|
|
shell-escape = "0.1"
|
|
tar = { version = "0.4", default-features = false }
|
|
tempdir = "0.3"
|
|
term = "0.4.4"
|
|
toml = "0.4"
|
|
url = "1.1"
|
|
|
|
[target.'cfg(unix)'.dependencies]
|
|
openssl = "0.9"
|
|
|
|
[target.'cfg(windows)'.dependencies]
|
|
advapi32-sys = "0.2"
|
|
kernel32-sys = "0.2"
|
|
miow = "0.2"
|
|
psapi-sys = "0.1"
|
|
winapi = "0.2"
|
|
|
|
[dev-dependencies]
|
|
bufstream = "0.1"
|
|
cargotest = { path = "tests/cargotest" }
|
|
filetime = "0.1"
|
|
hamcrest = "=0.1.1"
|
|
|
|
[[bin]]
|
|
name = "cargo"
|
|
test = false
|
|
doc = false
|