From 692d484fcbd775d8c8dcca8262c6cae155484778 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 5 Dec 2024 15:15:21 +0100 Subject: [PATCH 1/3] grpc: add grpc-grammar.ym as a dependency for module grammars in autotools To trigger rebuild, if it changes. Signed-off-by: Attila Szakacs --- modules/grpc/bigquery/Makefile.am | 2 ++ modules/grpc/clickhouse/Makefile.am | 2 ++ modules/grpc/loki/Makefile.am | 2 ++ modules/grpc/otel/Makefile.am | 2 ++ modules/grpc/pubsub/Makefile.am | 2 ++ 5 files changed, 10 insertions(+) diff --git a/modules/grpc/bigquery/Makefile.am b/modules/grpc/bigquery/Makefile.am index 731efe799..be15547c6 100644 --- a/modules/grpc/bigquery/Makefile.am +++ b/modules/grpc/bigquery/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/bigquery modules/grpc/bigquery/ mod-bigquery: endif +modules/grpc/bigquery/bigquery-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/bigquery/bigquery-grammar.y \ modules/grpc/bigquery/bigquery-grammar.c \ diff --git a/modules/grpc/clickhouse/Makefile.am b/modules/grpc/clickhouse/Makefile.am index 90a403e10..f3fa66de8 100644 --- a/modules/grpc/clickhouse/Makefile.am +++ b/modules/grpc/clickhouse/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/clickhouse modules/grpc/clickhouse/ mod-clickhouse: endif +modules/grpc/clickhouse/clickhouse-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/clickhouse/clickhouse-grammar.y \ modules/grpc/clickhouse/clickhouse-grammar.c \ diff --git a/modules/grpc/loki/Makefile.am b/modules/grpc/loki/Makefile.am index c374797e7..c6ccdba84 100644 --- a/modules/grpc/loki/Makefile.am +++ b/modules/grpc/loki/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/loki modules/grpc/loki/ mod-loki: endif +modules/grpc/loki/loki-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/loki/loki-grammar.y \ modules/grpc/loki/loki-grammar.c \ diff --git a/modules/grpc/otel/Makefile.am b/modules/grpc/otel/Makefile.am index acc1298ca..9259de406 100644 --- a/modules/grpc/otel/Makefile.am +++ b/modules/grpc/otel/Makefile.am @@ -79,6 +79,8 @@ else modules/grpc/otel modules/grpc/otel/ mod-otel: endif +modules/grpc/otel/otel-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/otel/otel-grammar.y \ modules/grpc/otel/otel-grammar.c \ diff --git a/modules/grpc/pubsub/Makefile.am b/modules/grpc/pubsub/Makefile.am index bded8bcd6..3854cd9a2 100644 --- a/modules/grpc/pubsub/Makefile.am +++ b/modules/grpc/pubsub/Makefile.am @@ -59,6 +59,8 @@ else modules/grpc/pubsub modules/grpc/pubsub/ mod-pubsub: endif +modules/grpc/pubsub/pubsub-grammar.y: modules/grpc/common/grpc-grammar.ym + BUILT_SOURCES += \ modules/grpc/pubsub/pubsub-grammar.y \ modules/grpc/pubsub/pubsub-grammar.c \ From d31ea5bedd3761a73df0920f0520f8d87a2260ad Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 5 Dec 2024 15:53:48 +0100 Subject: [PATCH 2/3] cmake/add_module: add GRAMMAR_DEPENDS argument Signed-off-by: Attila Szakacs --- cmake/Modules/GenerateYFromYm.cmake | 10 ++++++++-- cmake/add_module.cmake | 4 ++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/cmake/Modules/GenerateYFromYm.cmake b/cmake/Modules/GenerateYFromYm.cmake index 1b8b65e4a..5f2625bc2 100644 --- a/cmake/Modules/GenerateYFromYm.cmake +++ b/cmake/Modules/GenerateYFromYm.cmake @@ -41,10 +41,16 @@ endfunction() # This function is used by add_module function(module_generate_y_from_ym FileWoExtSrc FileWoExtDst) - if (${ARGC} EQUAL 2) + if (${ARGC} EQUAL 2 OR ${ARGC} EQUAL 3) + set(DEPS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y) + + if (${ARGC} EQUAL 3) + set(DEPS ${DEPS} ${ARGV2}) + endif() + add_custom_command (OUTPUT ${FileWoExtDst}.y COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/lib/merge-grammar.py ${FileWoExtSrc}.ym > ${FileWoExtDst}.y - DEPENDS ${PROJECT_SOURCE_DIR}/lib/cfg-grammar.y + DEPENDS ${DEPS} ${FileWoExtSrc}.ym) else() message(SEND_ERROR "Wrong usage of module_generate_y_from_ym() function") diff --git a/cmake/add_module.cmake b/cmake/add_module.cmake index 63e464dc3..062ab523d 100644 --- a/cmake/add_module.cmake +++ b/cmake/add_module.cmake @@ -26,10 +26,10 @@ include(CMakeParseArguments) function (add_module) - cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) + cmake_parse_arguments(ADD_MODULE "" "TARGET" "GRAMMAR;GRAMMAR_DEPENDS;SOURCES;DEPENDS;INCLUDES;LIBRARY_TYPE;COMPILE_OPTIONS" ${ARGN}) if (ADD_MODULE_GRAMMAR) - module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}) + module_generate_y_from_ym(${CMAKE_CURRENT_SOURCE_DIR}/${ADD_MODULE_GRAMMAR} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR} ${ADD_MODULE_GRAMMAR_DEPENDS}) bison_target(${ADD_MODULE_TARGET}Grammar} ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.y ${CMAKE_CURRENT_BINARY_DIR}/${ADD_MODULE_GRAMMAR}.c From a95b3f82f5da0ba9baf872bf5ba4b7aa9e65e756 Mon Sep 17 00:00:00 2001 From: Attila Szakacs Date: Thu, 5 Dec 2024 15:54:13 +0100 Subject: [PATCH 3/3] grpc: add common grammar dependency for cmake Signed-off-by: Attila Szakacs --- modules/grpc/bigquery/CMakeLists.txt | 1 + modules/grpc/clickhouse/CMakeLists.txt | 1 + modules/grpc/common/CMakeLists.txt | 2 ++ modules/grpc/loki/CMakeLists.txt | 1 + modules/grpc/otel/CMakeLists.txt | 1 + modules/grpc/pubsub/CMakeLists.txt | 1 + 6 files changed, 7 insertions(+) diff --git a/modules/grpc/bigquery/CMakeLists.txt b/modules/grpc/bigquery/CMakeLists.txt index 0b2a84afe..3b8f3136a 100644 --- a/modules/grpc/bigquery/CMakeLists.txt +++ b/modules/grpc/bigquery/CMakeLists.txt @@ -28,6 +28,7 @@ add_module( add_module( TARGET bigquery GRAMMAR bigquery-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS bigquery-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${BIGQUERY_SOURCES} diff --git a/modules/grpc/clickhouse/CMakeLists.txt b/modules/grpc/clickhouse/CMakeLists.txt index 663291ab0..7551c442d 100644 --- a/modules/grpc/clickhouse/CMakeLists.txt +++ b/modules/grpc/clickhouse/CMakeLists.txt @@ -28,6 +28,7 @@ add_module( add_module( TARGET clickhouse GRAMMAR clickhouse-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS clickhouse-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${CLICKHOUSE_SOURCES} diff --git a/modules/grpc/common/CMakeLists.txt b/modules/grpc/common/CMakeLists.txt index 4f041c14a..ddaefbb4d 100644 --- a/modules/grpc/common/CMakeLists.txt +++ b/modules/grpc/common/CMakeLists.txt @@ -18,6 +18,8 @@ set(GRPC_COMMON_CPP_SOURCES grpc-source-worker.hpp grpc-source-worker.cpp) +set(GRPC_COMMON_GRAMMAR ${PROJECT_SOURCE_DIR}/modules/grpc/common/grpc-grammar.ym PARENT_SCOPE) + add_module( TARGET grpc-common-cpp SOURCES ${GRPC_COMMON_CPP_SOURCES} diff --git a/modules/grpc/loki/CMakeLists.txt b/modules/grpc/loki/CMakeLists.txt index d31d3c84f..0251fe195 100644 --- a/modules/grpc/loki/CMakeLists.txt +++ b/modules/grpc/loki/CMakeLists.txt @@ -29,6 +29,7 @@ add_module( add_module( TARGET loki GRAMMAR loki-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS loki-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${LOKI_SOURCES} diff --git a/modules/grpc/otel/CMakeLists.txt b/modules/grpc/otel/CMakeLists.txt index d6d49a5e1..c70667c17 100644 --- a/modules/grpc/otel/CMakeLists.txt +++ b/modules/grpc/otel/CMakeLists.txt @@ -44,6 +44,7 @@ add_module( add_module( TARGET otel GRAMMAR otel-grammar + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} DEPENDS otel-cpp grpc-common-cpp INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${OTEL_SOURCES} diff --git a/modules/grpc/pubsub/CMakeLists.txt b/modules/grpc/pubsub/CMakeLists.txt index 2287409b4..6971c7901 100644 --- a/modules/grpc/pubsub/CMakeLists.txt +++ b/modules/grpc/pubsub/CMakeLists.txt @@ -29,6 +29,7 @@ add_module( TARGET pubsub GRAMMAR pubsub-grammar DEPENDS pubsub-cpp grpc-common-cpp + GRAMMAR_DEPENDS ${GRPC_COMMON_GRAMMAR} INCLUDES ${PROJECT_SOURCE_DIR}/modules/grpc SOURCES ${PUBSUB_SOURCES} )