diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 808b833923..6ba9db7598 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -27,25 +27,25 @@ jobs: !contains(github.event.pull_request.labels.*.name, 'no-fail-fast') }} matrix: config: - - os: macos-13 + - os: macos-14 target: x86_64-apple-darwin variant: debug v8_enable_pointer_compression: false cargo: cargo - - os: macos-13 + - os: macos-14 target: x86_64-apple-darwin variant: release v8_enable_pointer_compression: false cargo: cargo - - os: macos-13 + - os: macos-14 target: x86_64-apple-darwin variant: debug v8_enable_pointer_compression: true cargo: cargo - - os: macos-13 + - os: macos-14 target: x86_64-apple-darwin variant: release v8_enable_pointer_compression: true @@ -317,6 +317,11 @@ jobs: pattern: src_binding_*.rs merge-multiple: true + - name: Commit modified abseil options.h + run: | + git add third_party/abseil-cpp/absl/base/options.h + git commit -m "chore: commit modified abseil options.h" + - name: Publish env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} diff --git a/build.rs b/build.rs index bb55f8ee58..ea41cbb767 100644 --- a/build.rs +++ b/build.rs @@ -325,6 +325,17 @@ fn build_v8(is_asan: bool) { gn_args.push(r#"target_cpu="x86""#.to_string()); } + let repo_root = env::current_dir().unwrap(); + let abseil_options_path = repo_root + .join("third_party") + .join("abseil-cpp") + .join("absl") + .join("base") + .join("options.h"); + + set_abseil_options_to_use_namespace(&abseil_options_path) + .expect("Failed to modify options.h"); + let gn_out = run_gn_gen(&gn_args); assert!(gn_out.exists()); assert!(gn_out.join("args.gn").exists()); @@ -451,7 +462,7 @@ fn static_lib_url() -> String { if let Ok(custom_archive) = env::var("RUSTY_V8_ARCHIVE") { return custom_archive; } - let default_base = "https://github.com/denoland/rusty_v8/releases/download"; + let default_base = "https://github.com/coasys/rusty_v8/releases/download"; let base = env::var("RUSTY_V8_MIRROR").unwrap_or_else(|_| default_base.into()); let version = env::var("CARGO_PKG_VERSION").unwrap(); @@ -1079,6 +1090,36 @@ fn env_bool(key: &str) -> bool { ) } +fn set_abseil_options_to_use_namespace( + options_path: &PathBuf, +) -> io::Result<()> { + // Read the contents of options.h + let current_content = fs::read_to_string(options_path)?; + + // Create the expected content + let new_content = current_content + .lines() + .map(|line| { + if line.contains("#define ABSL_OPTION_USE_INLINE_NAMESPACE") { + "#define ABSL_OPTION_USE_INLINE_NAMESPACE 1".to_string() + } else if line.contains("#define ABSL_OPTION_INLINE_NAMESPACE_NAME") { + "#define ABSL_OPTION_INLINE_NAMESPACE_NAME v8".to_string() + } else { + line.to_string() + } + }) + .collect::>() + .join("\n"); + + // Only write if content actually changed + if current_content != new_content { + let mut file = fs::File::create(options_path)?; + file.write_all(new_content.as_bytes())?; + } + + Ok(()) +} + #[cfg(test)] mod test { use super::*; diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e030789b92..0924897677 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,5 +1,5 @@ [toolchain] -channel = "1.86.0" +channel = "1.91.0" components = ["rustfmt", "clippy"] targets = [ "x86_64-apple-darwin",