Remove rayon from the build.

This commit is contained in:
Brian Smith 2018-05-14 18:18:32 -10:00
parent 15299b61c5
commit d8a13d64e2
3 changed files with 10 additions and 33 deletions

View File

@ -285,7 +285,6 @@ lazy_static = "1.0"
# parallelism ourself. This gives us a much higher level of # parallelism ourself. This gives us a much higher level of
# control about what should be parallised in which way # control about what should be parallised in which way
cc = "1.0.9" cc = "1.0.9"
rayon = "1.0.0"
[features] [features]
# These features are documented in the top-level module's documentation. # These features are documented in the top-level module's documentation.

View File

@ -37,7 +37,6 @@
)] )]
extern crate cc; extern crate cc;
extern crate rayon;
// In the `pregenerate_asm_main()` case we don't want to access (Cargo) // In the `pregenerate_asm_main()` case we don't want to access (Cargo)
// environment variables at all, so avoid `use std::env` here. // environment variables at all, so avoid `use std::env` here.
@ -46,8 +45,6 @@ use std::path::{Path, PathBuf};
use std::process::Command; use std::process::Command;
use std::fs::{self, DirEntry}; use std::fs::{self, DirEntry};
use std::time::SystemTime; use std::time::SystemTime;
use rayon::iter::{ParallelIterator, IndexedParallelIterator,
IntoParallelIterator, IntoParallelRefIterator};
const X86: &'static str = "x86"; const X86: &'static str = "x86";
const X86_64: &'static str = "x86_64"; const X86_64: &'static str = "x86_64";
@ -285,15 +282,6 @@ fn main() {
fn ring_build_rs_main() { fn ring_build_rs_main() {
use std::env; use std::env;
if let Ok(amt) = std::env::var("NUM_JOBS") {
if let Ok(amt) = amt.parse() {
rayon::ThreadPoolBuilder::new()
.num_threads(amt)
.build_global()
.unwrap()
}
}
for (key, value) in env::vars() { for (key, value) in env::vars() {
println!("{}: {}", key, value); println!("{}: {}", key, value);
} }
@ -316,8 +304,8 @@ fn ring_build_rs_main() {
PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()) PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap())
.join(PREGENERATED); .join(PREGENERATED);
let _ = rayon::join(check_all_files_tracked, build_c_code(&target, pregenerated, &out_dir);
|| build_c_code(&target, pregenerated, &out_dir)); check_all_files_tracked()
} }
fn pregenerate_asm_main() { fn pregenerate_asm_main() {
@ -370,10 +358,9 @@ impl Target {
} }
fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path) { fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path) {
let includes_modified = RING_INCLUDES.par_iter() let includes_modified = RING_INCLUDES.iter()
.with_max_len(1) .chain(RING_BUILD_FILE.iter())
.chain(RING_BUILD_FILE.par_iter()) .chain(RING_PERL_INCLUDES.iter())
.chain(RING_PERL_INCLUDES.par_iter())
.map(|f| file_modified(Path::new(*f))) .map(|f| file_modified(Path::new(*f)))
.max() .max()
.unwrap(); .unwrap();
@ -436,8 +423,7 @@ fn build_c_code(target: &Target, pregenerated: PathBuf, out_dir: &Path) {
// XXX: Ideally, ring-test would only be built for `cargo test`, but Cargo // XXX: Ideally, ring-test would only be built for `cargo test`, but Cargo
// can't do that yet. // can't do that yet.
libs.into_par_iter() libs.into_iter()
.with_max_len(1)
.for_each(|&(lib_name, srcs, additional_srcs)| .for_each(|&(lib_name, srcs, additional_srcs)|
build_library(&target, &out_dir, lib_name, srcs, additional_srcs, build_library(&target, &out_dir, lib_name, srcs, additional_srcs,
warnings_are_errors, includes_modified)); warnings_are_errors, includes_modified));
@ -452,26 +438,19 @@ fn build_library(target: &Target, out_dir: &Path, lib_name: &str,
warnings_are_errors: bool, includes_modified: SystemTime) { warnings_are_errors: bool, includes_modified: SystemTime) {
// Compile all the (dirty) source files into object files. // Compile all the (dirty) source files into object files.
#[allow(box_pointers)] // XXX #[allow(box_pointers)] // XXX
let objs = additional_srcs.into_par_iter().chain(srcs.into_par_iter()) let objs = additional_srcs.into_iter().chain(srcs.into_iter())
.with_max_len(1)
.filter(|f| .filter(|f|
target.env() != "msvc" || target.env() != "msvc" ||
f.extension().unwrap().to_str().unwrap() != "S") f.extension().unwrap().to_str().unwrap() != "S")
.map(|f| compile(f, target, warnings_are_errors, out_dir, .map(|f| compile(f, target, warnings_are_errors, out_dir,
includes_modified)) includes_modified))
.map(|v| vec![v]) .collect::<Vec<_>>();
.reduce(Vec::new,
&|mut a: Vec<String>, b: Vec<String>| -> Vec<String> {
a.extend(b.into_iter());
a
});
// Rebuild the library if necessary. // Rebuild the library if necessary.
let lib_path = PathBuf::from(out_dir).join(format!("lib{}.a", lib_name)); let lib_path = PathBuf::from(out_dir).join(format!("lib{}.a", lib_name));
if objs.par_iter() if objs.iter()
.with_max_len(1) .map(Path::new)
.map(|f| Path::new(f))
.any(|p| need_run(&p, &lib_path, includes_modified)) { .any(|p| need_run(&p, &lib_path, includes_modified)) {
let mut c = cc::Build::new(); let mut c = cc::Build::new();

View File

@ -13,4 +13,3 @@ path = "../build.rs"
# parallelism ourself. This gives us a much higher level of # parallelism ourself. This gives us a much higher level of
# control about what should be parallised in which way # control about what should be parallised in which way
cc = "1.0" cc = "1.0"
rayon = "1.0.0"