Skip to content
Draft
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 bazel/.bazelrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
common --enable_bzlmod=0
common --enable_bzlmod
64 changes: 48 additions & 16 deletions bazel/MODULE.bazel
Original file line number Diff line number Diff line change
@@ -1,28 +1,60 @@
module(name = "envoy_toolshed", version = "")

bazel_dep(name = "aspect_bazel_lib", version = "2.4.2")
bazel_dep(name = "bazel_skylib", version = "1.5.0")
bazel_dep(name = "rules_pkg", version = "0.7.0")
bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_perl", version = "0.2.3")
bazel_dep(name = "aspect_bazel_lib", version = "2.16.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")
bazel_dep(name = "platforms", version = "1.0.0")
bazel_dep(name = "rules_foreign_cc", version = "0.14.0")
bazel_dep(name = "rules_perl", version = "0.4.1")
bazel_dep(name = "rules_pkg", version = "1.0.1")
bazel_dep(name = "rules_python", version = "1.4.1")
bazel_dep(name = "rules_shell", version = "0.6.1")
bazel_dep(name = "toolchains_llvm", version = "1.4.0")
# -- bazel_dep definitions -- #

bazel_lib_toolchains = use_extension("@aspect_bazel_lib//lib:extensions.bzl", "toolchains")
bazel_lib_toolchains.jq()
use_repo(bazel_lib_toolchains, "jq_toolchains")

llvm = use_extension("@toolchains_llvm//toolchain/extensions:llvm.bzl", "llvm")
llvm.toolchain()

use_repo(llvm, "llvm_toolchain")
register_toolchains("@llvm_toolchain//:all")

PYTHON_VERSIONS = [
"3.9",
"3.10",
"3.11",
"3.12",
"3.13",
]

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.11")
[
python.toolchain(
is_default = python_version == PYTHON_VERSIONS[-1],
python_version = python_version,
)
for python_version in PYTHON_VERSIONS
]

pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip3",
python_version = "3.11",
requirements_lock = "//:requirements.txt",
)
pip.parse(
hub_name = "website_pip3",
python_version = "3.11",
requirements_lock = "//website:requirements.txt",
)

[
pip.parse(
hub_name = "pip3",
python_version = python_version,
requirements_lock = "//:requirements.txt",
)
for python_version in PYTHON_VERSIONS
]
[
pip.parse(
hub_name = "website_pip3",
python_version = python_version,
requirements_lock = "//website:requirements.txt",
)
for python_version in PYTHON_VERSIONS
]

use_repo(pip, "pip3", "website_pip3")
3 changes: 2 additions & 1 deletion bazel/dependency/macros.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

def updater(
name,
Expand Down Expand Up @@ -61,7 +62,7 @@ def updater(
data += [post_script]
env["VERSION_UPDATE_POST_SCRIPT"] = "$(location %s)" % post_script

native.sh_binary(
sh_binary(
name = name,
srcs = [update_script],
data = data,
Expand Down
5 changes: 3 additions & 2 deletions bazel/profiler/macros.bzl
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@aspect_bazel_lib//lib:jq.bzl", "jq")
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

def rules_pools(
name,
Expand All @@ -10,7 +11,7 @@ def rules_pools(
"""Generate a dict with keys being non-`default` pools, and values
are a list of targets configured to use the pool.
"""
native.sh_binary(
sh_binary(
name = "find_rules_pools",
srcs = [pool_script],
data = [
Expand Down Expand Up @@ -358,7 +359,7 @@ def ci_changes(
""",
)

native.sh_binary(
sh_binary(
name = "update",
srcs = [update_script],
data = [
Expand Down
3 changes: 2 additions & 1 deletion bazel/tarball/macros.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

def unpacker(
name,
Expand Down Expand Up @@ -52,7 +53,7 @@ def unpacker(
data += [zstd]
env["ZSTD"] = "$(location %s)" % zstd

native.sh_binary(
sh_binary(
name = name,
srcs = [script],
visibility = visibility,
Expand Down
5 changes: 3 additions & 2 deletions bazel/utils.bzl
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
load("@rules_shell//shell:sh_binary.bzl", "sh_binary")

def cat(name = "cat", flag = "target"):
"""
Expand Down Expand Up @@ -44,7 +45,7 @@ def cat(name = "cat", flag = "target"):
srcs = [":%s" % flag],
)

native.sh_binary(
sh_binary(
name = name,
srcs = ["%s_sh" % name],
data = [":%s" % flag],
Expand Down Expand Up @@ -92,7 +93,7 @@ def jqcat(
build_setting_default = ":jqempty",
)

native.sh_binary(
sh_binary(
name = name,
srcs = [jq_script],
data = [
Expand Down
9 changes: 9 additions & 0 deletions bazel/versions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ VERSIONS = {
"strip_prefix": "{name}-{version}",
},

"rules_shell": {
"type": "github_archive",
"repo": "bazelbuild/rules_shell",
"version": "0.6.1",
"sha256": "e6b87c89bd0b27039e3af2c5da01147452f240f75d505f5b6880874f31036307",
"url": "https://github.com/{repo}/releases/download/v{version}/{name}-v{version}.tar.gz",
"strip_prefix": "{name}-{version}",
},

"toolchains_llvm": {
"type": "github_archive",
"repo": "bazel-contrib/toolchains_llvm",
Expand Down
Loading