Skip to content
Merged
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
3 changes: 2 additions & 1 deletion .bazeliskrc
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
USE_BAZEL_VERSION=6.5.0
USE_BAZEL_VERSION=7.7.0

3 changes: 3 additions & 0 deletions .bazelrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Disable Bazel modules (for now).
common --enable_bzlmod=false

# Specific Bazel build/test options.
build:macos --cxxopt='-std=c++17' --host_cxxopt='-std=c++17'

Expand Down
6 changes: 5 additions & 1 deletion WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@ workspace(name = "com_github_3rdparty_stout")

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

repos(external = False)
repos()

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

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

Expand Down
26 changes: 4 additions & 22 deletions bazel/deps.bzl
Original file line number Diff line number Diff line change
@@ -1,34 +1,16 @@
"""Dependency specific initialization for stout."""

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

def deps(repo_mapping = {}):
"""Propagate all dependencies.

Args:
repo_mapping (str): {}.
"""
def deps():
"""Propagate all dependencies."""
boost_deps()

picojson_deps(
repo_mapping = repo_mapping,
)

rapidjson_deps(
repo_mapping = repo_mapping,
)
picojson_deps()

# Needed because protobuf_deps brings rules_python 0.26.0 which is broken:
# https://github.com/bazelbuild/rules_python/issues/1543
http_archive(
name = "rules_python",
sha256 = "5868e73107a8e85d8f323806e60cad7283f34b32163ea6ff1020cf27abef6036",
strip_prefix = "rules_python-0.25.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.25.0/rules_python-0.25.0.tar.gz",
)
rapidjson_deps()

protobuf_deps()
57 changes: 22 additions & 35 deletions bazel/repos.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -15,21 +15,28 @@ load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("//3rdparty/bazel-rules-picojson:repos.bzl", picojson_repos = "repos")
load("//3rdparty/bazel-rules-rapidjson:repos.bzl", rapidjson_repos = "repos")

def repos(external = True, repo_mapping = {}):
"""Adds repositories/archives needed by stout
def repos():
"""Adds repositories/archives needed by stout."""
picojson_repos()

Args:
external: whether or not we're invoking this function as though
though we're an external dependency
repo_mapping: passed through to all other functions that expect/use
repo_mapping, e.g., 'git_repository'
"""
picojson_repos(
repo_mapping = repo_mapping,
rapidjson_repos()

maybe(
http_archive,
name = "rules_python",
sha256 = "4f7e2aa1eb9aa722d96498f5ef514f426c1f55161c3c9ae628c857a7128ceb07",
strip_prefix = "rules_python-1.0.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/1.0.0/rules_python-1.0.0.tar.gz",
)

rapidjson_repos(
repo_mapping = repo_mapping,
maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "955ef3235be41120db4d367be81efe6891c9544b3a71194d80c3055865b26e09",
strip_prefix = "protobuf-29.5",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v29.5.tar.gz",
],
)

maybe(
Expand Down Expand Up @@ -75,20 +82,9 @@ def repos(external = True, repo_mapping = {}):
maybe(
http_archive,
name = "com_github_google_glog",
url = "https://github.com/google/glog/archive/refs/tags/v0.5.0.tar.gz",
sha256 = "eede71f28371bf39aa69b45de23b329d37214016e2055269b3b5e7cfd40b59f5",
strip_prefix = "glog-0.5.0",
)

maybe(
http_archive,
name = "com_google_protobuf",
sha256 = "008a11cc56f9b96679b4c285fd05f46d317d685be3ab524b2a310be0fbad987e",
strip_prefix = "protobuf-29.3",
urls = [
"https://github.com/protocolbuffers/protobuf/archive/v29.3.tar.gz",
],
repo_mapping = repo_mapping,
sha256 = "c17d85c03ad9630006ef32c7be7c65656aba2e7e2fbfc82226b7e680c771fc88",
strip_prefix = "glog-0.7.1",
urls = ["https://github.com/google/glog/archive/v0.7.1.zip"],
)

# Copied and then modified to use the latest 'commit' and 'shallow_since'
Expand Down Expand Up @@ -117,12 +113,3 @@ def repos(external = True, repo_mapping = {}):
"Move-Item -Path support/bazel/WORKSPACE.bazel -Destination WORKSPACE.bazel",
],
)

if external:
maybe(
git_repository,
name = "com_github_3rdparty_stout",
commit = "67e6b9b08f340e223b741130815d97cf20296c08",
remote = "https://github.com/3rdparty/stout",
shallow_since = "1637367065 -0800",
)
4 changes: 2 additions & 2 deletions include/stout/flags/flags.h
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ class ParserBuilder {
std::move(help),
[f = std::forward<F>(f)](google::protobuf::Message& message) {
return f(
*google::protobuf::DynamicCastToGenerated<Flags>(&message));
*google::protobuf::DynamicCastMessage<Flags>(&message));
});

return *this;
Expand Down Expand Up @@ -291,7 +291,7 @@ class ParserBuilder {
google::protobuf::Message& message) {
return f(
value,
*google::protobuf::DynamicCastToGenerated<T>(&message));
*google::protobuf::DynamicCastMessage<T>(&message));
};
return true;
} else {
Expand Down