about summary refs log tree commit diff
diff options
context:
space:
mode:
authoronur-ozkan <work@onurozkan.dev>2023-12-30 00:50:19 +0300
committeronur-ozkan <work@onurozkan.dev>2023-12-30 00:50:19 +0300
commit48309f4c9f049d4f809786118fc6a5bd598243f5 (patch)
tree25203bf286698b889572235712263da5798dcf13
parentca9950d3a0dfce12c3615fbb85c5fda61da70a75 (diff)
downloadrust-48309f4c9f049d4f809786118fc6a5bd598243f5.tar.gz
rust-48309f4c9f049d4f809786118fc6a5bd598243f5.zip
apply bootstrap lock unconditionally
Signed-off-by: onur-ozkan <work@onurozkan.dev>
-rw-r--r--src/bootstrap/src/bin/main.rs55
1 files changed, 23 insertions, 32 deletions
diff --git a/src/bootstrap/src/bin/main.rs b/src/bootstrap/src/bin/main.rs
index b1ab8dae535..f06760ac01b 100644
--- a/src/bootstrap/src/bin/main.rs
+++ b/src/bootstrap/src/bin/main.rs
@@ -6,7 +6,6 @@
 //! directory in each respective module.
 
 use std::io::Write;
-#[cfg(all(any(unix, windows), not(target_os = "solaris")))]
 use std::process;
 use std::{
     env,
@@ -22,43 +21,35 @@ fn main() {
     let args = env::args().skip(1).collect::<Vec<_>>();
     let config = Config::parse(&args);
 
-    #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
     let mut build_lock;
-    #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
     let _build_lock_guard;
 
     if !config.bypass_bootstrap_lock {
         // Display PID of process holding the lock
         // PID will be stored in a lock file
-        #[cfg(all(any(unix, windows), not(target_os = "solaris")))]
-        {
-            let path = config.out.join("lock");
-            let pid = match fs::read_to_string(&path) {
-                Ok(contents) => contents,
-                Err(_) => String::new(),
-            };
-
-            build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
-                .write(true)
-                .create(true)
-                .open(&path)));
-            _build_lock_guard = match build_lock.try_write() {
-                Ok(mut lock) => {
-                    t!(lock.write(&process::id().to_string().as_ref()));
-                    lock
-                }
-                err => {
-                    drop(err);
-                    println!("WARNING: build directory locked by process {pid}, waiting for lock");
-                    let mut lock = t!(build_lock.write());
-                    t!(lock.write(&process::id().to_string().as_ref()));
-                    lock
-                }
-            };
-        }
-
-        #[cfg(any(not(any(unix, windows)), target_os = "solaris"))]
-        println!("WARNING: file locking not supported for target, not locking build directory");
+        let lock_path = config.out.join("lock");
+        let pid = match fs::read_to_string(&lock_path) {
+            Ok(contents) => contents,
+            Err(_) => String::new(),
+        };
+
+        build_lock = fd_lock::RwLock::new(t!(fs::OpenOptions::new()
+            .write(true)
+            .create(true)
+            .open(&lock_path)));
+        _build_lock_guard = match build_lock.try_write() {
+            Ok(mut lock) => {
+                t!(lock.write(&process::id().to_string().as_ref()));
+                lock
+            }
+            err => {
+                drop(err);
+                println!("WARNING: build directory locked by process {pid}, waiting for lock");
+                let mut lock = t!(build_lock.write());
+                t!(lock.write(&process::id().to_string().as_ref()));
+                lock
+            }
+        };
     }
 
     // check_version warnings are not printed during setup