File tree 2 files changed +17
-0
lines changed
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(
76
76
builder : & Builder < ' _ > ,
77
77
target : TargetSelection ,
78
78
) -> 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
+
79
82
builder. config . maybe_download_ci_llvm ( ) ;
80
83
81
84
// 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(
94
97
}
95
98
}
96
99
100
+ // Initialize the llvm submodule if not initialized already.
97
101
builder. update_submodule ( & Path :: new ( "src" ) . join ( "llvm-project" ) ) ;
102
+
98
103
let root = "src/llvm-project/llvm" ;
99
104
let out_dir = builder. llvm_out ( target) ;
100
105
Original file line number Diff line number Diff line change @@ -625,6 +625,18 @@ impl Build {
625
625
}
626
626
}
627
627
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
+
628
640
/// Executes the entire build, as configured by the flags and configuration.
629
641
pub fn build ( & mut self ) {
630
642
unsafe {
You can’t perform that action at this time.
0 commit comments