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

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

Merged
merged 1 commit into from
Jul 23, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@ -1075,6 +1076,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