From bd8cebe7fab8dc1b3c6db3a4883485c05182219b Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Tue, 2 Apr 2024 15:42:14 +0200 Subject: [PATCH 1/3] Make test_communication use idl messages instead of msg ones. Signed-off-by: Miguel Company --- test_communication/CMakeLists.txt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/test_communication/CMakeLists.txt b/test_communication/CMakeLists.txt index 323ca522..265adf72 100644 --- a/test_communication/CMakeLists.txt +++ b/test_communication/CMakeLists.txt @@ -41,8 +41,8 @@ if(BUILD_TESTING) foreach(interface_file ${interface_files}) get_filename_component(interface_ns "${interface_file}" DIRECTORY) get_filename_component(interface_ns "${interface_ns}" NAME) - string_ends_with("${interface_file}" ".msg" is_message) - if(is_message AND interface_ns STREQUAL "msg") + string_ends_with("${interface_file}" ".idl" is_idl) + if(is_idl AND interface_ns STREQUAL "msg") list(APPEND message_files "${interface_file}") continue() endif() @@ -51,8 +51,7 @@ if(BUILD_TESTING) list(APPEND service_files "${interface_file}") continue() endif() - string_ends_with("${interface_file}" ".idl" is_action) - if(is_action AND interface_ns STREQUAL "action") + if(is_idl AND interface_ns STREQUAL "action") list(APPEND action_files "${interface_file}") continue() endif() From cebb135b3c88534ac8c478f1471dd79a21086634 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Thu, 26 Sep 2024 09:57:54 +0200 Subject: [PATCH 2/3] Only process idl interfaces Signed-off-by: Miguel Company --- test_communication/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test_communication/CMakeLists.txt b/test_communication/CMakeLists.txt index 265adf72..c291f395 100644 --- a/test_communication/CMakeLists.txt +++ b/test_communication/CMakeLists.txt @@ -41,17 +41,21 @@ if(BUILD_TESTING) foreach(interface_file ${interface_files}) get_filename_component(interface_ns "${interface_file}" DIRECTORY) get_filename_component(interface_ns "${interface_ns}" NAME) + # Only process IDL interfaces string_ends_with("${interface_file}" ".idl" is_idl) - if(is_idl AND interface_ns STREQUAL "msg") + if(NOT is_idl) + continue() + endif() + # Decide category based on interface_ns + if(interface_ns STREQUAL "msg") list(APPEND message_files "${interface_file}") continue() endif() - string_ends_with("${interface_file}" ".srv" is_service) - if(is_service AND interface_ns STREQUAL "srv") + if(interface_ns STREQUAL "srv") list(APPEND service_files "${interface_file}") continue() endif() - if(is_idl AND interface_ns STREQUAL "action") + if(interface_ns STREQUAL "action") list(APPEND action_files "${interface_file}") continue() endif() From 3542acb7883ce5761cb967d1bf836df2188e2579 Mon Sep 17 00:00:00 2001 From: Miguel Company Date: Thu, 26 Sep 2024 10:01:47 +0200 Subject: [PATCH 3/3] Additional refactor leveraging `elseif` Signed-off-by: Miguel Company --- test_communication/CMakeLists.txt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/test_communication/CMakeLists.txt b/test_communication/CMakeLists.txt index c291f395..e5230f4a 100644 --- a/test_communication/CMakeLists.txt +++ b/test_communication/CMakeLists.txt @@ -49,15 +49,10 @@ if(BUILD_TESTING) # Decide category based on interface_ns if(interface_ns STREQUAL "msg") list(APPEND message_files "${interface_file}") - continue() - endif() - if(interface_ns STREQUAL "srv") + elseif(interface_ns STREQUAL "srv") list(APPEND service_files "${interface_file}") - continue() - endif() - if(interface_ns STREQUAL "action") + elseif(interface_ns STREQUAL "action") list(APPEND action_files "${interface_file}") - continue() endif() endforeach()