Skip to content

Commit

Permalink
Auto merge of #34677 - alexcrichton:no-more-build-directory, r=brson
Browse files Browse the repository at this point in the history
rustbuild: Remove the `build` directory

The organization in rustbuild was a little odd at the moment where the `lib.rs`
was quite small but the binary `main.rs` was much larger. Unfortunately as well
there was a `build/` directory with the implementation of the build system, but
this directory was ignored by GitHub on the file-search prompt which was a
little annoying.

This commit reorganizes rustbuild slightly where all the library files (the
build system) is located directly inside of `src/bootstrap` and all the binaries
now live in `src/bootstrap/bin` (they're small). Hopefully this should allow
GitHub to index and allow navigating all the files while maintaining a
relatively similar layout to the other libraries in `src/`.
  • Loading branch information
bors authored Jul 7, 2016
2 parents 9c1783a + 48a07bf commit 4cf97fe
Show file tree
Hide file tree
Showing 20 changed files with 909 additions and 930 deletions.
6 changes: 3 additions & 3 deletions src/bootstrap/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ path = "lib.rs"

[[bin]]
name = "bootstrap"
path = "main.rs"
path = "bin/main.rs"

[[bin]]
name = "rustc"
path = "rustc.rs"
path = "bin/rustc.rs"

[[bin]]
name = "rustdoc"
path = "rustdoc.rs"
path = "bin/rustdoc.rs"

[dependencies]
build_helper = { path = "../build_helper" }
Expand Down
14 changes: 1 addition & 13 deletions src/bootstrap/main.rs → src/bootstrap/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,22 +18,10 @@
#![deny(warnings)]

extern crate bootstrap;
extern crate build_helper;
extern crate cmake;
extern crate filetime;
extern crate gcc;
extern crate getopts;
extern crate libc;
extern crate num_cpus;
extern crate rustc_serialize;
extern crate toml;
extern crate md5;

use std::env;

use build::{Flags, Config, Build};

mod build;
use bootstrap::{Flags, Config, Build};

fn main() {
let args = env::args().skip(1).collect::<Vec<_>>();
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/rustc.rs → src/bootstrap/bin/rustc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,13 +53,14 @@ fn main() {

let rustc = env::var_os(rustc).unwrap();
let libdir = env::var_os(libdir).unwrap();
let mut dylib_path = bootstrap::dylib_path();
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

let mut cmd = Command::new(rustc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", stage))
.env(bootstrap::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());

if let Some(target) = target {
// The stage0 compiler has a special sysroot distinct from what we
Expand Down
5 changes: 3 additions & 2 deletions src/bootstrap/rustdoc.rs → src/bootstrap/bin/rustdoc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,15 @@ fn main() {
let rustdoc = env::var_os("RUSTDOC_REAL").unwrap();
let libdir = env::var_os("RUSTC_LIBDIR").unwrap();

let mut dylib_path = bootstrap::dylib_path();
let mut dylib_path = bootstrap::util::dylib_path();
dylib_path.insert(0, PathBuf::from(libdir));

let mut cmd = Command::new(rustdoc);
cmd.args(&args)
.arg("--cfg").arg(format!("stage{}", env::var("RUSTC_STAGE").unwrap()))
.arg("--cfg").arg("dox")
.env(bootstrap::dylib_path_var(), env::join_paths(&dylib_path).unwrap());
.env(bootstrap::util::dylib_path_var(),
env::join_paths(&dylib_path).unwrap());
std::process::exit(match cmd.status() {
Ok(s) => s.code().unwrap_or(1),
Err(e) => panic!("\n\nfailed to run {:?}: {}\n\n", cmd, e),
Expand Down
Loading

0 comments on commit 4cf97fe

Please sign in to comment.