File tree Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Expand file tree Collapse file tree 2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -76,6 +76,9 @@ pub fn prebuilt_llvm_config(
7676 builder : & Builder < ' _ > ,
7777 target : TargetSelection ,
7878) -> Result < LlvmResult , Meta > {
79+ // If we have llvm submodule initialized already, sync it.
80+ builder. update_existing_submodule ( & Path :: new ( "src" ) . join ( "llvm-project" ) ) ;
81+
7982 builder. config . maybe_download_ci_llvm ( ) ;
8083
8184 // If we're using a custom LLVM bail out here, but we can only use a
@@ -94,7 +97,9 @@ pub fn prebuilt_llvm_config(
9497 }
9598 }
9699
100+ // Initialize the llvm submodule if not initialized already.
97101 builder. update_submodule ( & Path :: new ( "src" ) . join ( "llvm-project" ) ) ;
102+
98103 let root = "src/llvm-project/llvm" ;
99104 let out_dir = builder. llvm_out ( target) ;
100105
Original file line number Diff line number Diff line change @@ -625,6 +625,18 @@ impl Build {
625625 }
626626 }
627627
628+ /// Updates the given submodule only if it's initialized already; nothing happens otherwise.
629+ pub fn update_existing_submodule ( & self , submodule : & Path ) {
630+ // Avoid running git when there isn't a git checkout.
631+ if !self . config . submodules ( self . rust_info ( ) ) {
632+ return ;
633+ }
634+
635+ if GitInfo :: new ( false , submodule) . is_managed_git_subrepository ( ) {
636+ self . update_submodule ( submodule) ;
637+ }
638+ }
639+
628640 /// Executes the entire build, as configured by the flags and configuration.
629641 pub fn build ( & mut self ) {
630642 unsafe {
You can’t perform that action at this time.
0 commit comments