@@ -67,45 +67,38 @@ impl Step for Llvm {
6767 }
6868 }
6969
70- let ( submodule, root, out_dir, llvm_config_ret_dir) = if emscripten {
70+ let ( llvm_info, root, out_dir, llvm_config_ret_dir) = if emscripten {
71+ let info = & builder. emscripten_llvm_info ;
7172 let dir = builder. emscripten_llvm_out ( target) ;
7273 let config_dir = dir. join ( "bin" ) ;
73- ( "src/llvm-emscripten" , "src/llvm-emscripten" , dir, config_dir)
74+ ( info , "src/llvm-emscripten" , dir, config_dir)
7475 } else {
76+ let info = & builder. in_tree_llvm_info ;
7577 let mut dir = builder. llvm_out ( builder. config . build ) ;
7678 if !builder. config . build . contains ( "msvc" ) || builder. config . ninja {
7779 dir. push ( "build" ) ;
7880 }
79- ( "src/llvm-project" , "src/llvm-project/llvm" , builder. llvm_out ( target) , dir. join ( "bin" ) )
81+ ( info , "src/llvm-project/llvm" , builder. llvm_out ( target) , dir. join ( "bin" ) )
8082 } ;
8183
82- let git_output = t ! ( Command :: new( "git" )
83- . args( & [ "rev-parse" , "--verify" , & format!( "@:./{}" , submodule) ] )
84- . current_dir( & builder. src)
85- . output( ) ) ;
86-
87- let llvm_commit = if git_output. status . success ( ) {
88- Some ( git_output. stdout )
89- } else {
84+ if !llvm_info. is_git ( ) {
9085 println ! (
91- "git could not determine the LLVM submodule commit hash ({}) . \
86+ "git could not determine the LLVM submodule commit hash. \
9287 Assuming that an LLVM build is necessary.",
93- String :: from_utf8_lossy( & git_output. stderr) ,
9488 ) ;
95- None
96- } ;
89+ }
9790
9891 let build_llvm_config = llvm_config_ret_dir
9992 . join ( exe ( "llvm-config" , & * builder. config . build ) ) ;
10093 let done_stamp = out_dir. join ( "llvm-finished-building" ) ;
10194
102- if let Some ( llvm_commit) = & llvm_commit {
95+ if let Some ( llvm_commit) = llvm_info . sha ( ) {
10396 if done_stamp. exists ( ) {
10497 let done_contents = t ! ( fs:: read( & done_stamp) ) ;
10598
10699 // If LLVM was already built previously and the submodule's commit didn't change
107100 // from the previous build, then no action is required.
108- if done_contents == llvm_commit. as_slice ( ) {
101+ if done_contents == llvm_commit. as_bytes ( ) {
109102 return build_llvm_config
110103 }
111104 }
@@ -258,11 +251,6 @@ impl Step for Llvm {
258251 channel:: CFG_RELEASE_NUM ,
259252 builder. config. channel,
260253 ) ;
261- let llvm_info = if self . emscripten {
262- & builder. emscripten_llvm_info
263- } else {
264- & builder. in_tree_llvm_info
265- } ;
266254 if let Some ( sha) = llvm_info. sha_short ( ) {
267255 default_suffix. push_str ( "-" ) ;
268256 default_suffix. push_str ( sha) ;
@@ -295,8 +283,8 @@ impl Step for Llvm {
295283
296284 cfg. build ( ) ;
297285
298- if let Some ( llvm_commit) = llvm_commit {
299- t ! ( fs:: write( & done_stamp, & llvm_commit) ) ;
286+ if let Some ( llvm_commit) = llvm_info . sha ( ) {
287+ t ! ( fs:: write( & done_stamp, llvm_commit) ) ;
300288 }
301289
302290 build_llvm_config
0 commit comments