Skip to content

Commit 78828eb

Browse files
committed
Bazel module support
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
1 parent d8b7b81 commit 78828eb

11 files changed

Lines changed: 75 additions & 40 deletions

File tree

.bazelrc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
1+
common --enable_bzlmod
2+
13
build --enable_platform_specific_config
24
build --features=-supports_dynamic_linker
35
build --copt="-Wall"
4-
build --copt="-Werror"
6+
build --cxxopt="-std=c++17"
7+
build --host_cxxopt="-std=c++17"
58
build:windows --copt=/wd4716
9+
build:windows --cxxopt="/std:c++17"
10+
build:windows --host_cxxopt="/std:c++17"
11+
build:windows --cxxopt="-std=c++17"
12+
build:windows --host_cxxopt="-std=c++17"
613

714
# Pass PATH variable from the environment
815
build --action_env=PATH

.bazelversion

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
4.0.0
1+
7.6.1

.gitignore

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,9 @@
3434
# user's bazel configuration files
3535
user.bazelrc
3636

37-
# bazel artifacts
38-
/bazel-bin
39-
/bazel-out
40-
/bazel-cpp2sky
41-
/bazel-testlogs
37+
# Ignore links to Bazel's output. The pattern needs the `*` because people can change the name of the directory into which your repository is cloned (changing the `bazel-<workspace_name>` symlink), and must not end with a trailing `/` because it's a symlink on macOS/Linux.
38+
/bazel-*
39+
MODULE.bazel.lock
4240

4341
# editor settings
4442
.vscode/
@@ -51,8 +49,6 @@ coverage_report
5149
### Automatically added by Hedron's Bazel Compile Commands Extractor: https://github.com/hedronvision/bazel-compile-commands-extractor
5250
# Ignore the `external` link (that is added by `bazel-compile-commands-extractor`). The link differs between macOS/Linux and Windows, so it shouldn't be checked in. The pattern must not end with a trailing `/` because it's a symlink on macOS/Linux.
5351
/external
54-
# Ignore links to Bazel's output. The pattern needs the `*` because people can change the name of the directory into which your repository is cloned (changing the `bazel-<workspace_name>` symlink), and must not end with a trailing `/` because it's a symlink on macOS/Linux.
55-
/bazel-*
5652
# Ignore generated output. Although valuable (after all, the primary purpose of `bazel-compile-commands-extractor` is to produce `compile_commands.json`!), it should not be checked in.
5753
/compile_commands.json
5854
# Ignore the directory in which `clangd` stores its local index.

MODULE.bazel

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
module(
2+
name = "cpp2sky",
3+
version = "0.6.1-dev",
4+
)
5+
6+
bazel_dep(name = "abseil-cpp", version = "20250512.1", repo_name = "com_google_absl")
7+
bazel_dep(name = "fmt", version = "8.1.1", repo_name = "com_github_fmtlib_fmt")
8+
bazel_dep(name = "grpc", version = "1.74.1", repo_name = "com_github_grpc_grpc")
9+
bazel_dep(name = "cpp-httplib", version = "0.22.0", repo_name = "com_github_httplib")
10+
bazel_dep(name = "protobuf", version = "32.0", repo_name = "com_google_protobuf")
11+
bazel_dep(name = "rules_cc", version = "0.2.2")
12+
bazel_dep(name = "rules_proto", version = "7.1.0")
13+
bazel_dep(name = "skywalking-data-collect-protocol", version = "9.7.0", repo_name = "skywalking_data_collect_protocol")
14+
git_override(
15+
module_name = "skywalking-data-collect-protocol",
16+
commit = "fb3fb005650e2489164978b7804117c7ade1529a",
17+
remote = "https://github.com/apache/skywalking-data-collect-protocol.git",
18+
)
19+
20+
bazel_dep(name = "spdlog", version = "1.10.0", repo_name = "com_github_gabime_spdlog")
21+
22+
bazel_dep(name = "googletest", version = "1.17.0", dev_dependency = True, repo_name = "com_google_googletest")
23+
bazel_dep(name = "hedron_compile_commands", dev_dependency = True)
24+
git_override(
25+
module_name = "hedron_compile_commands",
26+
commit = "abb61a688167623088f8768cc9264798df6a9d10",
27+
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
28+
)

