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
6 changes: 5 additions & 1 deletion .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import %workspace%/bazel/defaults.bazelrc

common --test_output=errors
common --incompatible_disallow_empty_glob=False
common --enable_platform_specific_config

# Define value used by tests
common --define=SOME_VAR=SOME_VALUE
Expand All @@ -10,9 +11,11 @@ common --define=SOME_VAR=SOME_VALUE
common --@pypi//venv=default

common --incompatible_enable_cc_toolchain_resolution
common --@toolchains_llvm_bootstrapped//config:experimental_stub_libgcc_s
common --@llvm//config:experimental_stub_libgcc_s
common --@rules_cc//cc/toolchains/args/archiver_flags:use_libtool_on_macos=false

common:linux --host_platform=//bazel/platforms:linux_host

# TODO(bzlmod): Don't break proto
common --per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
common --host_per_file_copt=external/.*protobuf.*@--PROTOBUF_WAS_NOT_SUPPOSED_TO_BE_BUILT
Expand All @@ -22,6 +25,7 @@ common --repo_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1
common --repo_env=BAZEL_NO_APPLE_CPP_TOOLCHAIN=1

common:ci --toolchain_resolution_debug='@@bazel_tools//tools/cpp:toolchain_type'
common:ci --toolchain_resolution_debug='.*rust.*'

common:release --build_tag_filters=release
common:release --stamp
Expand Down
2 changes: 2 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ load("//uv/private/manifest:defs.bzl", "gazelle_python_manifest")
gazelle_python_manifest(
name = "gazelle_python_manifest",
hub = "pypi",
# TODO: this doesn't work on linux because it hardcodes the @platforms//host platform which won't match rust toolchains.
tags = ["manual"],
venvs = [
"default",
],
Expand Down
87 changes: 49 additions & 38 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -52,53 +52,17 @@ use_repo(tel, "aspect_tools_telemetry_report")
# Dev deps are the remainder of the file

# LLVM configuration
bazel_dep(name = "toolchains_llvm_bootstrapped", version = "0.2.5", dev_dependency = IS_RELEASE)
archive_override(
module_name = "toolchains_llvm_bootstrapped",
integrity = "sha256-+nddimV34BYO8YExiKLYG2kMoA2Sv+5ZoMRPQLJxNfE=",
patch_strip = 1,
patches = [
"//bazel/patches:llvm_darwin_sysroot.patch",
],
strip_prefix = "toolchains_llvm_bootstrapped-121c8419394e76b5652c161369743c564799b2e3",
urls = ["https://github.com/cerisier/toolchains_llvm_bootstrapped/archive/121c8419394e76b5652c161369743c564799b2e3/master.tar.gz"],
)
bazel_dep(name = "llvm", version = "0.6.1", dev_dependency = IS_RELEASE)

register_toolchains(
"@toolchains_llvm_bootstrapped//toolchain:all",
dev_dependency = IS_RELEASE,
)

# Rust configuration
bazel_dep(name = "rules_rust", version = "0.68.1", dev_dependency = IS_RELEASE)

rust = use_extension(
"@rules_rust//rust:extensions.bzl",
"rust",
dev_dependency = IS_RELEASE,
)
rust.toolchain(
edition = "2024",
extra_target_triples = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
"aarch64-unknown-linux-musl",
"x86_64-unknown-linux-musl",
],
versions = ["1.88.0"],
)
use_repo(rust, "rust_toolchains")

register_toolchains(
"@rust_toolchains//:all",
"@llvm//toolchain:all",
dev_dependency = IS_RELEASE,
)

bazel_dep(name = "bazelrc-preset.bzl", version = "1.4.0", dev_dependency = IS_RELEASE)
bazel_dep(name = "bazel_env.bzl", version = "0.5.0", dev_dependency = IS_RELEASE)
bazel_dep(name = "bzip2", version = "1.0.8.bcr.3", dev_dependency = IS_RELEASE)
bazel_dep(name = "gazelle", version = "0.45.0", dev_dependency = IS_RELEASE)
bazel_dep(name = "rules_rs", version = "0.0.26", dev_dependency = IS_RELEASE)
bazel_dep(name = "xz", version = "5.4.5.bcr.7", dev_dependency = IS_RELEASE)
bazel_dep(name = "zstd", version = "1.5.7", dev_dependency = IS_RELEASE)
bazel_dep(name = "rules_multitool", version = "1.9.0", dev_dependency = IS_RELEASE)
Expand All @@ -107,6 +71,24 @@ multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitoo
multitool.hub(lockfile = "//tools:tools.lock.json")
use_repo(multitool, "multitool")

