Skip to content
Merged
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
15 changes: 8 additions & 7 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,18 @@ build --@capnp-cpp//src/kj:openssl=True --@capnp-cpp//src/kj:zlib=True --@capnp-
build --cxxopt="-fbracket-depth=512" --host_cxxopt="-fbracket-depth=512"

# Additional Rust flags (see https://doc.rust-lang.org/rustc/codegen-options/index.html)
# Need to disable debug-assertions for fastbuild, should be off automatically for opt
build --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,debug-assertions=n
# Need to disable debug-assertions for fastbuild, should be off automatically for opt. As long as
# rust-level LTO is not enabled, LLVM bitcode is not needed so -C embed-bitcode=n provides a free
# improvement to build speed and rust-deps code size.
build --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,debug-assertions=n,-C,embed-bitcode=n

build:fastdbg --@rules_rust//:extra_rustc_flags=-C,panic=unwind,-C,debug-assertions=y,-C,debuginfo=1
build:fastdbg --@rules_rust//:extra_rustc_flags=-C,panic=unwind,-C,debug-assertions=y,-C,debuginfo=1,-C,embed-bitcode=n

# TODO(later): -C codegen-units=1 improves code size and quality, should be enabled in a future
# release configuration even if lto is off. Similarly, adding -C lto=thin would improve binary size
# a lot (~2.2MB on Linux) – disable it for now due to compile errors and wrong code generation when
# bazel and Rust use different LLVM versions. -C opt-level=s provides a comparatively small size
# improvement, ~35k or ~75k with LTO.
build:thin-lto --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,codegen-units=1
# significantly – disable it for now due to compile errors and wrong code generation when bazel and
# rust use different LLVM versions.
build:thin-lto --@rules_rust//:extra_rustc_flags=-C,panic=abort,-C,codegen-units=1,-C,embed-bitcode=n

#
# Linux and macOS
Expand Down
37 changes: 13 additions & 24 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,6 @@ load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

bazel_skylib_workspace()

http_archive(
name = "rules_foreign_cc",
sha256 = "6041f1374ff32ba711564374ad8e007aef77f71561a7ce784123b9b4b88614fc",
strip_prefix = "rules_foreign_cc-0.8.0",
url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.8.0.tar.gz",
)

load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")

rules_foreign_cc_dependencies()

# ========================================================================================
# Simple dependencies

Expand Down Expand Up @@ -123,54 +112,54 @@ http_archive(
http_file(
name = "cargo_bazel_linux_x64",
executable = True,
sha256 = "a9f81a6fd356fc01e3da2483bdd1f9dfb080b0bdf5a128fa036c048e5b301562",
sha256 = "885c4bd890ace1cf35d19edbeaff4f7ceb99c57f28464d3e979d496a95648866",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-x86_64-unknown-linux-gnu",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-x86_64-unknown-linux-gnu",
],
)

http_file(
name = "cargo_bazel_linux_arm64",
executable = True,
sha256 = "f2d168c386d38c0d5ca429c34dcbc5a6aec5be19ee1d4f6f0e614293b0e55468",
sha256 = "d28587856721782ad2878b20f24f5e01987d0079711c15bd3b98546d716421d1",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-aarch64-unknown-linux-gnu",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-aarch64-unknown-linux-gnu",
],
)

http_file(
name = "cargo_bazel_macos_x64",
executable = True,
sha256 = "fb80acb9fcfd83674f73e98bf956bc65b33f31a4380ba72fbc1a6a9bf22c2f8c",
sha256 = "6b80c992f3eb9860b63b5c2c25b6cd34ff90453e40ac9a87197fb6131f64e9d7",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-x86_64-apple-darwin",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-x86_64-apple-darwin",
],
)

http_file(
name = "cargo_bazel_macos_arm64",
executable = True,
sha256 = "4104ea8edd3fccbcfc43265e4fa02dfc25b12b32250ff46456b829ab9cb78908",
sha256 = "e0756e4c11fe459502a8cbf7e4e0ccc6141f352d40274ac625753ec52b998c6d",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-aarch64-apple-darwin",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-aarch64-apple-darwin",
],
)

http_file(
name = "cargo_bazel_win_x64",
executable = True,
sha256 = "a57c496e8ff9d1b2dcd4f6a3a43c41ed0c54e9f3d48183ed411097c3590176d3",
sha256 = "a51d0db5a0c5ce9622d0f87cf8828b7c15825a48558c05d9861563f65837f115",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/cargo-bazel-x86_64-pc-windows-msvc.exe",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/cargo-bazel-x86_64-pc-windows-msvc.exe",
],
downloaded_file_path = "downloaded.exe" # .exe extension required for Windows to recognise as executable
)

