2016-03-07 23:11:05 -08:00
|
|
|
// 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.
|
|
|
|
|
|
2016-04-29 14:23:15 -07:00
|
|
|
extern crate bootstrap;
|
|
|
|
|
|
2016-03-07 23:11:05 -08:00
|
|
|
use std::env;
|
|
|
|
|
use std::process::Command;
|
2016-04-29 14:23:15 -07:00
|
|
|
use std::path::PathBuf;
|
2016-03-07 23:11:05 -08:00
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
|
let args = env::args_os().skip(1).collect::<Vec<_>>();
|
2016-09-25 11:59:12 -04:00
|
|
|
let rustdoc = env::var_os("RUSTDOC_REAL").expect("RUSTDOC_REAL was not set");
|
|
|
|
|
let libdir = env::var_os("RUSTC_LIBDIR").expect("RUSTC_LIBDIR was not set");
|
|
|
|
|
let stage = env::var("RUSTC_STAGE").expect("RUSTC_STAGE was not set");
|
2016-04-29 14:23:15 -07:00
|
|
|
|
2016-07-05 21:58:20 -07:00
|
|
|
let mut dylib_path = bootstrap::util::dylib_path();
|
2016-04-29 14:23:15 -07:00
|
|
|
dylib_path.insert(0, PathBuf::from(libdir));
|
2016-03-07 23:11:05 -08:00
|
|
|
|
|
|
|
|
let mut cmd = Command::new(rustdoc);
|
|
|
|
|
cmd.args(&args)
|
2016-09-25 11:59:12 -04:00
|
|
|
.arg("--cfg").arg(format!("stage{}", stage))
|
2016-04-29 14:23:15 -07:00
|
|
|
.arg("--cfg").arg("dox")
|
2016-07-05 21:58:20 -07:00
|
|
|
.env(bootstrap::util::dylib_path_var(),
|
|
|
|
|
env::join_paths(&dylib_path).unwrap());
|
2016-03-07 23:11:05 -08:00
|
|
|
std::process::exit(match cmd.status() {
|
|
|
|
|
Ok(s) => s.code().unwrap_or(1),
|
|
|
|
|
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
|
|
|
|
|
})
|
|
|
|
|
}
|