@@ -20,17 +20,17 @@ use build_helper::{output, t};
2020use crate :: config:: Target ;
2121use crate :: Build ;
2222
23- struct Finder {
23+ pub struct Finder {
2424 cache : HashMap < OsString , Option < PathBuf > > ,
2525 path : OsString ,
2626}
2727
2828impl Finder {
29- fn new ( ) -> Self {
29+ pub fn new ( ) -> Self {
3030 Self { cache : HashMap :: new ( ) , path : env:: var_os ( "PATH" ) . unwrap_or_default ( ) }
3131 }
3232
33- fn maybe_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> Option < PathBuf > {
33+ pub fn maybe_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> Option < PathBuf > {
3434 let cmd: OsString = cmd. as_ref ( ) . into ( ) ;
3535 let path = & self . path ;
3636 self . cache
@@ -54,7 +54,7 @@ impl Finder {
5454 . clone ( )
5555 }
5656
57- fn must_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> PathBuf {
57+ pub fn must_have < S : AsRef < OsStr > > ( & mut self , cmd : S ) -> PathBuf {
5858 self . maybe_have ( & cmd) . unwrap_or_else ( || {
5959 panic ! ( "\n \n couldn't find required command: {:?}\n \n " , cmd. as_ref( ) ) ;
6060 } )
@@ -95,38 +95,6 @@ pub fn check(build: &mut Build) {
9595 cmd_finder. must_have ( "cmake" ) ;
9696 }
9797
98- // Ninja is currently only used for LLVM itself.
99- if building_llvm {
100- if build. config . ninja {
101- // Some Linux distros rename `ninja` to `ninja-build`.
102- // CMake can work with either binary name.
103- if cmd_finder. maybe_have ( "ninja-build" ) . is_none ( )
104- && cmd_finder. maybe_have ( "ninja" ) . is_none ( )
105- {
106- eprintln ! (
107- "
108- Couldn't find required command: ninja
109- You should install ninja, or set ninja=false in config.toml
110- "
111- ) ;
112- std:: process:: exit ( 1 ) ;
113- }
114- }
115-
116- // If ninja isn't enabled but we're building for MSVC then we try
117- // doubly hard to enable it. It was realized in #43767 that the msbuild
118- // CMake generator for MSVC doesn't respect configuration options like
119- // disabling LLVM assertions, which can often be quite important!
120- //
121- // In these cases we automatically enable Ninja if we find it in the
122- // environment.
123- if !build. config . ninja && build. config . build . contains ( "msvc" ) {
124- if cmd_finder. maybe_have ( "ninja" ) . is_some ( ) {
125- build. config . ninja = true ;
126- }
127- }
128- }
129-
13098 build. config . python = build
13199 . config
132100 . python
0 commit comments