Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rollup of 6 pull requests #40249

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
3aa6f18
add unstable book to the bookshelf
steveklabnik Feb 28, 2017
accc7f4
LLVM: Update submodule to include x86-interrupt ABI patches
phil-opp Mar 2, 2017
ae2c9d2
fix link
steveklabnik Mar 2, 2017
1844a9c
remove reference
steveklabnik Mar 2, 2017
52f3dc1
import reference submodule
steveklabnik Mar 2, 2017
b601b75
Restore creating the channel-rust-$channel-date.txt files
shepmaster Mar 3, 2017
893ad1c
Add/remove `rerun-if-changed` when necessary
petrochenkov Feb 23, 2017
a9956e2
Support combination MSVC + Ninja
petrochenkov Feb 27, 2017
2c1903b
Build compiler-rt and sanitizers only once
petrochenkov Mar 2, 2017
f2864aa
run-make on MSVC: Do not generate object files in the source directory
petrochenkov Mar 3, 2017
57e4397
bootstrap.py: Report build status
petrochenkov Mar 3, 2017
5a148b5
Separate "ui-fulldeps" tests from "ui" tests
petrochenkov Mar 3, 2017
60fb577
Do not purge LLVM build directory on rebuild
petrochenkov Mar 3, 2017
f7b7c1e
Issue #39688 - Help people find String::as_bytes() for UTF-8 r? @stev…
jdhorwitz Mar 3, 2017
384f64a
Automate timestamp creation and build skipping for native libraries
petrochenkov Mar 3, 2017
ed42b07
Rollup merge of #40154 - steveklabnik:link-unstable-book, r=frewsxcv
frewsxcv Mar 3, 2017
8691453
Rollup merge of #40207 - phil-opp:llvm-submodule-update, r=alexcrichton
frewsxcv Mar 3, 2017
478b8e2
Rollup merge of #40213 - steveklabnik:extract-reference, r=alexcrichton
frewsxcv Mar 3, 2017
4f930fc
Rollup merge of #40225 - shepmaster:restore-build-date-file, r=alexcr…
frewsxcv Mar 3, 2017
9f9c2eb
Rollup merge of #40226 - jdhorwitz:master, r=steveklabnik
frewsxcv Mar 3, 2017
6efb3b2
Rollup merge of #40236 - petrochenkov:btweak, r=alexcrichton
frewsxcv Mar 3, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,6 @@
[submodule "src/liblibc"]
path = src/liblibc
url = https://github.com/rust-lang/libc.git
[submodule "reference"]
path = src/doc/reference
url = https://github.com/rust-lang-nursery/reference.git
15 changes: 8 additions & 7 deletions src/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 15 additions & 6 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
# option. This file may not be copied, modified, or distributed
# except according to those terms.

from __future__ import print_function
import argparse
import contextlib
import datetime
Expand Down Expand Up @@ -501,7 +502,7 @@ def build_triple(self):

return "{}-{}".format(cputype, ostype)

def main():
def bootstrap():
parser = argparse.ArgumentParser(description='Build rust')
parser.add_argument('--config')
parser.add_argument('--clean', action='store_true')
Expand Down Expand Up @@ -564,8 +565,6 @@ def main():
rb._rustc_channel, rb._rustc_date = data['rustc'].split('-', 1)
rb._cargo_rev = data['cargo']

start_time = time()

# Fetch/build the bootstrap
rb.build = rb.build_triple()
rb.download_stage0()
Expand All @@ -582,9 +581,19 @@ def main():
env["BOOTSTRAP_PARENT_ID"] = str(os.getpid())
rb.run(args, env)

end_time = time()

print("Build completed in %s" % format_build_time(end_time - start_time))
def main():
start_time = time()
try:
bootstrap()
print("Build completed successfully in %s" % format_build_time(time() - start_time))
except (SystemExit, KeyboardInterrupt) as e:
if hasattr(e, 'code') and isinstance(e.code, int):
exit_code = e.code
else:
exit_code = 1
print(e)
print("Build completed unsuccessfully in %s" % format_build_time(time() - start_time))
sys.exit(exit_code)

