From 1bdc2b0ffed1e16a1d22e96a3a9956365fb6f744 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Fri, 15 Jul 2022 15:31:40 -0700 Subject: [PATCH 1/4] test_utils: remove unused header Signed-off-by: Noah Watkins --- src/v/test_utils/http_imposter.cc | 1 - 1 file changed, 1 deletion(-) diff --git a/src/v/test_utils/http_imposter.cc b/src/v/test_utils/http_imposter.cc index fdb735dae710..2fd43c409797 100644 --- a/src/v/test_utils/http_imposter.cc +++ b/src/v/test_utils/http_imposter.cc @@ -10,7 +10,6 @@ #include "test_utils/http_imposter.h" -#include "config/node_config.h" #include "vlog.h" #include From 2ddc863bdebb1e33aee543da8d83a3949897301c Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Mon, 20 Jun 2022 13:20:22 -0700 Subject: [PATCH 2/4] config: fix -Wreorder-ctor warning Signed-off-by: Noah Watkins --- src/v/config/tests/config_store_test.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/v/config/tests/config_store_test.cc b/src/v/config/tests/config_store_test.cc index f933f972e5e7..5b101bd8dd2e 100644 --- a/src/v/config/tests/config_store_test.cc +++ b/src/v/config/tests/config_store_test.cc @@ -37,8 +37,8 @@ struct test_config : public config::config_store { config::property seconds; config::property> optional_seconds; config::property milliseconds; - config::property secret_string; config::property default_secret_string; + config::property secret_string; test_config() : optional_int( From 596ed9abe46b6d8f8eb67a90b3dc7de0c3fe458b Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sat, 14 May 2022 19:27:24 -0700 Subject: [PATCH 3/4] rpc: colocate service code generator with rpc Colocating the code generator with the rpc framework is logical, but also results in a smoother integration with Meson build system which is far more opinionated than cmake which doesn't care at all. Signed-off-by: Noah Watkins --- cmake/rpcgen.cmake | 2 +- tools/rpcgen.py => src/v/rpc/rpc_compiler.py | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename tools/rpcgen.py => src/v/rpc/rpc_compiler.py (100%) diff --git a/cmake/rpcgen.cmake b/cmake/rpcgen.cmake index ba219a50d0e1..9910cdaee6c1 100644 --- a/cmake/rpcgen.cmake +++ b/cmake/rpcgen.cmake @@ -3,7 +3,7 @@ function(rpcgen) set(multi_value_args INCLUDES LIBRARIES DEFINITIONS COMPILE_OPTIONS) cmake_parse_arguments(args "" "${one_value_args}" "${multi_value_args}" ${ARGN}) get_filename_component(out_dir ${args_OUT_FILE} DIRECTORY) - set(generator "${PROJECT_SOURCE_DIR}/tools/rpcgen.py") + set(generator "${PROJECT_SOURCE_DIR}/src/v/rpc/rpc_compiler.py") add_custom_command( DEPENDS ${args_IN_FILE} diff --git a/tools/rpcgen.py b/src/v/rpc/rpc_compiler.py similarity index 100% rename from tools/rpcgen.py rename to src/v/rpc/rpc_compiler.py From 1bf49d247e573292cc5bc0aa3d2d4b7e5bee3aa9 Mon Sep 17 00:00:00 2001 From: Noah Watkins Date: Sun, 15 May 2022 08:16:04 -0700 Subject: [PATCH 4/4] kafka: protocol code gen should take output paths This changes makes the code generator easier to integrate into Meson which wants to have far more control over output file paths than cmake. Signed-off-by: Noah Watkins --- src/v/kafka/protocol/CMakeLists.txt | 12 ++++++------ src/v/kafka/protocol/schemata/generator.py | 11 ++++++----- 2 files changed, 12 insertions(+), 11 deletions(-) mode change 100644 => 100755 src/v/kafka/protocol/schemata/generator.py diff --git a/src/v/kafka/protocol/CMakeLists.txt b/src/v/kafka/protocol/CMakeLists.txt index 0fc9abe4b514..4d9ff8fc61b9 100644 --- a/src/v/kafka/protocol/CMakeLists.txt +++ b/src/v/kafka/protocol/CMakeLists.txt @@ -7,14 +7,14 @@ foreach(schema ${schemata}) get_filename_component(msg_name ${schema} NAME_WE) set(schema_src ${CMAKE_CURRENT_SOURCE_DIR}/schemata/${schema}) set(msg_dir "${CMAKE_CURRENT_BINARY_DIR}/schemata") - set(msg_srcs - "${msg_dir}/${msg_name}.h" - "${msg_dir}/${msg_name}.cc") - list(APPEND message_srcs ${msg_srcs}) + set(msg_hdr "${msg_dir}/${msg_name}.h") + set(msg_src "${msg_dir}/${msg_name}.cc") + list(APPEND message_srcs ${msg_hdr}) + list(APPEND message_srcs ${msg_src}) add_custom_command( - OUTPUT ${msg_srcs} + OUTPUT ${msg_hdr} ${msg_src} COMMAND ${KAFKA_CODEGEN_VENV} ${message_gen} - ARGS ${msg_dir} ${schema_src} + ARGS ${schema_src} ${msg_hdr} ${msg_src} DEPENDS ${schema_src} ${message_gen} ${KAFKA_CODEGEN_VENV} COMMENT "Running kafka request codegen on ${schema_src}" VERBATIM) diff --git a/src/v/kafka/protocol/schemata/generator.py b/src/v/kafka/protocol/schemata/generator.py old mode 100644 new mode 100755 index 12481a57b75a..ce78c6379423 --- a/src/v/kafka/protocol/schemata/generator.py +++ b/src/v/kafka/protocol/schemata/generator.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 +# # Copyright 2020 Redpanda Data, Inc. # # Use of this software is governed by the Business Source License @@ -1501,11 +1503,10 @@ def parse_flexible_versions(flex_version): if __name__ == "__main__": - assert len(sys.argv) == 3 - outdir = pathlib.Path(sys.argv[1]) - schema_path = pathlib.Path(sys.argv[2]) - src = (outdir / schema_path.name).with_suffix(".cc") - hdr = (outdir / schema_path.name).with_suffix(".h") + assert len(sys.argv) == 4 + schema_path = pathlib.Path(sys.argv[1]) + hdr = pathlib.Path(sys.argv[2]) + src = pathlib.Path(sys.argv[3]) # remove comments from the json file. comments are a non-standard json # extension that is not supported by the python json parser.