# Rust configuration
bazel_dep(name = "rules_rs", version = "0.0.37", dev_dependency = IS_RELEASE)

toolchains = use_extension("@rules_rs//rs/experimental/toolchains:module_extension.bzl", "toolchains", dev_dependency = IS_RELEASE)
toolchains.toolchain(
edition = "2024",
version = "1.93.1",
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i also bumped your compilers for ya while i'm here

)
use_repo(toolchains, "default_rust_toolchains")

register_toolchains(
"@default_rust_toolchains//:all",
dev_dependency = IS_RELEASE,
)

rules_rust = use_extension("@rules_rs//rs/experimental:rules_rust.bzl", "rules_rust")
use_repo(rules_rust, "rules_rust")

crate = use_extension(
"@rules_rs//rs:extensions.bzl",
"crate",
Expand All @@ -118,10 +100,13 @@ crate.from_cargo(
cargo_toml = "//:Cargo.toml",
platform_triples = [
"aarch64-apple-darwin",
"aarch64-unknown-linux-gnu",
"aarch64-unknown-linux-musl",
"x86_64-apple-darwin",
"x86_64-unknown-linux-gnu",
"x86_64-unknown-linux-musl",
],
use_experimental_platforms = True,
)
crate.annotation(
crate = "backtrace",
Expand All @@ -148,6 +133,32 @@ crate.annotation(
repositories = ["crates"],
deps = ["@@xz+//:lzma"],
)
crate.annotation(
additive_build_file_content = """
load("@rules_cc//cc:defs.bzl", "cc_import")

cc_import(
name = "windows_import_lib",
static_library = glob(["lib/*.a"])[0],
)
""",
crate = "windows_x86_64_gnullvm",
gen_build_script = "off",
deps = [":windows_import_lib"],
)
crate.annotation(
additive_build_file_content = """
load("@rules_cc//cc:defs.bzl", "cc_import")

cc_import(
name = "windows_import_lib",
static_library = glob(["lib/*.a"])[0],
)
""",
crate = "windows_aarch64_gnullvm",
gen_build_script = "off",
deps = [":windows_import_lib"],
)
use_repo(crate, "crates")

# TODO: Replace with bazel_features?
Expand Down
27 changes: 0 additions & 27 deletions bazel/patches/llvm_darwin_sysroot.patch

This file was deleted.

37 changes: 5 additions & 32 deletions bazel/platforms/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,43 +1,16 @@
load("//bazel/platforms/config:defs.bzl", "linker_suffix", "platforms")

[platform(
name = "{}_{}{}".format(
p.os,
p.cpu,
linker_suffix(
"_",
p.linker,
),
),
platform(
name = "linux_host",
constraint_values = [
"@platforms//os:{}".format(p.os),
"@platforms//cpu:{}".format(p.cpu),
"//bazel/platforms/linkers:{}".format(p.linker),
"@llvm//constraints/libc:gnu.2.28",
],
visibility = ["//visibility:public"],
) for p in platforms]

alias(
name = "linux_amd64",
actual = ":linux_x86_64",
visibility = ["//visibility:public"],
)

alias(
name = "linux_arm64",
actual = ":linux_aarch64",
visibility = ["//visibility:public"],
parents = ["@platforms//host"],
)

platform(
name = "rbe",
constraint_values = [
"@platforms//cpu:x86_64",
"@platforms//os:linux",
"@bazel_tools//tools/cpp:clang",
],
exec_properties = {
"container-image": "docker://ubuntu:22.04",
"OSFamily": "Linux",
},
parents = ["@rules_rs//rs/experimental/platforms:x86_64-unknown-linux-gnu"],
)
31 changes: 0 additions & 31 deletions bazel/platforms/config/BUILD.bazel

This file was deleted.

19 changes: 0 additions & 19 deletions bazel/platforms/config/defs.bzl

This file was deleted.

19 changes: 0 additions & 19 deletions bazel/platforms/linkers/BUILD.bazel

This file was deleted.

27 changes: 0 additions & 27 deletions bazel/platforms/toolchains/BUILD.bazel

This file was deleted.

19 changes: 0 additions & 19 deletions bazel/platforms/toolchains/defs.bzl

This file was deleted.

Loading