Skip to content
Draft
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
6 changes: 3 additions & 3 deletions bazel/build.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ making behavior changes across the entire build.

load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load(":internal.bzl", "antithesis_deps", "redpanda_copts")
load(":internal.bzl", "antithesis_deps", "redpanda_copts", "redpanda_implicit_deps")

# buildifier: disable=function-docstring-args
def redpanda_cc_library(
Expand Down Expand Up @@ -35,7 +35,7 @@ def redpanda_cc_library(
local_defines = local_defines,
visibility = visibility,
include_prefix = include_prefix,
implementation_deps = implementation_deps,
implementation_deps = implementation_deps + redpanda_implicit_deps(),
deps = deps,
copts = redpanda_copts() + copts,
tags = tags,
Expand Down Expand Up @@ -64,7 +64,7 @@ def redpanda_cc_binary(
defines = defines,
local_defines = local_defines,
visibility = visibility,
deps = deps + antithesis_deps(),
deps = deps + antithesis_deps() + redpanda_implicit_deps(),
testonly = testonly,
copts = redpanda_copts() + copts,
linkopts = linkopts,
Expand Down
9 changes: 9 additions & 0 deletions bazel/internal.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,18 @@ def redpanda_copts():
copts.append("-Wextra")
copts.append("-Wno-missing-field-initializers")
copts.append("-Wimplicit-fallthrough")
copts.append("-include")
copts.append("base/ptree_ban.h")

return copts

def redpanda_implicit_deps():
"""
Deps that must be present on every redpanda C++ target so that
the headers force-included via redpanda_copts() are visible.
"""
return ["//src/v/base:ptree_ban"]

def antithesis_deps():
"""Conditional deps for Antithesis coverage instrumentation."""
return select({
Expand Down
12 changes: 6 additions & 6 deletions bazel/test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ load("@rules_cc//cc:cc_binary.bzl", "cc_binary")
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("@rules_cc//cc:cc_test.bzl", "cc_test")
load("@rules_python//python:defs.bzl", "py_binary", "py_test")
load(":internal.bzl", "antithesis_deps", "redpanda_copts")
load(":internal.bzl", "antithesis_deps", "redpanda_copts", "redpanda_implicit_deps")

def _reactor_args():
"""Returns additional reactor args for all reactor-using tests and benchmarks."""
Expand Down Expand Up @@ -164,7 +164,7 @@ def _redpanda_cc_test(
timeout = timeout,
srcs = srcs,
defines = defines,
deps = deps + test_deps,
deps = deps + test_deps + redpanda_implicit_deps(),
copts = redpanda_copts(),
args = args,
features = [
Expand Down Expand Up @@ -206,7 +206,7 @@ def _redpanda_cc_fuzz_test(
timeout = timeout,
srcs = srcs,
defines = defines,
deps = deps + test_deps,
deps = deps + test_deps + redpanda_implicit_deps(),
copts = redpanda_copts(),
args = custom_args,
features = [
Expand Down Expand Up @@ -354,7 +354,7 @@ def redpanda_cc_btest_no_seastar(
"//src/v/test_utils:boost_result_redirect",
"//src/v/test_utils:boost_test_hooks",
"@boost//:test.so",
] + deps + test_deps,
] + deps + test_deps + redpanda_implicit_deps(),
data = test_data,
env = test_env,
)
Expand All @@ -377,7 +377,7 @@ def redpanda_test_cc_library(
local_defines = local_defines,
visibility = visibility,
include_prefix = native.package_name().removeprefix("src/v/"),
implementation_deps = implementation_deps,
implementation_deps = implementation_deps + redpanda_implicit_deps(),
deps = deps,
copts = redpanda_copts(),
testonly = True,
Expand Down Expand Up @@ -472,7 +472,7 @@ def redpanda_cc_bench(
name = binary_name,
srcs = srcs,
defines = defines,
deps = deps + test_deps,
deps = deps + test_deps + redpanda_implicit_deps(),
testonly = True,
copts = redpanda_copts(),
features = [
Expand Down
8 changes: 8 additions & 0 deletions src/v/base/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
load("@rules_cc//cc:cc_library.bzl", "cc_library")
load("//bazel:build.bzl", "redpanda_cc_library")

cc_library(
name = "ptree_ban",
hdrs = ["ptree_ban.h"],
include_prefix = "base",
visibility = ["//visibility:public"],
)

redpanda_cc_library(
name = "base",
srcs = [
Expand Down
44 changes: 44 additions & 0 deletions src/v/base/ptree_ban.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* Copyright 2026 Redpanda Data, Inc.
*
* Use of this software is governed by the Business Source License
* included in the file licenses/BSL.md
*
* As of the Change Date specified in that file, in accordance with
* the Business Source License, use of this software will be governed
* by the Apache License, Version 2.0
*/

#pragma once

#include <string>

namespace seastar {
template<typename char_type, typename Size, Size max_size, bool NulTerminate>
class basic_sstring;
} // namespace seastar

namespace boost::property_tree {

template<typename Internal, typename External>
struct translator_between;

template<
typename Ch,
typename Traits,
typename Alloc,
typename CharT,
typename Size,
Size MaxSize,
bool NulTerminate>
struct translator_between<
std::basic_string<Ch, Traits, Alloc>,
::seastar::basic_sstring<CharT, Size, MaxSize, NulTerminate>> {
static_assert(
false,
"boost::property_tree::ptree::get<seastar::sstring> silently returns "
"the default for non-empty trees because seastar::sstring lacks a "
"stream extractor. Use std::string and convert at the call site.");
};

} // namespace boost::property_tree
Loading