if __name__ == '__main__':
main()
2 changes: 1 addition & 1 deletion src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ impl Build {
} else {
let base = self.llvm_out(&self.config.build).join("build");
let exe = exe("FileCheck", target);
if self.config.build.contains("msvc") {
if !self.config.ninja && self.config.build.contains("msvc") {
base.join("Release/bin").join(exe)
} else {
base.join("bin").join(exe)
Expand Down
36 changes: 21 additions & 15 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,28 +41,32 @@ pub fn llvm(build: &Build, target: &str) {
}
}

// If the cleaning trigger is newer than our built artifacts (or if the
// artifacts are missing) then we keep going, otherwise we bail out.
let dst = build.llvm_out(target);
let stamp = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
let mut stamp_contents = String::new();
t!(t!(File::open(&stamp)).read_to_string(&mut stamp_contents));
let done_stamp = dst.join("llvm-finished-building");
let clean_trigger = build.src.join("src/rustllvm/llvm-auto-clean-trigger");
let mut clean_trigger_contents = String::new();
t!(t!(File::open(&clean_trigger)).read_to_string(&mut clean_trigger_contents));

let out_dir = build.llvm_out(target);
let done_stamp = out_dir.join("llvm-finished-building");
if done_stamp.exists() {
let mut done_contents = String::new();
t!(t!(File::open(&done_stamp)).read_to_string(&mut done_contents));
if done_contents == stamp_contents {

// LLVM was already built previously.
// We don't track changes in LLVM sources, so we need to choose between reusing
// what was built previously, or cleaning the directory and doing a fresh build.
// The choice depends on contents of the clean-trigger file.
// If the contents are the same as during the previous build, then no action is required.
// If the contents differ from the previous build, then cleaning is triggered.
if done_contents == clean_trigger_contents {
return
} else {
t!(fs::remove_dir_all(&out_dir));
}
}
drop(fs::remove_dir_all(&dst));

println!("Building LLVM for {}", target);

let _time = util::timeit();
let _ = fs::remove_dir_all(&dst.join("build"));
t!(fs::create_dir_all(&dst.join("build")));
let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};
t!(fs::create_dir_all(&out_dir));

// http://llvm.org/docs/CMake.html
let mut cfg = cmake::Config::new(build.src.join("src/llvm"));
Expand All @@ -82,9 +86,11 @@ pub fn llvm(build: &Build, target: &str) {
None => "X86;ARM;AArch64;Mips;PowerPC;SystemZ;JSBackend;MSP430;Sparc;NVPTX",
};

let assertions = if build.config.llvm_assertions {"ON"} else {"OFF"};

cfg.target(target)
.host(&build.config.build)
.out_dir(&dst)
.out_dir(&out_dir)
.profile(profile)
.define("LLVM_ENABLE_ASSERTIONS", assertions)
.define("LLVM_TARGETS_TO_BUILD", llvm_targets)
Expand Down Expand Up @@ -142,7 +148,7 @@ pub fn llvm(build: &Build, target: &str) {
// tools and libs on all platforms.
cfg.build();

t!(t!(File::create(&done_stamp)).write_all(stamp_contents.as_bytes()));
t!(t!(File::create(&done_stamp)).write_all(clean_trigger_contents.as_bytes()));
}

fn check_llvm_version(build: &Build, llvm_config: &Path) {
Expand Down
6 changes: 4 additions & 2 deletions src/bootstrap/step.rs
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
});
};

suite("check-ui", "src/test/ui", "ui", "ui");
suite("check-rpass", "src/test/run-pass", "run-pass", "run-pass");
suite("check-cfail", "src/test/compile-fail", "compile-fail", "compile-fail");
suite("check-pfail", "src/test/parse-fail", "parse-fail", "parse-fail");
Expand Down Expand Up @@ -362,7 +363,7 @@ pub fn build_rules<'a>(build: &'a Build) -> Rules {
});
};

