Skip to content

Commit 4a8d3a1

Browse files
keithphlax
authored andcommitted
bazel: Add LLVM toolchain
Signed-off-by: Keith Smiley <[email protected]> Signed-off-by: Ryan Northey <[email protected]>
1 parent 884691f commit 4a8d3a1

6 files changed

+34
-0
lines changed

.bazelrc

+7
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,13 @@ build:windows --action_env=PATH --host_action_env=PATH
4545
# Requires setting `BAZEL_VOLATILE_DIRTY` in the env.
4646
build --action_env=BAZEL_VOLATILE_DIRTY --host_action_env=BAZEL_VOLATILE_DIRTY
4747

48+
# Prevent stamped caches from busting (eg in PRs)
49+
# Requires setting `BAZEL_FAKE_SCM_REVISION` in the env.
50+
build --action_env=BAZEL_FAKE_SCM_REVISION --host_action_env=BAZEL_FAKE_SCM_REVISION
51+
52+
# build --incompatible_enable_cc_toolchain_resolution
53+
54+
# build --enable_platform_specific_config
4855
build --test_summary=terse
4956

5057
build:docs-ci --action_env=DOCS_RST_CHECK=1 --host_action_env=DOCS_RST_CHECK=1

WORKSPACE

+4
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,7 @@ envoy_dependency_imports()
3131
load("//bazel:dependency_imports_extra.bzl", "envoy_dependency_imports_extra")
3232

3333
envoy_dependency_imports_extra()
34+
35+
load("@llvm_toolchain//:toolchains.bzl", "llvm_register_toolchains")
36+
37+
llvm_register_toolchains()

bazel/dependency_imports.bzl

+6
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ load("@rules_rust//crate_universe:defs.bzl", "crates_repository")
1818
load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
1919
load("@rules_rust//rust:defs.bzl", "rust_common")
2020
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains", "rust_repository_set")
21+
load("@com_grail_bazel_toolchain//toolchain:rules.bzl", "llvm_toolchain")
2122

2223
# go version for rules_go
2324
GO_VERSION = "1.23.1"
@@ -175,6 +176,11 @@ def envoy_dependency_imports(go_version = GO_VERSION, jq_version = JQ_VERSION, y
175176
protoc_gen_jsonschema_go_dependencies()
176177
rules_proto_grpc_toolchains()
177178

179+
llvm_toolchain(
180+
name = "llvm_toolchain",
181+
llvm_version = "14.0.0",
182+
)
183+
178184
def envoy_download_go_sdks(go_version):
179185
go_download_sdk(
180186
name = "go_linux_amd64",

bazel/repositories.bzl

+1
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,7 @@ def envoy_dependencies(skip_targets = []):
220220
external_http_archive("bazel_toolchains")
221221
external_http_archive("bazel_compdb")
222222
external_http_archive("envoy_examples")
223+
external_http_archive("com_grail_bazel_toolchain")
223224

224225
_com_github_maxmind_libmaxminddb()
225226

bazel/repositories_extra.bzl

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ load("@emsdk//:deps.bzl", emsdk_deps = "deps")
55
load("@proxy_wasm_cpp_host//bazel/cargo/wasmtime/remote:crates.bzl", "crate_repositories")
66
load("@rules_python//python:repositories.bzl", "py_repositories", "python_register_toolchains")
77
load("//bazel/external/cargo:crates.bzl", "raze_fetch_remote_crates")
8+
load("@com_grail_bazel_toolchain//toolchain:deps.bzl", "bazel_toolchain_dependencies")
89

910
def _python_minor_version(python_version):
1011
return "_".join(python_version.split(".")[:-1])
@@ -34,3 +35,5 @@ def envoy_dependencies_extra(
3435

3536
if not native.existing_rule("proto_bazel_features"):
3637
proto_bazel_features(name = "proto_bazel_features")
38+
39+
bazel_toolchain_dependencies()

bazel/repository_locations.bzl

+13
Original file line numberDiff line numberDiff line change
@@ -1536,6 +1536,19 @@ REPOSITORY_LOCATIONS_SPEC = dict(
15361536
license = "Apache-2.0",
15371537
license_url = "https://github.com/bazelbuild/rules_license/blob/{version}/LICENSE",
15381538
),
1539+
com_grail_bazel_toolchain = dict(
1540+
project_name = "com_grail_bazel_toolchain",
1541+
project_desc = "A LLVM toolchain for bazel",
1542+
project_url = "https://github.com/grailbio/bazel-toolchain",
1543+
strip_prefix = "bazel-toolchain-{version}",
1544+
version = "70a0fb556662fe3cadb07da32c91e232eb0d883d",
1545+
sha256 = "54570e20b8c94c324b0684998893f730afcc4b12e1ebcec0246c1d0301ae4847",
1546+
urls = ["https://github.com/grailbio/bazel-toolchain/archive/{version}.tar.gz"],
1547+
use_category = [],
1548+
extensions = [],
1549+
release_date = "2023-01-06",
1550+
cpe = "N/A",
1551+
),
15391552
utf8_range = dict(
15401553
project_name = "utf8_range",
15411554
project_desc = "Fast UTF-8 validation with Range algorithm (NEON+SSE4+AVX2)",

0 commit comments

Comments
 (0)