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 #103

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 .bazelversion
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.3.2
6.5.0
42 changes: 21 additions & 21 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ cc_library(
"jwt_verify_lib/verify.h",
],
deps = [
"//external:abseil_flat_hash_set",
"//external:abseil_strings",
"//external:abseil_time",
"//external:protobuf",
"//external:ssl",
"@boringssl//:ssl",
"@com_google_absl//absl/container:flat_hash_set",
"@com_google_absl//absl/strings",
"@com_google_absl//absl/time",
"@com_google_protobuf//:protobuf",
],
)

Expand All @@ -38,7 +38,7 @@ cc_library(
"simple_lru_cache/simple_lru_cache_inl.h",
],
deps = [
"//external:abseil_flat_hash_map",
"@com_google_absl//absl/container:flat_hash_map",
],
)

Expand All @@ -55,7 +55,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -72,7 +72,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -90,7 +90,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -107,7 +107,7 @@ cc_test(
linkstatic = 1,
deps = [
":simple_lru_cache_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -125,7 +125,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -143,7 +143,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -161,7 +161,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -179,7 +179,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -197,7 +197,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -215,7 +215,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -233,7 +233,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -251,7 +251,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -269,7 +269,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -287,7 +287,7 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)

Expand All @@ -305,6 +305,6 @@ cc_test(
linkstatic = 1,
deps = [
":jwt_verify_lib",
"//external:googletest_main",
"@com_google_googletest//:gtest_main",
],
)
35 changes: 35 additions & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
module(
name = "jwt_verify_lib",
)

bazel_dep(
name = "abseil-cpp",
version = "20240116.2",
repo_name = "com_google_absl",
)
bazel_dep(
name = "boringssl",
version = "0.0.0-20240530-2db0eb3",
)
bazel_dep(
name = "googletest",
version = "1.14.0.bcr.1",
repo_name = "com_google_googletest",
)
bazel_dep(
name = "libprotobuf-mutator",
version = "1.3",
)
bazel_dep(
name = "protobuf",
version = "26.0.bcr.1",
repo_name = "com_google_protobuf",
)
bazel_dep(
name = "rules_fuzzing",
version = "0.5.2",
)
bazel_dep(
name = "rules_proto",
version = "4.0.0",
)
40 changes: 0 additions & 40 deletions googletest.BUILD

This file was deleted.

18 changes: 13 additions & 5 deletions libprotobuf_mutator.BUILD
Original file line number Diff line number Diff line change
@@ -1,18 +1,26 @@
licenses(["notice"]) # Apache 2

cc_library(
name = "libprotobuf_mutator",
name = "protobuf-mutator",
srcs = glob(
[
"src/**/*.cc",
"src/**/*.h",
"port/protobuf.h",
],
exclude = ["**/*_test.cc"],
),
) + ["port/protobuf.h"],
hdrs = ["src/libfuzzer/libfuzzer_macro.h"],
include_prefix = "libprotobuf_mutator",
includes = ["."],
includes = [
"port",
"src",
],
visibility = ["//visibility:public"],
deps = ["@com_google_protobuf//:protobuf"],
)

alias(
name = "libprotobuf-mutator",
actual = ":protobuf-mutator",
visibility = ["//visibility:public"],
deps = ["//external:protobuf"],
)
56 changes: 2 additions & 54 deletions repositories.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,40 +11,17 @@ def boringssl_repositories(bind = True):
sha256 = BORINGSSL_SHA256,
)

if bind:
native.bind(
name = "ssl",
actual = "@boringssl//:ssl",
)

GOOGLETEST_COMMIT = "43863938377a9ea1399c0596269e0890b5c5515a"
GOOGLETEST_SHA256 = "7c8ece456ad588c30160429498e108e2df6f42a30888b3ec0abf5d9792d9d3a0"

def googletest_repositories(bind = True):
http_archive(
name = "googletest_git",
build_file = "//:googletest.BUILD",
name = "com_google_googletest",
strip_prefix = "googletest-" + GOOGLETEST_COMMIT,
url = "https://github.com/google/googletest/archive/" + GOOGLETEST_COMMIT + ".tar.gz",
sha256 = GOOGLETEST_SHA256,
)

if bind:
native.bind(
name = "googletest",
actual = "@googletest_git//:googletest",
)

native.bind(
name = "googletest_main",
actual = "@googletest_git//:googletest_main",
)

native.bind(
name = "googletest_prod",
actual = "@googletest_git//:googletest_prod",
)

ABSEIL_COMMIT = "cc8dcd307b76a575d2e3e0958a4fe4c7193c2f68" # same as Envoy
ABSEIL_SHA256 = "e35082e88b9da04f4d68094c05ba112502a5063712f3021adfa465306d238c76"

Expand All @@ -56,23 +33,6 @@ def abseil_repositories(bind = True):
sha256 = ABSEIL_SHA256,
)

if bind:
native.bind(
name = "abseil_strings",
actual = "@com_google_absl//absl/strings:strings",
)
native.bind(
name = "abseil_time",
actual = "@com_google_absl//absl/time:time",
)
native.bind(
name = "abseil_flat_hash_set",
actual = "@com_google_absl//absl/container:flat_hash_set",
)
native.bind(
name = "abseil_flat_hash_map",
actual = "@com_google_absl//absl/container:flat_hash_map",
)
_cctz_repositories(bind)

CCTZ_COMMIT = "e19879df3a14791b7d483c359c4acd6b2a1cd96b"
Expand Down Expand Up @@ -146,26 +106,14 @@ def protobuf_repositories(bind = True):
sha256 = PROTOBUF_SHA256,
)

if bind:
native.bind(
name = "protobuf",
actual = "@com_google_protobuf//:protobuf",
)

LIBPROTOBUF_MUTATOR_VERSION = "1.0"
LIBPROTOBUF_MUTATOR_SHA256 = "792f250fb546bde8590e72d64311ea00a70c175fd77df6bb5e02328fa15fe28e"

def libprotobuf_mutator_repositories(bind = True):
http_archive(
name = "com_google_libprotobuf_mutator",
name = "libprotobuf-mutator",
build_file = "//:libprotobuf_mutator.BUILD",
strip_prefix = "libprotobuf-mutator-" + LIBPROTOBUF_MUTATOR_VERSION,
url = "https://github.com/google/libprotobuf-mutator/archive/v" + LIBPROTOBUF_MUTATOR_VERSION + ".tar.gz",
sha256 = LIBPROTOBUF_MUTATOR_SHA256,
)

if bind:
native.bind(
name = "libprotobuf_mutator",
actual = "@com_google_libprotobuf_mutator//:libprotobuf_mutator",
)
8 changes: 4 additions & 4 deletions test/fuzz/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("@rules_fuzzing//fuzzing:cc_defs.bzl", "cc_fuzz_test")
# load cc_proto_library
load("@rules_proto//proto:defs.bzl", "proto_library")

licenses(["notice"])

Expand Down Expand Up @@ -27,7 +27,7 @@ cc_fuzz_test(
deps = [
":jwt_verify_lib_fuzz_input_cc_proto",
"//:jwt_verify_lib",
"//external:libprotobuf_mutator",
"@libprotobuf-mutator",
],
)

Expand All @@ -41,7 +41,7 @@ cc_test(
deps = [
":jwt_verify_lib_fuzz_input_cc_proto",
"//:jwt_verify_lib",
"//external:abseil_strings",
"//external:googletest_main",
"@com_google_absl//absl/strings",
"@com_google_googletest//:gtest_main",
],
)