WORKSPACE

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,10 @@ load("//bazel:repositories.bzl", "cpp2sky_dependencies")
44

55
cpp2sky_dependencies()
66

7-
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
7+
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")
88

99
rules_proto_dependencies()
1010

11-
rules_proto_toolchains()
12-
1311
load("@com_github_grpc_grpc//bazel:grpc_deps.bzl", "grpc_deps")
1412

1513
grpc_deps()
@@ -18,6 +16,10 @@ load("@com_github_grpc_grpc//bazel:grpc_extra_deps.bzl", "grpc_extra_deps")
1816

1917
grpc_extra_deps()
2018

19+
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
20+
21+
protobuf_deps()
22+
2123
load("@hedron_compile_commands//:workspace_setup.bzl", "hedron_compile_commands_setup")
2224

2325
hedron_compile_commands_setup()

WORKSPACE.bzlmod

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
workspace(name = "cpp2sky")

bazel/fmtlib.BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ load("@rules_cc//cc:defs.bzl", "cc_library")
33
licenses(["notice"]) # Apache 2
44

55
cc_library(
6-
name = "fmtlib",
6+
name = "fmt",
77
hdrs = glob([
88
"include/fmt/*.h",
99
]),

bazel/repositories.bzl

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,54 +15,54 @@ def cpp2sky_dependencies():
1515
def skywalking_data_collect_protocol():
1616
http_archive(
1717
name = "skywalking_data_collect_protocol",
18-
sha256 = "4cf7cf84a9478a09429a7fbc6ad1e1b10c70eb54999438a36eacaf539a39d343",
18+
sha256 = "b7b2df420440b08929280ecb95d0d7fb8ef301f5e3add1f04fef6fb75cf51f61",
1919
urls = [
20-
"https://github.com/apache/skywalking-data-collect-protocol/archive/v9.1.0.tar.gz",
20+
"https://github.com/apache/skywalking-data-collect-protocol/archive/fb3fb005650e2489164978b7804117c7ade1529a.tar.gz",
2121
],
22-
strip_prefix = "skywalking-data-collect-protocol-9.1.0",
22+
strip_prefix = "skywalking-data-collect-protocol-fb3fb005650e2489164978b7804117c7ade1529a",
2323
)
2424

2525
def com_github_grpc_grpc():
2626
http_archive(
2727
name = "com_github_grpc_grpc",
28-
sha256 = "1ccc2056b68b81ada8df61310e03dfa0541c34821fd711654d0590a7321db9c8",
29-
urls = ["https://github.com/grpc/grpc/archive/a3ae8e00a2c5553c806e83fae83e33f0198913f0.tar.gz"],
30-
strip_prefix = "grpc-a3ae8e00a2c5553c806e83fae83e33f0198913f0",
28+
sha256 = "7bf97c11cf3808d650a3a025bbf9c5f922c844a590826285067765dfd055d228",
29+
urls = ["https://github.com/grpc/grpc/archive/refs/tags/v1.74.1.tar.gz"],
30+
strip_prefix = "grpc-1.74.1",
3131
)
3232

3333
def rules_proto():
3434
http_archive(
3535
name = "rules_proto",
36-
sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
37-
strip_prefix = "rules_proto-4.0.0",
36+
sha256 = "14a225870ab4e91869652cfd69ef2028277fc1dc4910d65d353b62d6e0ae21f4",
37+
strip_prefix = "rules_proto-7.1.0",
3838
urls = [
39-
"https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
39+
"https://github.com/bazelbuild/rules_proto/releases/download/7.1.0/rules_proto-7.1.0.tar.gz",
4040
],
4141
)
4242

4343
def com_google_googletest():
4444
http_archive(
4545
name = "com_google_googletest",
46-
sha256 = "7897bfaa5ad39a479177cfb5c3ce010184dbaee22a7c3727b212282871918751",
47-
strip_prefix = "googletest-a4ab0abb93620ce26efad9de9296b73b16e88588",
48-
urls = ["https://github.com/google/googletest/archive/a4ab0abb93620ce26efad9de9296b73b16e88588.tar.gz"],
46+
sha256 = "65fab701d9829d38cb77c14acdc431d2108bfdbf8979e40eb8ae567edf10b27c",
47+
strip_prefix = "googletest-1.17.0",
48+
urls = ["https://github.com/google/googletest/releases/download/v1.17.0/googletest-1.17.0.tar.gz"],
4949
)
5050

5151
def com_google_protobuf():
5252
http_archive(
5353
name = "com_google_protobuf",
54-
sha256 = "89ac31a93832e204db6d73b1e80f39f142d5747b290f17340adce5be5b122f94",
55-
strip_prefix = "protobuf-3.19.4",
56-
urls = ["https://github.com/protocolbuffers/protobuf/releases/download/v3.19.4/protobuf-cpp-3.19.4.tar.gz"],
54+
sha256 = "3ad017543e502ffaa9cd1f4bd4fe96cf117ce7175970f191705fa0518aff80cd",
55+
strip_prefix = "protobuf-32.0",
56+
urls = ["https://github.com/google/protobuf/archive/refs/tags/v32.0.tar.gz"],
5757
)
5858

5959
def com_github_httplib():
6060
http_archive(
6161
name = "com_github_httplib",
62-
sha256 = "0e424f92b607fc9245c144dada85c2e97bc6cc5938c0c69a598a5b2a5c1ab98a",
63-
strip_prefix = "cpp-httplib-0.7.15",
62+
sha256 = "fcfea48c8f2c386e7085ef8545c8a4875efa30fa6d5cf9dd31f03c6ad038da9d",
63+
strip_prefix = "cpp-httplib-0.22.0",
6464
build_file = "//bazel:httplib.BUILD",
65-
urls = ["https://github.com/yhirose/cpp-httplib/archive/v0.7.15.tar.gz"],
65+
urls = ["https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.22.0.tar.gz"],
6666
)
6767

6868
def com_github_fmtlib_fmt():
@@ -77,18 +77,18 @@ def com_github_fmtlib_fmt():
7777
def com_github_gabime_spdlog():
7878
http_archive(
7979
name = "com_github_gabime_spdlog",
80-
sha256 = "6fff9215f5cb81760be4cc16d033526d1080427d236e86d70bb02994f85e3d38",
81-
strip_prefix = "spdlog-1.9.2",
80+
sha256 = "697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224",
81+
strip_prefix = "spdlog-1.10.0",
8282
build_file = "//bazel:spdlog.BUILD",
83-
urls = ["https://github.com/gabime/spdlog/archive/v1.9.2.tar.gz"],
83+
urls = ["https://github.com/gabime/spdlog/archive/refs/tags/v1.10.0.tar.gz"],
8484
)
8585

8686
def com_google_abseil():
8787
http_archive(
8888
name = "com_google_absl",
89-
sha256 = "5ca73792af71ab962ee81cdf575f79480704b8fb87e16ca8f1dc1e9b6822611e",
90-
strip_prefix = "abseil-cpp-6f43f5bb398b6685575b36874e36cf1695734df1",
91-
urls = ["https://github.com/abseil/abseil-cpp/archive/6f43f5bb398b6685575b36874e36cf1695734df1.tar.gz"],
89+
sha256 = "9b7a064305e9fd94d124ffa6cc358592eb42b5da588fb4e07d09254aa40086db",
90+
strip_prefix = "abseil-cpp-20250512.1",
91+
urls = ["https://github.com/abseil/abseil-cpp/releases/download/20250512.1/abseil-cpp-20250512.1.tar.gz"],
9292
)
9393

9494
def hedron_compile_commands():

bazel/spdlog.BUILD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,5 @@ cc_library(
1010
defines = ["SPDLOG_FMT_EXTERNAL"],
1111
includes = ["include"],
1212
visibility = ["//visibility:public"],
13-
deps = ["@com_github_fmtlib_fmt//:fmtlib"],
13+
deps = ["@com_github_fmtlib_fmt//:fmt"],
1414
)

cpp2sky/BUILD

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
load("@rules_cc//cc:defs.bzl", "cc_library", "cc_proto_library")
1+
load("@com_google_protobuf//bazel:cc_proto_library.bzl", "cc_proto_library")
2+
load("@rules_cc//cc:defs.bzl", "cc_library")
23
load("@rules_proto//proto:defs.bzl", "proto_library")
34

45
licenses(["notice"]) # Apache 2

0 commit comments

Comments
 (0)