about summary refs log tree commit diff
path: root/src/bootstrap/rustdoc.rs
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2016-03-07 23:11:05 -0800
committerAlex Crichton <alex@alexcrichton.com>2016-03-08 11:52:11 -0800
commitf7b7535fd7cc4df3c137c5ce05bcd9817e8e006c (patch)
treeef2be61e27138c1c0ada43a14790ae5c2e140720 /src/bootstrap/rustdoc.rs
parent0788cd23ea6e3f1b05240d591870899b9d38f5f4 (diff)
downloadrust-f7b7535fd7cc4df3c137c5ce05bcd9817e8e006c.tar.gz
rust-f7b7535fd7cc4df3c137c5ce05bcd9817e8e006c.zip
rustbuild: Fixup calling rustdoc in various stages
The stage0 rustdoc comes from the snapshot, and we need a shim like with `rustc`
to pass `--cfg` for now.
Diffstat (limited to 'src/bootstrap/rustdoc.rs')
-rw-r--r--src/bootstrap/rustdoc.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/bootstrap/rustdoc.rs b/src/bootstrap/rustdoc.rs
new file mode 100644
index 00000000000..8c618196113
--- /dev/null
+++ b/src/bootstrap/rustdoc.rs
@@ -0,0 +1,31 @@
+// Copyright 2016 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+//! Shim which is passed to Cargo as "rustdoc" when running the bootstrap.
+//!
+//! See comments in `src/bootstrap/rustc.rs` for more information.
+
+use std::env;
+use std::process::Command;
+
+fn main() {
+    let args = env::args_os().skip(1).collect::<Vec<_>>();
+    let rustdoc = env::var_os("RUSTDOC_REAL").unwrap();
+
+    let mut cmd = Command::new(rustdoc);
+    cmd.args(&args)
+       .arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap()))
+       .arg("--cfg").arg("dox");
+    std::process::exit(match cmd.status() {
+        Ok(s) => s.code().unwrap_or(1),
+        Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
+    })
+}
+