about summary refs log tree commit diff
path: root/src/tools
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-02-07 22:54:25 -0500
committerGitHub <noreply@github.com>2017-02-07 22:54:25 -0500
commit6fb57bf13fcc316ce622af70d3922ae5d811928d (patch)
tree9768f794e9c3f6afd5922540a2f1aed98618f96b /src/tools
parent3d8fa5af213e24e83ded9dbed15572045c27fbbf (diff)
parentc8e0d04878f38e8a91e7a6196fb18878da208887 (diff)
downloadrust-6fb57bf13fcc316ce622af70d3922ae5d811928d.tar.gz
rust-6fb57bf13fcc316ce622af70d3922ae5d811928d.zip
Rollup merge of #39431 - alexcrichton:no-more-makefiles, r=brson
Delete the makefile build system

This PR deletes the makefile build system in favor of the rustbuild build system. The beta has now been branched so 1.16 will continue to be buildable from the makefiles, but going forward 1.17 will only be buildable with rustbuild.

Rustbuild has been the default build system [since 1.15.0](https://github.com/rust-lang/rust/pull/37817) and the makefiles were [proposed for deletion](https://internals.rust-lang.org/t/proposal-for-promoting-rustbuild-to-official-status/4368) at this time back in November of last year.

And now with the deletion of these makefiles we can start getting those sweet sweet improvements of using crates.io crates in the compiler!
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/compiletest/Cargo.toml2
-rw-r--r--src/tools/compiletest/build.rs13
-rw-r--r--src/tools/compiletest/src/header.rs6
-rw-r--r--src/tools/compiletest/src/main.rs53
-rw-r--r--src/tools/compiletest/src/runtest.rs2
5 files changed, 49 insertions, 27 deletions
diff --git a/src/tools/compiletest/Cargo.toml b/src/tools/compiletest/Cargo.toml
index 2982f29f931..1fc98a78a7c 100644
--- a/src/tools/compiletest/Cargo.toml
+++ b/src/tools/compiletest/Cargo.toml
@@ -2,9 +2,9 @@
 authors = ["The Rust Project Developers"]
 name = "compiletest"
 version = "0.0.0"
-build = "build.rs"
 
 [dependencies]
 log = "0.3"
 env_logger = { version = "0.3.5", default-features = false }
 rustc-serialize = "0.3"
+filetime = "0.1"
diff --git a/src/tools/compiletest/build.rs b/src/tools/compiletest/build.rs
deleted file mode 100644
index d5164b9b759..00000000000
--- a/src/tools/compiletest/build.rs
+++ /dev/null
@@ -1,13 +0,0 @@
-// 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.
-
-fn main() {
-    println!("cargo:rustc-cfg=cargobuild");
-}
diff --git a/src/tools/compiletest/src/header.rs b/src/tools/compiletest/src/header.rs
index 71d8d62c75b..522cd222c26 100644
--- a/src/tools/compiletest/src/header.rs
+++ b/src/tools/compiletest/src/header.rs
@@ -25,6 +25,7 @@ use extract_gdb_version;
 pub struct EarlyProps {
     pub ignore: bool,
     pub should_fail: bool,
+    pub aux: Vec<String>,
 }
 
 impl EarlyProps {
@@ -32,6 +33,7 @@ impl EarlyProps {
         let mut props = EarlyProps {
             ignore: false,
             should_fail: false,
+            aux: Vec::new(),
         };
 
         iter_header(testfile,
@@ -50,6 +52,10 @@ impl EarlyProps {
                 ignore_lldb(config, ln) ||
                 ignore_llvm(config, ln);
 
+            if let Some(s) = parse_aux_build(ln) {
+                props.aux.push(s);
+            }
+
             props.should_fail = props.should_fail || parse_name_directive(ln, "should-fail");
         });
 
diff --git a/src/tools/compiletest/src/main.rs b/src/tools/compiletest/src/main.rs
index 40ba66a15d5..5a97f7e3ee9 100644
--- a/src/tools/compiletest/src/main.rs
+++ b/src/tools/compiletest/src/main.rs
@@ -21,17 +21,11 @@
 extern crate libc;
 extern crate test;
 extern crate getopts;
-
-#[cfg(cargobuild)]
 extern crate rustc_serialize;
-#[cfg(not(cargobuild))]
-extern crate serialize as rustc_serialize;
-
 #[macro_use]
 extern crate log;
-
-#[cfg(cargobuild)]
 extern crate env_logger;
+extern crate filetime;
 
 use std::env;
 use std::ffi::OsString;
@@ -39,6 +33,7 @@ use std::fs;
 use std::io;
 use std::path::{Path, PathBuf};
 use std::process::Command;
+use filetime::FileTime;
 use getopts::{optopt, optflag, reqopt};
 use common::Config;
 use common::{Pretty, DebugInfoGdb, DebugInfoLldb, Mode};
@@ -58,11 +53,7 @@ mod raise_fd_limit;
 mod uidiff;
 
 fn main() {
-    #[cfg(cargobuild)]
-    fn log_init() { env_logger::init().unwrap(); }
-    #[cfg(not(cargobuild))]
-    fn log_init() {}
-    log_init();
+    env_logger::init().unwrap();
 
     let config = parse_config(env::args().collect());
 
@@ -478,7 +469,7 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     };
 
     // Debugging emscripten code doesn't make sense today
-    let mut ignore = early_props.ignore;
+    let mut ignore = early_props.ignore || !up_to_date(config, testpaths, &early_props);
     if (config.mode == DebugInfoGdb || config.mode == DebugInfoLldb) &&
         config.target.contains("emscripten") {
         ignore = true;
@@ -494,6 +485,42 @@ pub fn make_test(config: &Config, testpaths: &TestPaths) -> test::TestDescAndFn
     }
 }
 
+fn stamp(config: &Config, testpaths: &TestPaths) -> PathBuf {
+    let stamp_name = format!("{}-H-{}-T-{}-S-{}.stamp",
+                             testpaths.file.file_name().unwrap()
+                                           .to_str().unwrap(),
+                             config.host,
+                             config.target,
+                             config.stage_id);
+    config.build_base.canonicalize()
+          .unwrap_or(config.build_base.clone())
+          .join(stamp_name)
+}
+
+fn up_to_date(config: &Config, testpaths: &TestPaths, props: &EarlyProps) -> bool {
+    let stamp = mtime(&stamp(config, testpaths));
+    let mut inputs = vec![
+        mtime(&testpaths.file),
+        mtime(&config.rustc_path),
+    ];
+    for aux in props.aux.iter() {
+        inputs.push(mtime(&testpaths.file.parent().unwrap()
+                                         .join("auxiliary")
+                                         .join(aux)));
+    }
+    for lib in config.run_lib_path.read_dir().unwrap() {
+        let lib = lib.unwrap();
+        inputs.push(mtime(&lib.path()));
+    }
+    inputs.iter().any(|input| *input > stamp)
+}
+
+fn mtime(path: &Path) -> FileTime {
+    fs::metadata(path).map(|f| {
+        FileTime::from_last_modification_time(&f)
+    }).unwrap_or(FileTime::zero())
+}
+
 pub fn make_test_name(config: &Config, testpaths: &TestPaths) -> test::TestName {
     // Convert a complete path to something like
     //
diff --git a/src/tools/compiletest/src/runtest.rs b/src/tools/compiletest/src/runtest.rs
index 9f7d4157931..bcec1f63bc0 100644
--- a/src/tools/compiletest/src/runtest.rs
+++ b/src/tools/compiletest/src/runtest.rs
@@ -80,6 +80,8 @@ pub fn run(config: Config, testpaths: &TestPaths) {
     }
 
     base_cx.complete_all();
+
+    File::create(::stamp(&config, &testpaths)).unwrap();
 }
 
 struct TestCx<'test> {