suite("check-ui", "src/test/ui", "ui", "ui");
suite("check-ui-full", "src/test/ui-fulldeps", "ui", "ui-fulldeps");
suite("check-rpass-full", "src/test/run-pass-fulldeps",
"run-pass", "run-pass-fulldeps");
suite("check-rfail-full", "src/test/run-fail-fulldeps",
Expand Down Expand Up @@ -1504,7 +1505,8 @@ mod tests {
assert!(plan.iter().all(|s| s.host == "A"));
assert!(plan.iter().all(|s| s.target == "C"));

assert!(!plan.iter().any(|s| s.name.contains("-ui")));
assert!(plan.iter().any(|s| s.name.contains("-ui")));
assert!(!plan.iter().any(|s| s.name.contains("ui-full")));
assert!(plan.iter().any(|s| s.name.contains("cfail")));
assert!(!plan.iter().any(|s| s.name.contains("cfail-full")));
assert!(plan.iter().any(|s| s.name.contains("codegen-units")));
Expand Down
44 changes: 43 additions & 1 deletion src/build_helper/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@

extern crate filetime;

use std::fs;
use std::{fs, env};
use std::fs::File;
use std::process::{Command, Stdio};
use std::path::{Path, PathBuf};

Expand Down Expand Up @@ -148,6 +149,47 @@ pub fn up_to_date(src: &Path, dst: &Path) -> bool {
}
}

#[must_use]
pub struct NativeLibBoilerplate {
pub src_dir: PathBuf,
pub out_dir: PathBuf,
}

impl Drop for NativeLibBoilerplate {
fn drop(&mut self) {
t!(File::create(self.out_dir.join("rustbuild.timestamp")));
}
}

// Perform standard preparations for native libraries that are build only once for all stages.
// Emit rerun-if-changed and linking attributes for Cargo, check if any source files are
// updated, calculate paths used later in actual build with CMake/make or C/C++ compiler.
// If Err is returned, then everything is up-to-date and further build actions can be skipped.
// Timestamps are created automatically when the result of `native_lib_boilerplate` goes out
// of scope, so all the build actions should be completed until then.
pub fn native_lib_boilerplate(src_name: &str,
out_name: &str,
link_name: &str,
search_subdir: &str)
-> Result<NativeLibBoilerplate, ()> {
let current_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap());
let src_dir = current_dir.join("..").join(src_name);
rerun_if_changed_anything_in_dir(&src_dir);

let out_dir = env::var_os("RUSTBUILD_NATIVE_DIR").unwrap_or(env::var_os("OUT_DIR").unwrap());
let out_dir = PathBuf::from(out_dir).join(out_name);
let _ = fs::create_dir_all(&out_dir);
println!("cargo:rustc-link-lib=static={}", link_name);
println!("cargo:rustc-link-search=native={}", out_dir.join(search_subdir).display());

let timestamp = out_dir.join("rustbuild.timestamp");
if !up_to_date(Path::new("build.rs"), &timestamp) || !up_to_date(&src_dir, &timestamp) {
Ok(NativeLibBoilerplate { src_dir: src_dir, out_dir: out_dir })
} else {
Err(())
}
}

fn dir_up_to_date(src: &Path, threshold: &FileTime) -> bool {
t!(fs::read_dir(src)).map(|e| t!(e)).all(|e| {
let meta = t!(e.metadata());
Expand Down
2 changes: 2 additions & 0 deletions src/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Rust provides a number of book-length sets of documentation, collectively
nicknamed 'The Rust Bookshelf.'

* [The Rust Programming Language][book] teaches you how to program in Rust.
* [The Unstable Book][unstable-book] has documentation for unstable features.
* [The Rustonomicon][nomicon] is your guidebook to the dark arts of unsafe Rust.
* [The Reference][ref] is not a formal spec, but is more detailed and comprehensive than the book.

Expand All @@ -44,4 +45,5 @@ landed before then. That work is being tracked [here][38643].
[err]: error-index.html
[book]: book/index.html
[nomicon]: nomicon/index.html
[unstable-book]: unstable-book/index.html

1 change: 1 addition & 0 deletions src/doc/reference
Submodule reference added at 2d23ea
1 change: 0 additions & 1 deletion src/doc/reference/.gitignore

This file was deleted.

58 changes: 0 additions & 58 deletions src/doc/reference/src/SUMMARY.md

This file was deleted.

Loading