Skip to content
Open
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
2 changes: 1 addition & 1 deletion .github/workflows/deps-updater.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Update rust dependencies
run: bazel run //deps/rust:crates_vendor -- --repin full
run: cd deps/rust && bazel run @rules_rust//tools/upstream_wrapper:cargo -- update
- name: Reformat changed files
run: ./tools/cross/format.py git
- name: Open pull request
Expand Down
42 changes: 0 additions & 42 deletions build/deps/build_deps.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -72,48 +72,6 @@
"name": "rules_multirun",
"type": "bazel_dep"
},
// rust
{
"name": "cargo_bazel_linux_x64",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_rust",
"file_regex": "^cargo-bazel-x86_64-unknown-linux-gnu$",
"file_type": "executable"
},
{
"name": "cargo_bazel_linux_arm64",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_rust",
"file_regex": "^cargo-bazel-aarch64-unknown-linux-gnu$",
"file_type": "executable"
},
{
"name": "cargo_bazel_macos_x64",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_rust",
"file_regex": "^cargo-bazel-x86_64-apple-darwin$",
"file_type": "executable"
},
{
"name": "cargo_bazel_macos_arm64",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_rust",
"file_regex": "^cargo-bazel-aarch64-apple-darwin$",
"file_type": "executable"
},
{
"name": "cargo_bazel_win_x64",
"type": "github_release",
"owner": "bazelbuild",
"repo": "rules_rust",
"file_regex": "^cargo-bazel-x86_64-pc-windows-msvc.exe$",
"file_type": "executable",
"downloaded_file_path": "downloaded.exe"
},
{
"name": "clang_tidy_linux_amd64",
"type": "github_release",
Expand Down
42 changes: 34 additions & 8 deletions build/deps/rust.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,14 +48,6 @@ use_repo(rust, "rust_toolchains")

register_toolchains("@rust_toolchains//:all")

crate_repositories = use_extension("//deps/rust:extension.bzl", "crate_repositories")
use_repo(
crate_repositories,
"crates_vendor",
# Needed to retrieve lol-html header
"crates_vendor__lol_html_c_api-1.3.1",
)

# rust-based lolhtml dependency, including the API header.
# Presented as a separate repository to allow overrides.
new_local_repository = use_repo_rule("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
Expand All @@ -74,6 +66,40 @@ inject_repo(
**{"crates.io": "crates_vendor"}
)

bazel_dep(name = "rules_rs", version = "0.0.30")
archive_override(
module_name = "rules_rs",
integrity = "sha256-3w+2nGAtvtUPkufQRNPL4EeFad5kDhlZYBLKjwyIWgE=",
patch_args = ["-p1"],
patches = [
"//:patches/rules_rs/0001-rust-deps-ccinfo.patch",
],
strip_prefix = "rules_rs-0.0.30",
type = "tgz",
url = "https://github.com/dzbarsky/rules_rs/releases/download/v0.0.30/rules_rs-v0.0.30.tar.gz",
)

crate = use_extension("@rules_rs//rs:extensions.bzl", "crate")
crate.annotation(
additive_build_file_content = """exports_files(["include/lol_html.h"])""",
crate = "lol_html_c_api",
strip_prefix = "c-api",
)
crate.from_cargo(
# TODO(zbarsky): This name is a bit misleading now that we don't vendor.
# We can clean it up as a followup.
name = "crates_vendor",
cargo_lock = "//deps/rust:Cargo.lock",
cargo_toml = "//deps/rust:Cargo.toml",
platform_triples = RUST_TARGET_TRIPLES,
)
use_repo(
crate,
"crates_vendor",
# Needed to retrieve lol-html header
"crates_vendor__lol_html_c_api-1.3.1",
)

http.archive(
name = "workerd-cxx",
sha256 = "7ddce8e81d0b81adf6f07f18376a6fea9dca42e6b03b2fcf703c62196c270ad0",
Expand Down
34 changes: 0 additions & 34 deletions deps/rust/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
load("@bazel_skylib//lib:selects.bzl", "selects")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_rust//crate_universe:defs.bzl", "crates_vendor", "render_config")
load("@rules_rust//rust:defs.bzl", "rust_static_library")
load("cargo.bzl", "PACKAGES")

selects.config_setting_group(
name = "linux_x64",
Expand Down Expand Up @@ -45,38 +43,6 @@ selects.config_setting_group(
],
)

CARGO_BAZEL = select({
":linux_x64": "@cargo_bazel_linux_x64//file:downloaded",
":linux_arm64": "@cargo_bazel_linux_arm64//file:downloaded",
":macos_x64": "@cargo_bazel_macos_x64//file:downloaded",
":macos_arm64": "@cargo_bazel_macos_arm64//file:downloaded",
":win_x64": "@cargo_bazel_win_x64//file:downloaded.exe",
})

# Generates a repository containing all the crates we reference from our
# rust workspace
# To repin crates: bazel run //rust-deps:crates_vendor -- --repin
crates_vendor(
name = "crates_vendor",
cargo_bazel = CARGO_BAZEL,
cargo_lockfile = "//deps/rust:Cargo.lock",
generate_binaries = True,
mode = "remote",
packages = PACKAGES,
# Not needed, we have a well-defined set of supported platforms
render_config = render_config(
generate_cargo_toml_env_vars = False,
generate_target_compatible_with = False,
),
supported_platform_triples = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",
],
)

# Adds missing symbols following Rust mangling change, plus missing system library on Windows.
cc_library(
name = "runtime",
Expand Down
45 changes: 45 additions & 0 deletions deps/rust/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
[package]
name = "direct-cargo-bazel-deps"
version = "0.0.1"
edition = "2021"
publish = false

# This synthetic crate exists only to drive Cargo dependency resolution for Bazel.
[lib]
path = "fake.rs"

[dependencies]
# Keep explicit features minimal to bound compile times and binary size.
ada-url = "3"
anyhow = "1"
async-trait = { version = "0", default-features = false }
capnp = "0"
capnp-rpc = "0"
capnpc = "0"
cc = "1"
clang-ast = "0"
clap = { version = "4", default-features = false, features = ["derive", "std", "help"] }
codespan-reporting = "0"
flate2 = "1"
foldhash = "0"
futures = "0"
lol_html_c_api = { git = "https://github.com/cloudflare/lol-html", tag = "v2.7.1" }
nix = "0"
pico-args = "0"
proc-macro2 = { version = "1", features = ["span-locations"] }
quote = "1"
ruff_python_ast = { git = "https://github.com/astral-sh/ruff", tag = "0.12.1" }
ruff_python_parser = { git = "https://github.com/astral-sh/ruff", tag = "0.12.1" }
rustversion = "1"
scratch = "1"
serde = { version = "1", features = ["derive"] }
# param_extractor depends on `unbounded_depth`.
serde_json = { version = "1", features = ["unbounded_depth"] }
static_assertions = "1"
swc_common = "18"
swc_ts_fast_strip = "43"
syn = { version = "2", features = ["full"] }
thiserror = "2"
# Tokio is large; enable only the features we use.
tokio = { version = "1", default-features = false, features = ["net", "rt", "rt-multi-thread", "time"] }
tracing = { version = "0", default-features = false, features = ["std"] }
37 changes: 0 additions & 37 deletions deps/rust/cargo.bzl

This file was deleted.

116 changes: 0 additions & 116 deletions deps/rust/crates/BUILD.ada-url-3.4.2.bazel

This file was deleted.

Loading
Loading