Skip to content

Commit

Permalink
Rollup merge of #87380 - jyn514:smarter-submodule-defaults, r=Mark-Si…
Browse files Browse the repository at this point in the history
…mulacrum

Don't default to `submodules = true` unless the rust repo has a .git directory

Should hopefully fix #82653 (comment) - `@semarie` can you confirm?

r? `@Mark-Simulacrum`
  • Loading branch information
JohnTitor authored Jul 23, 2021
2 parents 1b9cd8b + 6194cc8 commit f709999
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
11 changes: 8 additions & 3 deletions src/bootstrap/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ use std::path::{Path, PathBuf};
use std::str::FromStr;

use crate::cache::{Interned, INTERNER};
use crate::channel::GitInfo;
pub use crate::flags::Subcommand;
use crate::flags::{Color, Flags};
use crate::util::exe;
Expand Down Expand Up @@ -48,7 +49,7 @@ pub struct Config {
/// Call Build::ninja() instead of this.
pub ninja_in_file: bool,
pub verbose: usize,
pub submodules: bool,
pub submodules: Option<bool>,
pub fast_submodules: bool,
pub compiler_docs: bool,
pub docs_minification: bool,
Expand Down Expand Up @@ -552,7 +553,7 @@ impl Config {
config.backtrace = true;
config.rust_optimize = true;
config.rust_optimize_tests = true;
config.submodules = true;
config.submodules = None;
config.fast_submodules = true;
config.docs = true;
config.docs_minification = true;
Expand Down Expand Up @@ -658,11 +659,11 @@ impl Config {
config.npm = build.npm.map(PathBuf::from);
config.gdb = build.gdb.map(PathBuf::from);
config.python = build.python.map(PathBuf::from);
config.submodules = build.submodules;
set(&mut config.low_priority, build.low_priority);
set(&mut config.compiler_docs, build.compiler_docs);
set(&mut config.docs_minification, build.docs_minification);
set(&mut config.docs, build.docs);
set(&mut config.submodules, build.submodules);
set(&mut config.fast_submodules, build.fast_submodules);
set(&mut config.locked_deps, build.locked_deps);
set(&mut config.vendor, build.vendor);
Expand Down Expand Up @@ -1083,6 +1084,10 @@ impl Config {
pub fn llvm_enabled(&self) -> bool {
self.rust_codegen_backends.contains(&INTERNER.intern_str("llvm"))
}

pub fn submodules(&self, rust_info: &GitInfo) -> bool {
self.submodules.unwrap_or(rust_info.is_git())
}
}

fn set<T>(field: &mut T, val: Option<T>) {
Expand Down
4 changes: 2 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ impl Build {
t!(std::fs::read_dir(dir)).next().is_none()
}

if !self.config.submodules {
if !self.config.submodules(&self.rust_info) {
return;
}

Expand Down Expand Up @@ -562,7 +562,7 @@ impl Build {
"library/stdarch",
];
// Avoid running git when there isn't a git checkout.
if !self.config.submodules {
if !self.config.submodules(&self.rust_info) {
return;
}
let output = output(
Expand Down

0 comments on commit f709999

Please sign in to comment.