mirror of
https://github.com/denoland/rusty_v8.git
synced 2024-11-21 15:04:33 -05:00
fix: put fslock around entire build process (#1525)
This commit is contained in:
parent
736ae93ee1
commit
815125e0b0
4 changed files with 25 additions and 16 deletions
20
build.rs
20
build.rs
|
@ -96,6 +96,11 @@ fn main() {
|
|||
false
|
||||
};
|
||||
|
||||
// Cargo likes to run multiple build scripts at once sometimes.
|
||||
// Nothing that follows is safe to run multiple times at once,
|
||||
// because we store everything in a parent directory of OUT_DIR.
|
||||
let _lockfile = acquire_lock();
|
||||
|
||||
// Build from source
|
||||
if env_bool("V8_FROM_SOURCE") {
|
||||
if is_asan && std::env::var_os("OPT_LEVEL").unwrap_or_default() == "0" {
|
||||
|
@ -113,8 +118,10 @@ fn main() {
|
|||
|
||||
print_prebuilt_src_binding_path();
|
||||
|
||||
// utilize a lockfile to prevent linking of
|
||||
// only partially downloaded static library.
|
||||
download_static_lib_binaries();
|
||||
}
|
||||
|
||||
fn acquire_lock() -> LockFile {
|
||||
let root = env::current_dir().unwrap();
|
||||
let out_dir = env::var_os("OUT_DIR").unwrap();
|
||||
let lockfilepath = root
|
||||
|
@ -123,13 +130,12 @@ fn main() {
|
|||
.unwrap()
|
||||
.parent()
|
||||
.unwrap()
|
||||
.join("lib_download.fslock");
|
||||
println!("download lockfile: {:?}", &lockfilepath);
|
||||
.join("v8.fslock");
|
||||
let mut lockfile = LockFile::open(&lockfilepath)
|
||||
.expect("Couldn't open lib download lockfile.");
|
||||
lockfile.lock().expect("Couldn't get lock");
|
||||
download_static_lib_binaries();
|
||||
lockfile.unlock().expect("Couldn't unlock lockfile");
|
||||
lockfile.lock_with_pid().expect("Couldn't get lock");
|
||||
println!("lockfile: {:?}", &lockfilepath);
|
||||
lockfile
|
||||
}
|
||||
|
||||
fn build_binding() {
|
||||
|
|
|
@ -158,10 +158,12 @@ macro_rules! impl_try_from {
|
|||
// Not dead: `cast()` is sometimes used in the $check expression.
|
||||
#[allow(dead_code)]
|
||||
fn cast<T>(l: Local<$source>) -> Local<T> {
|
||||
unsafe { transmute(l) }
|
||||
unsafe { transmute::<Local<$source>, Local<T>>(l) }
|
||||
}
|
||||
match l {
|
||||
$value if $check => Ok(unsafe { transmute(l) }),
|
||||
$value if $check => Ok(unsafe {
|
||||
transmute::<Local<'s, $source>, Local<'s, $target>>(l)
|
||||
}),
|
||||
_ => Err(DataError::bad_type::<$target, $source>())
|
||||
}
|
||||
}
|
||||
|
|
|
@ -425,8 +425,8 @@ impl String {
|
|||
self,
|
||||
scope,
|
||||
buffer.as_mut_ptr(),
|
||||
start.try_into().unwrap_or(int::max_value()),
|
||||
buffer.len().try_into().unwrap_or(int::max_value()),
|
||||
start.try_into().unwrap_or(int::MAX),
|
||||
buffer.len().try_into().unwrap_or(int::MAX),
|
||||
options,
|
||||
) as usize
|
||||
}
|
||||
|
@ -447,8 +447,8 @@ impl String {
|
|||
self,
|
||||
scope,
|
||||
buffer.as_mut_ptr(),
|
||||
start.try_into().unwrap_or(int::max_value()),
|
||||
buffer.len().try_into().unwrap_or(int::max_value()),
|
||||
start.try_into().unwrap_or(int::MAX),
|
||||
buffer.len().try_into().unwrap_or(int::MAX),
|
||||
options,
|
||||
) as usize
|
||||
}
|
||||
|
@ -469,8 +469,8 @@ impl String {
|
|||
self,
|
||||
scope,
|
||||
buffer.as_mut_ptr() as *mut u8,
|
||||
start.try_into().unwrap_or(int::max_value()),
|
||||
buffer.len().try_into().unwrap_or(int::max_value()),
|
||||
start.try_into().unwrap_or(int::MAX),
|
||||
buffer.len().try_into().unwrap_or(int::MAX),
|
||||
options,
|
||||
) as usize
|
||||
}
|
||||
|
@ -513,7 +513,7 @@ impl String {
|
|||
self,
|
||||
scope,
|
||||
buffer.as_mut_ptr() as *mut char,
|
||||
buffer.len().try_into().unwrap_or(int::max_value()),
|
||||
buffer.len().try_into().unwrap_or(int::MAX),
|
||||
&mut nchars_ref_int,
|
||||
options,
|
||||
)
|
||||
|
|
|
@ -501,6 +501,7 @@ impl From<Option<bool>> for MaybeBool {
|
|||
#[repr(transparent)]
|
||||
pub struct CxxVTable(pub *const Opaque);
|
||||
|
||||
#[allow(unused)]
|
||||
#[derive(Copy, Clone, Debug)]
|
||||
pub struct RustVTable<DynT>(pub *const Opaque, pub PhantomData<DynT>);
|
||||
|
||||
|
|
Loading…
Reference in a new issue