diff --git a/.bazeliskrc b/.bazeliskrc index 89b6466..a77e0c8 100644 --- a/.bazeliskrc +++ b/.bazeliskrc @@ -1 +1,2 @@ -USE_BAZEL_VERSION=6.5.0 +USE_BAZEL_VERSION=7.7.0 + diff --git a/.bazelrc b/.bazelrc index b19922f..8ff7832 100644 --- a/.bazelrc +++ b/.bazelrc @@ -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' diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel index bdabe67..a95cdc1 100644 --- a/WORKSPACE.bazel +++ b/WORKSPACE.bazel @@ -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") diff --git a/bazel/deps.bzl b/bazel/deps.bzl index 8502806..fb9e29a 100644 --- a/bazel/deps.bzl +++ b/bazel/deps.bzl @@ -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() diff --git a/bazel/repos.bzl b/bazel/repos.bzl index d21e564..62126e6 100644 --- a/bazel/repos.bzl +++ b/bazel/repos.bzl @@ -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( @@ -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' @@ -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", - ) diff --git a/include/stout/flags/flags.h b/include/stout/flags/flags.h index 6ebab99..565453d 100644 --- a/include/stout/flags/flags.h +++ b/include/stout/flags/flags.h @@ -218,7 +218,7 @@ class ParserBuilder { std::move(help), [f = std::forward(f)](google::protobuf::Message& message) { return f( - *google::protobuf::DynamicCastToGenerated(&message)); + *google::protobuf::DynamicCastMessage(&message)); }); return *this; @@ -291,7 +291,7 @@ class ParserBuilder { google::protobuf::Message& message) { return f( value, - *google::protobuf::DynamicCastToGenerated(&message)); + *google::protobuf::DynamicCastMessage(&message)); }; return true; } else {