mirror of
https://github.com/aphrody-labs/rusty_v8.git
synced 2026-10-13 20:15:52 +00:00
feat: add back Temporal support (#1840)
Fixes #1839 I needed to patch temporal_capi to depend on temporal_rs 0.0.11 exactly: https://crates.io/crates/ry_temporal_capi/0.0.11-ry.1 --------- Co-authored-by: snek <the@snek.dev>
This commit is contained in:
1 parent
42c1a75d61
commit
1bc1660455
11 files changed
+792
-274
No files matched your search
@@ -12,3 +12,4 @@ third_party/android_ndk
|
||||
third_party/android_platform
|
||||
third_party/catapult
|
||||
third_party/llvm-build
|
||||
third_party/rust-toolchain
|
||||
@@ -52,3 +52,6 @@
|
||||
[submodule "third_party/dragonbox/src"]
|
||||
path = third_party/dragonbox/src
|
||||
url = https://chromium.googlesource.com/external/github.com/jk-jeon/dragonbox.git
|
||||
[submodule "third_party/rust"]
|
||||
path = third_party/rust
|
||||
url = https://chromium.googlesource.com/chromium/src/third_party/rust
|
||||
@@ -99,8 +99,9 @@ default_args = {
|
||||
# TODO: third_party/compiler-rt missing?
|
||||
use_llvm_libatomic = false
|
||||
|
||||
# TODO: wants to download rust nightly toolchain from GCS
|
||||
v8_enable_temporal_support = false
|
||||
enable_rust = true
|
||||
enable_rust_cxx = true
|
||||
v8_enable_temporal_support = true
|
||||
|
||||
# prevent hashdos
|
||||
v8_use_default_hasher_secret = false
|
||||
|
||||
Generated
+714
-234
File diff suppressed because it is too large.
Load diff
@@ -105,6 +105,7 @@ v8_enable_pointer_compression = []
|
||||
[dependencies]
|
||||
bitflags = "2.5"
|
||||
paste = "1.0"
|
||||
temporal_capi = { package = "ry_temporal_capi", version = "=0.0.11-ry.1", features = [ "compiled_data" ] }
|
||||
|
||||
[build-dependencies]
|
||||
miniz_oxide = "0.8.8"
|
||||
|
||||
@@ -186,6 +186,9 @@ fn build_v8(is_asan: bool) {
|
||||
if need_gn_ninja_download() {
|
||||
download_ninja_gn_binaries();
|
||||
}
|
||||
|
||||
download_rust_toolchain();
|
||||
|
||||
// `#[cfg(...)]` attributes don't work as expected from build.rs -- they refer to the configuration
|
||||
// of the host system which the build.rs script will be running on. In short, `cfg!(target_<os/arch>)`
|
||||
// is actually the host os/arch instead of target os/arch while cross compiling. Instead, Environment variables
|
||||
@@ -406,6 +409,16 @@ fn download_ninja_gn_binaries() {
|
||||
}
|
||||
}
|
||||
|
||||
fn download_rust_toolchain() {
|
||||
assert!(
|
||||
Command::new(python())
|
||||
.arg("./tools/rust_toolchain.py")
|
||||
.status()
|
||||
.unwrap()
|
||||
.success()
|
||||
);
|
||||
}
|
||||
|
||||
fn prebuilt_profile() -> &'static str {
|
||||
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
|
||||
// Use v8 in release mode unless $V8_FORCE_DEBUG=true
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate bitflags;
|
||||
extern crate temporal_capi;
|
||||
|
||||
mod array_buffer;
|
||||
mod array_buffer_view;
|
||||
|
||||
+1
Submodule third_party/rust added at 1b9595854c.
@@ -5,7 +5,6 @@
|
||||
|
||||
from __future__ import print_function
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
|
||||
@@ -11,12 +11,10 @@ import os
|
||||
import sys
|
||||
import zipfile
|
||||
import tempfile
|
||||
import time
|
||||
import http.client
|
||||
from v8_deps import Var
|
||||
from urllib.error import HTTPError, URLError
|
||||
from download_file import DownloadUrl
|
||||
from stat import ST_MODE
|
||||
from urllib.request import urlopen
|
||||
from urllib.parse import urlparse
|
||||
|
||||
|
||||
@@ -46,40 +44,6 @@ NINJA_PACKAGE = f'infra/3pp/tools/ninja/{PLATFORM}'
|
||||
GN_PACKAGE = f'gn/gn/{PLATFORM}'
|
||||
|
||||
|
||||
def DownloadUrl(url, output_file):
|
||||
"""Download url into output_file."""
|
||||
CHUNK_SIZE = 4096
|
||||
num_retries = 3
|
||||
retry_wait_s = 5 # Doubled at each retry.
|
||||
|
||||
while True:
|
||||
try:
|
||||
sys.stdout.write('Downloading %s...' % url)
|
||||
sys.stdout.flush()
|
||||
response = urlopen(url)
|
||||
bytes_done = 0
|
||||
while True:
|
||||
chunk = response.read(CHUNK_SIZE)
|
||||
if not chunk:
|
||||
break
|
||||
output_file.write(chunk)
|
||||
bytes_done += len(chunk)
|
||||
if bytes_done == 0:
|
||||
raise URLError("empty response")
|
||||
print(' Done.')
|
||||
return
|
||||
except URLError as e:
|
||||
sys.stdout.write('\n')
|
||||
print(e)
|
||||
if num_retries == 0 or isinstance(e, HTTPError) and e.code == 404:
|
||||
raise e
|
||||
num_retries -= 1
|
||||
print('Retrying in %d s ...' % retry_wait_s)
|
||||
sys.stdout.flush()
|
||||
time.sleep(retry_wait_s)
|
||||
retry_wait_s *= 2
|
||||
|
||||
|
||||
def EnsureDirExists(path):
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
from v8_deps import deps
|
||||
from download_file import DownloadUrl
|
||||
import platform
|
||||
import os
|
||||
import tempfile
|
||||
import tarfile
|
||||
import sys
|
||||
|
||||
DIR = 'third_party/rust-toolchain'
|
||||
|
||||
if os.path.exists(DIR):
|
||||
print(f'{DIR}: already downloaded')
|
||||
sys.exit()
|
||||
|
||||
host_os = platform.system().lower()
|
||||
if host_os == "darwin":
|
||||
host_os = "mac"
|
||||
elif host_os == "windows":
|
||||
host_os = "win"
|
||||
|
||||
host_cpu = platform.machine().lower()
|
||||
if host_cpu == "x86_64":
|
||||
host_cpu = "x64"
|
||||
elif host_cpu == "aarch64":
|
||||
host_cpu = "arm64"
|
||||
|
||||
eval_globals = {
|
||||
'host_os': host_os,
|
||||
'host_cpu': host_cpu,
|
||||
}
|
||||
|
||||
dep = deps[DIR]
|
||||
obj = next(obj for obj in dep['objects'] if eval(obj['condition'], eval_globals))
|
||||
bucket = dep['bucket']
|
||||
name = obj['object_name']
|
||||
url = f'https://storage.googleapis.com/{bucket}/{name}'
|
||||
|
||||
|
||||
def EnsureDirExists(path):
|
||||
if not os.path.exists(path):
|
||||
os.makedirs(path)
|
||||
|
||||
|
||||
def DownloadAndUnpack(url, output_dir):
|
||||
"""Download an archive from url and extract into output_dir."""
|
||||
with tempfile.TemporaryFile() as f:
|
||||
DownloadUrl(url, f)
|
||||
f.seek(0)
|
||||
EnsureDirExists(output_dir)
|
||||
with tarfile.open(mode='r:xz', fileobj=f) as z:
|
||||
z.extractall(path=output_dir)
|
||||
|
||||
|
||||
DownloadAndUnpack(url, DIR)
|
||||
Reference in new issue
Block a user