Don't checkout llvm-project when the LLVM backend isn't built

This commit is contained in:
bjorn3 2020-12-12 18:02:37 +01:00
parent 3f2088aa60
commit 16f69b5430

View file

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