Skip to content

Initialize rust-analyzer submodule on bootstrap #96457

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

Merged
merged 1 commit into from
May 8, 2022
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
4 changes: 4 additions & 0 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1147,6 +1147,10 @@ def update_submodules(self):
"library/backtrace",
"library/stdarch"
]
# If build.vendor is set in config.toml, we must update rust-analyzer also.
# Otherwise, the bootstrap will fail (#96456).
if self.use_vendored_sources:
submodules.append("src/tools/rust-analyzer")
filtered_submodules = []
submodules_names = []
for module in submodules:
Expand Down
9 changes: 7 additions & 2 deletions src/bootstrap/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -609,14 +609,19 @@ impl Build {
/// This avoids contributors checking in a submodule change by accident.
pub fn maybe_update_submodules(&self) {
// WARNING: keep this in sync with the submodules hard-coded in bootstrap.py
const BOOTSTRAP_SUBMODULES: &[&str] = &[
let mut bootstrap_submodules: Vec<&str> = vec![
"src/tools/rust-installer",
"src/tools/cargo",
"src/tools/rls",
"src/tools/miri",
"library/backtrace",
"library/stdarch",
];
// As in bootstrap.py, we include `rust-analyzer` if `build.vendor` was set in
// `config.toml`.
if self.config.vendor {
bootstrap_submodules.push("src/tools/rust-analyzer");
}
// Avoid running git when there isn't a git checkout.
if !self.config.submodules(&self.rust_info) {
return;
Expand All @@ -632,7 +637,7 @@ impl Build {
// Sample output: `submodule.src/rust-installer.path src/tools/rust-installer`
let submodule = Path::new(line.splitn(2, ' ').nth(1).unwrap());
// avoid updating submodules twice
if !BOOTSTRAP_SUBMODULES.iter().any(|&p| Path::new(p) == submodule)
if !bootstrap_submodules.iter().any(|&p| Path::new(p) == submodule)
&& channel::GitInfo::new(false, submodule).is_git()
{
self.update_submodule(submodule);
Expand Down