http_archive(
name = "rules_rust",
sha256 = "0cc7e6b39e492710b819e00d48f2210ae626b717a3ab96e048c43ab57e61d204",
sha256 = "4a9cb4fda6ccd5b5ec393b2e944822a62e050c7c06f1ea41607f14c4fdec57a2",
urls = [
"https://github.com/bazelbuild/rules_rust/releases/download/0.10.0/rules_rust-v0.10.0.tar.gz",
"https://github.com/bazelbuild/rules_rust/releases/download/0.25.1/rules_rust-v0.25.1.tar.gz",
],
)

Expand All @@ -180,7 +169,7 @@ rules_rust_dependencies()

rust_register_toolchains(
edition = "2018",
version = "1.66.0",
versions = ["1.66.0"],
)

load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
Expand Down
33 changes: 8 additions & 25 deletions rust-deps/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -61,35 +61,20 @@ crates_vendor(
cargo_bazel = CARGO_BAZEL,
mode = "remote",
packages = {
"anyhow": crate.spec(
features = ["default"],
version = "1",
),
"libc": crate.spec(
version = "0.2",
),
"addr2line": crate.spec(
default_features = False,
features = [
"std",
"rustc-demangle",
"cpp_demangle",
"fallible-iterator",
"smallvec",
],
version = "0.14",
),
"lolhtml": crate.spec(
git = "https://github.com/cloudflare/lol-html.git",
rev = "2681dcf0b3e6907111565199df8c43cc9aab7fe8",
),

# Used for RTTI parameter extraction
# Crates used for RTTI parameter extraction
"anyhow": crate.spec(
features = ["default"],
version = "1",
),
"clang-ast": crate.spec(
version = "0.1",
),
"flate2": crate.spec(
version = "1.0.24",
version = "1.0.26",
),
"serde": crate.spec(
version = "1.0",
Expand All @@ -109,11 +94,9 @@ crates_vendor(
"aarch64-unknown-linux-gnu",
"x86_64-unknown-linux-gnu",
"x86_64-pc-windows-msvc",

# this is not used but its required to work around a bug in rules_rust where
# invalid select statements can get generated in vendored BUILD files
"wasm32-unknown-unknown",
],
# Not needed, we have a well-defined set of supported platforms
generate_target_compatible_with = False,
)

rust_static_library(
Expand Down
100 changes: 0 additions & 100 deletions rust-deps/crates/BUILD.addr2line-0.14.1.bazel

This file was deleted.

62 changes: 7 additions & 55 deletions rust-deps/crates/BUILD.adler-1.0.2.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,7 @@
# bazel run @//rust-deps:crates_vendor
###############################################################################

load(
"@bazel_skylib//lib:selects.bzl",
"selects",
)

# buildifier: disable=bzl-visibility
load("@rules_rust//crate_universe/private:selects.bzl", "select_with_or")
load(
"@rules_rust//rust:defs.bzl",
"rust_library",
)
load("@rules_rust//rust:defs.bzl", "rust_library")

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

Expand All @@ -26,65 +16,27 @@ package(default_visibility = ["//visibility:public"])

rust_library(
name = "adler",
srcs = glob(
include = [
"**/*.rs",
],
exclude = [
],
),
aliases = selects.with_or({
"//conditions:default": {
},
}),
srcs = glob(["**/*.rs"]),
compile_data = glob(
include = ["**"],
exclude = [
"**/* *",
".tmp_git_root/**/*",
"BUILD",
"BUILD.bazel",
"WORKSPACE",
"WORKSPACE.bazel",
],
) + select_with_or({
"//conditions:default": [
],
}),
crate_features = [
],
),
crate_root = "src/lib.rs",
data = select_with_or({
"//conditions:default": [
],
}),
edition = "2015",
proc_macro_deps = [
] + select_with_or({
"//conditions:default": [
],
}),
rustc_env = {
},
rustc_env_files = select_with_or({
"//conditions:default": [
],
}),
rustc_flags = [
# In most cases, warnings in 3rd party crates are not interesting as
# they're out of the control of consumers. The flag here silences
# warnings. For more details see:
# https://doc.rust-lang.org/rustc/lints/levels.html
"--cap-lints=allow",
],
rustc_flags = ["--cap-lints=allow"],
tags = [
"cargo-bazel",
"crate-name=adler",
"manual",
"noclippy",
"norustfmt",
],
version = "1.0.2",
deps = [
] + select_with_or({
"//conditions:default": [
],
}),
)
Loading