diff --git a/Cargo.toml b/Cargo.toml
index 10b1f72..d7883cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -9,6 +9,7 @@ license = "MIT OR Apache-2.0"
name = "xargo"
repository = "https://github.com/japaric/xargo"
version = "0.3.18"
+default-run = "xargo"
[dependencies]
error-chain = "0.7.2"
diff --git a/README.md b/README.md
index 65facb0..6402e39 100644
--- a/README.md
+++ b/README.md
@@ -309,6 +309,18 @@ git = "https://github.com/japaric/steed"
stage = 2
```
+## Check-only sysroot build
+
+Xargo supports performing a 'check build' of the syroot
+via the `xargo-check` command. This command is invoked exactly
+like `xargo`, but will invoke `cargo check` instead of `cargo build`
+when building the sysroot.
+
+This is only useful for very specialized applicationsm like Miri.
+The resulting libstd will *not* be useable in a normal build, since codegen
+will not be performed. You should almost always run `xargo check` (note the space),
+which will perform a normal sysroot build, followed by a 'check' build of *your application*
+
## Caveats / gotchas
- Xargo won't build a sysroot when used with stable or beta Rust. This is
diff --git a/ci/script.sh b/ci/script.sh
index edee9f0..83fe957 100644
--- a/ci/script.sh
+++ b/ci/script.sh
@@ -3,8 +3,14 @@ set -euxo pipefail
beginswith() { case $2 in "$1"*) true;; *) false;; esac; }
main() {
+ # We test against Cargo versions that don't support 'default-run'
+ # As a workaround, we remove 'default-run' from the Cargo.toml
+ # on CI
+ # Unfortunately, we can't use 'sed -i', as this doesn't work on OS X
+ sed 's/default-run = "xargo"//g' Cargo.toml > Cargo.toml.new
+ mv Cargo.toml.new Cargo.toml
cross build --target $TARGET --locked
- cross run --target $TARGET -- -V
+ cross run --bin xargo --target $TARGET -- -V
if beginswith nightly $TRAVIS_RUST_VERSION; then
cargo test --features dev --target $TARGET
diff --git a/src/bin/xargo-check.rs b/src/bin/xargo-check.rs
new file mode 100644
index 0000000..619c12e
--- /dev/null
+++ b/src/bin/xargo-check.rs
@@ -0,0 +1,3 @@
+fn main() {
+ xargo::main_inner(xargo::XargoMode::Check);
+}
diff --git a/src/bin/xargo.rs b/src/bin/xargo.rs
new file mode 100644
index 0000000..663421e
--- /dev/null
+++ b/src/bin/xargo.rs
@@ -0,0 +1,3 @@
+fn main() {
+ xargo::main_inner(xargo::XargoMode::Build);
+}
diff --git a/src/cargo.rs b/src/cargo.rs
index b347bce..d7fbdcf 100644
--- a/src/cargo.rs
+++ b/src/cargo.rs
@@ -10,6 +10,7 @@ use cli::Args;
use errors::*;
use extensions::CommandExt;
use util;
+use sysroot::XargoMode;
use xargo::Home;
pub struct Rustflags {
@@ -247,10 +248,15 @@ impl Root {
}
}
-pub fn root() -> Result