]> git.lizzy.rs Git - rust.git/commitdiff
Don't checkout llvm-project when the LLVM backend isn't built
authorbjorn3 <bjorn3@users.noreply.github.com>
Sat, 12 Dec 2020 17:02:37 +0000 (18:02 +0100)
committerbjorn3 <bjorn3@users.noreply.github.com>
Sat, 12 Dec 2020 17:06:07 +0000 (18:06 +0100)
src/bootstrap/bootstrap.py

index a819e1b6e2f1ebe1c53e520fa13a35cf756fea74..63975c6dedac3e8b0c3967991f3e01627eac9a38 100644 (file)
@@ -892,13 +892,17 @@ class RustBuild(object):
         filtered_submodules = []
         submodules_names = []
         llvm_checked_out = os.path.exists(os.path.join(self.rust_root, "src/llvm-project/.git"))
+        external_llvm_provided = self.get_toml('llvm-config') or self.downloading_llvm()
+        llvm_needed = not self.get_toml('codegen-backends', 'rust') \
+            or "llvm" in self.get_toml('codegen-backends', 'rust')
         for module in submodules:
             if module.endswith("llvm-project"):
-                # Don't sync the llvm-project submodule either if an external LLVM
-                # was provided, or if we are downloading LLVM. Also, if the
-                # submodule has been initialized already, sync it anyways so that
-                # it doesn't mess up contributor pull requests.
-                if self.get_toml('llvm-config') or self.downloading_llvm():
+                # Don't sync the llvm-project submodule if an external LLVM was
+                # provided, if we are downloading LLVM or if the LLVM backend is
+                # not being built. Also, if the submodule has been initialized
+                # already, sync it anyways so that it doesn't mess up contributor
+                # pull requests.
+                if external_llvm_provided or not llvm_needed:
                     if self.get_toml('lld') != 'true' and not llvm_checked_out:
                         continue
             check = self.check_submodule(module, slow_submodules)