@@ -20,17 +20,17 @@ use build_helper::{output, t};
20
20
use crate :: config:: Target ;
21
21
use crate :: Build ;
22
22
23
- struct Finder {
23
+ pub struct Finder {
24
24
cache : HashMap < OsString , Option < PathBuf > > ,
25
25
path : OsString ,
26
26
}
27
27
28
28
impl Finder {
29
- fn new ( ) -> Self {
29
+ pub fn new ( ) -> Self {
30
30
Self { cache : HashMap :: new ( ) , path : env:: var_os ( "PATH" ) . unwrap_or_default ( ) }
31
31
}
32
32
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 > {
34
34
let cmd: OsString = cmd. as_ref ( ) . into ( ) ;
35
35
let path = & self . path ;
36
36
self . cache
@@ -54,7 +54,7 @@ impl Finder {
54
54
. clone ( )
55
55
}
56
56
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 {
58
58
self . maybe_have ( & cmd) . unwrap_or_else ( || {
59
59
panic ! ( "\n \n couldn't find required command: {:?}\n \n " , cmd. as_ref( ) ) ;
60
60
} )
@@ -95,38 +95,6 @@ pub fn check(build: &mut Build) {
95
95
cmd_finder. must_have ( "cmake" ) ;
96
96
}
97
97
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
-
130
98
build. config . python = build
131
99
. config
132
100
. python
0 commit comments