6
6
//! directory in each respective module.
7
7
8
8
use std:: io:: Write ;
9
- #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
10
9
use std:: process;
11
10
use std:: {
12
11
env,
@@ -22,43 +21,35 @@ fn main() {
22
21
let args = env:: args ( ) . skip ( 1 ) . collect :: < Vec < _ > > ( ) ;
23
22
let config = Config :: parse ( & args) ;
24
23
25
- #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
26
24
let mut build_lock;
27
- #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
28
25
let _build_lock_guard;
29
26
30
27
if !config. bypass_bootstrap_lock {
31
28
// Display PID of process holding the lock
32
29
// PID will be stored in a lock file
33
- #[ cfg( all( any( unix, windows) , not( target_os = "solaris" ) ) ) ]
34
- {
35
- let path = config. out . join ( "lock" ) ;
36
- let pid = match fs:: read_to_string ( & path) {
37
- Ok ( contents) => contents,
38
- Err ( _) => String :: new ( ) ,
39
- } ;
40
-
41
- build_lock = fd_lock:: RwLock :: new ( t ! ( fs:: OpenOptions :: new( )
42
- . write( true )
43
- . create( true )
44
- . open( & path) ) ) ;
45
- _build_lock_guard = match build_lock. try_write ( ) {
46
- Ok ( mut lock) => {
47
- t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
48
- lock
49
- }
50
- err => {
51
- drop ( err) ;
52
- println ! ( "WARNING: build directory locked by process {pid}, waiting for lock" ) ;
53
- let mut lock = t ! ( build_lock. write( ) ) ;
54
- t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
55
- lock
56
- }
57
- } ;
58
- }
59
-
60
- #[ cfg( any( not( any( unix, windows) ) , target_os = "solaris" ) ) ]
61
- println ! ( "WARNING: file locking not supported for target, not locking build directory" ) ;
30
+ let lock_path = config. out . join ( "lock" ) ;
31
+ let pid = match fs:: read_to_string ( & lock_path) {
32
+ Ok ( contents) => contents,
33
+ Err ( _) => String :: new ( ) ,
34
+ } ;
35
+
36
+ build_lock = fd_lock:: RwLock :: new ( t ! ( fs:: OpenOptions :: new( )
37
+ . write( true )
38
+ . create( true )
39
+ . open( & lock_path) ) ) ;
40
+ _build_lock_guard = match build_lock. try_write ( ) {
41
+ Ok ( mut lock) => {
42
+ t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
43
+ lock
44
+ }
45
+ err => {
46
+ drop ( err) ;
47
+ println ! ( "WARNING: build directory locked by process {pid}, waiting for lock" ) ;
48
+ let mut lock = t ! ( build_lock. write( ) ) ;
49
+ t ! ( lock. write( & process:: id( ) . to_string( ) . as_ref( ) ) ) ;
50
+ lock
51
+ }
52
+ } ;
62
53
}
63
54
64
55
// check_version warnings are not printed during setup
0 commit comments