Skip to content

Commit d63e4aa

Browse files
committed
Upgrade to Bazel 7.6.1
* Upgrade to protobuf 29.5 * Upgrade to glog 0.7.1 * Upgrade to rules_python 1.0.0. It's not entirely clear to me why we need to load rules_python ourselves (stout doesn't actually use it), but it seems that protobuf requires that we do so. Modern rules_python versions also require calling `py_repositories()`. * Fix deprecated code warning due to protobuf upgrade * Remove `repo_mapping` and `external` cruft in Bazel files
1 parent 3729c51 commit d63e4aa

File tree

6 files changed

+37
-61
lines changed

6 files changed

+37
-61
lines changed

.bazeliskrc

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

.bazelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
# Disable Bazel modules (for now).
2+
common --enable_bzlmod=false
3+
14
# Specific Bazel build/test options.
25
build:macos --cxxopt='-std=c++17' --host_cxxopt='-std=c++17'
36

WORKSPACE.bazel

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@ workspace(name = "com_github_3rdparty_stout")
22

33
load("//bazel:repos.bzl", "repos")
44

5-
repos(external = False)
5+
repos()
6+
7+
load("@rules_python//python:repositories.bzl", "py_repositories")
8+
9+
py_repositories()
610

711
load("//bazel:deps.bzl", "deps")
812

bazel/deps.bzl

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,16 @@
11
"""Dependency specific initialization for stout."""
22

3-
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
43
load("@com_github_3rdparty_bazel_rules_picojson//bazel:deps.bzl", picojson_deps = "deps")
54
load("@com_github_3rdparty_bazel_rules_rapidjson//bazel:deps.bzl", rapidjson_deps = "deps")
65
load("@com_github_nelhage_rules_boost//:boost/boost.bzl", "boost_deps")
76
load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")
87

9-
def deps(repo_mapping = {}):
10-
"""Propagate all dependencies.
11-
12-
Args:
13-
repo_mapping (str): {}.
14-
"""
8+
def deps():
9+
"""Propagate all dependencies."""
1510
boost_deps()
1611

17-
picojson_deps(
18-
repo_mapping = repo_mapping,
19-
)
20-
21-
rapidjson_deps(
22-
repo_mapping = repo_mapping,
23-
)
12+
picojson_deps()
2413

25-
# Needed because protobuf_deps brings rules_python 0.26.0 which is broken:
26-
# https://github.com/bazelbuild/rules_python/issues/1543
27-
http_archive(
28-
name = "rules_python",
29-
sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
30-
strip_prefix = "rules_python-0.25.0",
31-
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
32-
)
14+
rapidjson_deps()
3315

3416
protobuf_deps()

bazel/repos.bzl

Lines changed: 22 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,28 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
1515
load("//3rdparty/bazel-rules-picojson:repos.bzl", picojson_repos = "repos")
1616
load("//3rdparty/bazel-rules-rapidjson:repos.bzl", rapidjson_repos = "repos")
1717

18-
def repos(external = True, repo_mapping = {}):
19-
"""Adds repositories/archives needed by stout
18+
def repos():
19+
"""Adds repositories/archives needed by stout."""
20+
picojson_repos()
2021

21-
Args:
22-
external: whether or not we're invoking this function as though
23-
though we're an external dependency
24-
repo_mapping: passed through to all other functions that expect/use
25-
repo_mapping, e.g., 'git_repository'
26-
"""
27-
picojson_repos(
28-
repo_mapping = repo_mapping,
22+
rapidjson_repos()
23+
24+
maybe(
25+
http_archive,
26+
name = "rules_python",
27+
sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
28+
strip_prefix = "rules_python-1.0.0",
29+
url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
2930
)
3031

31-
rapidjson_repos(
32-
repo_mapping = repo_mapping,
32+
maybe(
33+
http_archive,
34+
name = "com_google_protobuf",
35+
sha256 = "955ef3235be41120db4d367be81efe6891c9544b3a71194d80c3055865b26e09",
36+
strip_prefix = "protobuf-29.5",
37+
urls = [
38+
"https://github.com/protocolbuffers/protobuf/archive/v29.5.tar.gz",
39+
],
3340
)
3441

3542
maybe(
@@ -75,20 +82,9 @@ def repos(external = True, repo_mapping = {}):
7582
maybe(
7683
http_archive,
7784
name = "com_github_google_glog",
78-
url = "https://github.com/google/glog/archive/refs/tags/v0.5.0.tar.gz",
79-
sha256 = "eede71f28371bf39aa69b45de23b329d37214016e2055269b3b5e7cfd40b59f5",
80-
strip_prefix = "glog-0.5.0",
81-
)
82-
83-
maybe(
84-
http_archive,
85-
name = "com_google_protobuf",
86-
sha256 = "008a11cc56f9b96679b4c285fd05f46d317d685be3ab524b2a310be0fbad987e",
87-
strip_prefix = "protobuf-29.3",
88-
urls = [
89-
"https://github.com/protocolbuffers/protobuf/archive/v29.3.tar.gz",
90-
],
91-
repo_mapping = repo_mapping,
85+
sha256 = "c17d85c03ad9630006ef32c7be7c65656aba2e7e2fbfc82226b7e680c771fc88",
86+
strip_prefix = "glog-0.7.1",
87+
urls = ["https://github.com/google/glog/archive/v0.7.1.zip"],
9288
)
9389

9490
# Copied and then modified to use the latest 'commit' and 'shallow_since'
@@ -117,12 +113,3 @@ def repos(external = True, repo_mapping = {}):
117113
"Move-Item -Path support/bazel/WORKSPACE.bazel -Destination WORKSPACE.bazel",
118114
],
119115
)
120-
121-
if external:
122-
maybe(
123-
git_repository,
124-
name = "com_github_3rdparty_stout",
125-
commit = "67e6b9b08f340e223b741130815d97cf20296c08",
126-
remote = "https://github.com/3rdparty/stout",
127-
shallow_since = "1637367065 -0800",
128-
)

include/stout/flags/flags.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ class ParserBuilder {
218218
std::move(help),
219219
[f = std::forward<F>(f)](google::protobuf::Message& message) {
220220
return f(
221-
*google::protobuf::DynamicCastToGenerated<Flags>(&message));
221+
*google::protobuf::DynamicCastMessage<Flags>(&message));
222222
});
223223

224224
return *this;
@@ -291,7 +291,7 @@ class ParserBuilder {
291291
google::protobuf::Message& message) {
292292
return f(
293293
value,
294-
*google::protobuf::DynamicCastToGenerated<T>(&message));
294+
*google::protobuf::DynamicCastMessage<T>(&message));
295295
};
296296
return true;
297297
} else {

0 commit comments

Comments
 (0)