Skip to content

Commit

Permalink
screw hermetic toolchains.
Browse files Browse the repository at this point in the history
  • Loading branch information
mempler committed Dec 11, 2023
1 parent 700b683 commit 3031710
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 50 deletions.
25 changes: 5 additions & 20 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,20 @@
common --enable_bzlmod

# Enable modern C++ features.
build --cxxopt=-std=c++23
# and modern C features.
build --copt=-std=gnu17
build --cxxopt=-std=c++20
build --conlyopt=-std=gnu17

build --repo_env=CC=clang
build --repo_env=CXX=clang++

# https://github.com/bazelbuild/bazel/issues/7260
build --incompatible_enable_cc_toolchain_resolution
build --action_env=BAZEL_DO_NOT_DETECT_CPP_TOOLCHAIN=1

# Needed for Bazel versions before 7.
# Without this, one can use `--linkopt='-undefined dynamic_lookup'`.
# This feature is intentionally not supported on macOS.
build --features=-supports_dynamic_linker
# Not needed after https://github.com/grailbio/bazel-toolchain/pull/229.
build --features=-libtool

build --platforms=@toolchains_llvm//platforms:linux-x86_64
build --host_platform=@local_config_platform//:host
build --extra_toolchains=@llvm_toolchain//:cc-toolchain-x86_64-linux

build --verbose_failures
build --worker_sandboxing

# Improve performance for hermetic builds.
# https://github.com/bazelbuild/bazel/issues/8230#issuecomment-1129264658
# https://github.com/aspect-build/gcc-toolchain/issues/85#issue-1340427935
build --experimental_reuse_sandbox_directories

build --experimental_output_directory_naming_scheme=diff_against_baseline

# Tests are usually written for the host platform, just simpler to deal with.
test --platforms=@local_config_platform//:host
test --test_sharding_strategy=explicit
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ prebuilt binaries available for Windows, Linux and macOS. you can find the binar

## Navigation

To navigate around the codebase, its recommended to
To navigate around the codebase, it's recommended to
use [Sourcegraph](https://sourcegraph.com/github.com/bolt-sys/bolt)
or your IDE's search implementation.

Expand Down
29 changes: 0 additions & 29 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,35 +19,6 @@ git_override(
commit = "eca42c63700fccdc49cf58177e0a96f0f6075a68",
)

#
# C++ Toolchain
#
bazel_dep(name = "toolchains_llvm", version = "0.10.3")

git_override(
module_name = "toolchains_llvm",
commit = "cba5e70a3318ce535597c782422c9c8afe8ee128",
remote = "https://github.com/bolt-sys/bazel-toolchain",
)

# Configure and register the toolchain.
llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")

llvm.toolchain(
llvm_versions = {
"": "17.0.6",
"darwin-aarch64": "17.0.6",
"darwin-x86_64": "15.0.7",
},
sysroot = {
"linux-x86_64": "@@org_chromium_sysroot_linux_x64//:sysroot",
},
)

use_repo(llvm, "llvm_toolchain")

register_toolchains("@llvm_toolchain//:all")

#
# Testing
#
Expand Down

0 comments on commit 3031710

Please sign in to comment.