Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions deps/rust/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ crates_vendor(
"lol_html_c_api_include_lol_html_h": "include/lol_html.h",
},
)],
# simdutf compiles C++ via the cc crate; workerd uses libc++ not libstdc++.
# build_script_toolchains provides Bazel's C++ toolchain to the cc crate
# so it uses the same clang/libc++ as workerd. CXXSTDLIB tells cc to link libc++.
"simdutf": [crate.annotation(
build_script_env = {
"CXXSTDLIB": "c++",
},
build_script_toolchains = ["@bazel_tools//tools/cpp:current_cc_toolchain"],
)],
},
cargo_bazel = CARGO_BAZEL,
cargo_lockfile = "//deps/rust:Cargo.lock",
Expand Down
11 changes: 11 additions & 0 deletions deps/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions deps/rust/cargo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ PACKAGES = WORKERD_CXX_PACKAGES | {
"ruff_python_parser": crate.spec(git = "https://github.com/astral-sh/ruff", tag = "0.12.1"),
# param_extractor depends on unbounded_depth feature
"serde_json": crate.spec(version = "1", features = ["unbounded_depth"]),
"simdutf": crate.spec(version = "0"),
"serde": crate.spec(version = "1", features = ["derive"]),
"thiserror": crate.spec(version = "2"),
# tokio is huge, let's enable only features when we actually need them.
Expand Down
12 changes: 12 additions & 0 deletions deps/rust/crates/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,18 @@ alias(
tags = ["manual"],
)

alias(
name = "simdutf-0.7.0",
actual = "@crates_vendor__simdutf-0.7.0//:simdutf",
tags = ["manual"],
)

alias(
name = "simdutf",
actual = "@crates_vendor__simdutf-0.7.0//:simdutf",
tags = ["manual"],
)

alias(
name = "static_assertions-1.1.0",
actual = "@crates_vendor__static_assertions-1.1.0//:static_assertions",
Expand Down
54 changes: 54 additions & 0 deletions deps/rust/crates/BUILD.simdutf-0.7.0.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
###############################################################################
# @generated
# DO NOT MODIFY: This file is auto-generated by a crate_universe tool. To
# regenerate this file, run the following:
#
# bazel run @@//deps/rust:crates_vendor
###############################################################################
#
# MANUALLY PATCHED: The simdutf Rust crate normally compiles its own copy of
# the simdutf C++ library via a build script. Since workerd already vendors
# simdutf as @simdutf//:simdutf (which exports the simdutf_* extern "C"
# functions that the Rust crate expects), we skip the build script entirely
# and link directly against workerd's copy.

load("@rules_rust//rust:defs.bzl", "rust_library")

package(default_visibility = ["//visibility:public"])

rust_library(
name = "simdutf",
srcs = glob(
include = ["**/*.rs"],
allow_empty = True,
),
compile_data = glob(
include = ["**"],
allow_empty = True,
exclude = [
"**/* *",
".tmp_git_root/**/*",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
),
crate_root = "src/lib.rs",
edition = "2021",
rustc_flags = [
"--cap-lints=allow",
],
tags = [
"cargo-bazel",
"crate-name=simdutf",
"manual",
"noclippy",
"norustfmt",
],
version = "0.7.0",
deps = [
"@crates_vendor__bitflags-2.11.0//:bitflags",
"@simdutf",
],
)
12 changes: 12 additions & 0 deletions deps/rust/crates/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -319,6 +319,7 @@ _NORMAL_DEPENDENCIES = {
"scratch": Label("@crates_vendor//:scratch-1.0.9"),
"serde": Label("@crates_vendor//:serde-1.0.228"),
"serde_json": Label("@crates_vendor//:serde_json-1.0.149"),
"simdutf": Label("@crates_vendor//:simdutf-0.7.0"),
"static_assertions": Label("@crates_vendor//:static_assertions-1.1.0"),
"swc_common": Label("@crates_vendor//:swc_common-18.0.1"),
"swc_ts_fast_strip": Label("@crates_vendor//:swc_ts_fast_strip-43.0.0"),
Expand Down Expand Up @@ -2059,6 +2060,16 @@ def crate_repositories():
build_file = Label("//deps/rust/crates:BUILD.simd-adler32-0.3.8.bazel"),
)

maybe(
http_archive,
name = "crates_vendor__simdutf-0.7.0",
sha256 = "5f542752c7335a9174e7bb81112c3ca1415a7a6b6ec2c3e840aca347a30f9141",
type = "tar.gz",
urls = ["https://static.crates.io/crates/simdutf/0.7.0/download"],
strip_prefix = "simdutf-0.7.0",
build_file = Label("//deps/rust/crates:BUILD.simdutf-0.7.0.bazel"),
)

maybe(
http_archive,
name = "crates_vendor__siphasher-0.3.11",
Expand Down Expand Up @@ -2855,6 +2866,7 @@ def crate_repositories():
struct(repo = "crates_vendor__scratch-1.0.9", is_dev_dep = False),
struct(repo = "crates_vendor__serde-1.0.228", is_dev_dep = False),
struct(repo = "crates_vendor__serde_json-1.0.149", is_dev_dep = False),
struct(repo = "crates_vendor__simdutf-0.7.0", is_dev_dep = False),
struct(repo = "crates_vendor__static_assertions-1.1.0", is_dev_dep = False),
struct(repo = "crates_vendor__swc_common-18.0.1", is_dev_dep = False),
struct(repo = "crates_vendor__swc_ts_fast_strip-43.0.0", is_dev_dep = False),
Expand Down
2 changes: 2 additions & 0 deletions src/rust/api/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ wd_rust_crate(
visibility = ["//visibility:public"],
deps = [
"//src/rust/jsg",
"//src/rust/nbytes",
"@crates_vendor//:simdutf",
"@crates_vendor//:thiserror",
],
)
Loading
Loading