Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(bazel): add MODULE.bazel files for bzlmod #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -16,8 +16,8 @@
# https://github.com/bazelbuild/rules_fuzzing/blob/f6062a88d83463e2900e47bc218547ba046dad44/.bazelrc

# Force the use of Clang for all builds.
build --action_env=CC=clang-10
build --action_env=CXX=clang++-10
build --action_env=CC=clang-14
build --action_env=CXX=clang++-14

build --cxxopt=-std=c++14
build --host_cxxopt=-std=c++14
2 changes: 1 addition & 1 deletion .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.0
6.5.0
62 changes: 62 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
module(
name = "grpc-httpjson-transcoding",
version = "0.0.0-20230607-ff41eb3",
)

bazel_dep(
name = "abseil-cpp",
version = "20240116.2",
repo_name = "com_google_absl",
)
bazel_dep(
name = "googletest",
version = "1.14.0.bcr.1",
repo_name = "com_google_googletest",
dev_dependency = True,
)
bazel_dep(
name = "google_benchmark",
version = "1.8.3",
repo_name = "com_google_benchmark",
dev_dependency = True,
)
bazel_dep(
name = "nlohmann_json",
version = "3.11.3",
repo_name = "com_github_nlohmann_json",
)
bazel_dep(
name = "proto-converter",
version = "0.0.0-20230607-d77ff30",
repo_name = "com_google_protoconverter",
)
bazel_dep(
name = "protobuf",
version = "26.0.bcr.1",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "rules_cc",
version = "0.0.9",
)
bazel_dep(
name = "rules_fuzzing",
version = "0.5.2",
dev_dependency = True,
)
bazel_dep(
name = "rules_proto",
version = "5.3.0-21.7",
)
bazel_dep(
name = "zlib",
version = "1.2.13",
)

# -- bazel_dep definitions -- #

non_module_deps = use_extension("//:extensions.bzl", "non_module_deps")
use_repo(non_module_deps, "com_google_googleapis")

googleapis_ext = use_extension("//:googleapis_ext.bzl", "googleapis_ext")
use_repo(googleapis_ext, "com_google_googleapis_imports")
11 changes: 5 additions & 6 deletions WORKSPACE
Original file line number Diff line number Diff line change
@@ -15,6 +15,11 @@
################################################################################
#

# See
# https://github.com/bazelbuild/rules_fuzzing/blob/master/README.md#configuring-the-workspace.
# The fuzzing rules must be first because if they are not, bazel will
# pull in incompatible versions of absl and rules_python.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load(
"//:repositories.bzl",
"absl_repositories",
@@ -27,12 +32,6 @@ load(
"protoconverter_repositories",
)

# See
# https://github.com/bazelbuild/rules_fuzzing/blob/master/README.md#configuring-the-workspace.
# The fuzzing rules must be first because if they are not, bazel will
# pull in incompatible versions of absl and rules_python.
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "rules_fuzzing",
sha256 = "d9002dd3cd6437017f08593124fdd1b13b3473c7b929ceb0e60d317cb9346118",
Empty file added WORKSPACE.bzlmod
Empty file.
11 changes: 11 additions & 0 deletions extensions.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

def _non_module_deps_impl(_ctx):
http_archive(
name = "com_google_googleapis",
url = "https://github.com/googleapis/googleapis/archive/1d5522ad1056f16a6d593b8f3038d831e64daeea.tar.gz",
sha256 = "cd13e547cffaad217c942084fd5ae0985a293d0cce3e788c20796e5e2ea54758",
strip_prefix = "googleapis-1d5522ad1056f16a6d593b8f3038d831e64daeea",
)

non_module_deps = module_extension(implementation = _non_module_deps_impl)
6 changes: 6 additions & 0 deletions googleapis_ext.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
load("@com_google_googleapis//:repository_rules.bzl", "switched_rules_by_language")

googleapis_ext = module_extension(implementation = lambda x: switched_rules_by_language(
name = "com_google_googleapis_imports",
cc = True,
))
1 change: 0 additions & 1 deletion perf_benchmark/BUILD
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
################################################################################
#
load("@rules_cc//cc:defs.bzl", "cc_binary", "cc_library", "cc_test")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@io_bazel_rules_docker//cc:image.bzl", "cc_image")
load("@io_bazel_rules_docker//container:container.bzl", "container_push")

1 change: 0 additions & 1 deletion repositories.bzl
Original file line number Diff line number Diff line change
@@ -15,7 +15,6 @@
################################################################################
#
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

def absl_repositories(bind = True):
http_archive(
1 change: 0 additions & 1 deletion test/BUILD
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@
#
################################################################################
#
load("@com_google_protobuf//:protobuf.bzl", "py_proto_library")
load("@rules_fuzzing//fuzzing:cc_defs.bzl", "cc_fuzz_test")

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