From 5e6c2ddb0a79409c17cc99260c881fc6eaea7e21 Mon Sep 17 00:00:00 2001 From: EduPonz Date: Thu, 21 Mar 2024 16:22:48 +0100 Subject: [PATCH 1/3] Refs #20677: Add type support regeneration utility Signed-off-by: EduPonz --- .../scripts/update_generated_code_from_idl.sh | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100755 utils/scripts/update_generated_code_from_idl.sh diff --git a/utils/scripts/update_generated_code_from_idl.sh b/utils/scripts/update_generated_code_from_idl.sh new file mode 100755 index 00000000..37ea673a --- /dev/null +++ b/utils/scripts/update_generated_code_from_idl.sh @@ -0,0 +1,45 @@ +#!/usr/bin/env bash + +idl_files=( + './fastdds_python/test/types/test_modules.idl' + './fastdds_python/test/types/test_complete.idl' + './fastdds_python/test/types/test_included_modules.idl' + './fastdds_python_examples/HelloWorldExample/HelloWorld.idl' +) + +red='\E[1;31m' +yellow='\E[1;33m' +textreset='\E[1;0m' + +current_dir=$(git rev-parse --show-toplevel) + +if [[ ! "$(pwd -P)" -ef "${current_dir}" ]]; then + echo -e "${red}This script must be executed in the repository root directory.${textreset}" + exit -1 +fi + +if [[ -z "$(which fastddsgen)" ]]; then + echo "Cannot find fastddsgen. Please, include it in PATH environment variable" + exit -1 +fi + +ret_value=0 + +for idl_file in "${idl_files[@]}"; do + idl_dir=$(dirname "${idl_file}") + file_from_gen=$(basename "${idl_file}") + + echo -e "Processing ${yellow}${idl_file}${textreset}" + + cd "${idl_dir}" + + echo "fastddsgen -cdr both -replace -flat-output-dir -python ${file_from_gen}" + + if [[ $? != 0 ]]; then + ret_value=-1 + fi + + cd - +done + +exit ${ret_value} From 29ee3eda96076dc556e0e525260431f99c2eaf0c Mon Sep 17 00:00:00 2001 From: EduPonz Date: Thu, 21 Mar 2024 16:30:46 +0100 Subject: [PATCH 2/3] Refs #20677: Remove legacy script Signed-off-by: EduPonz --- fastdds_python/test/types/generate.sh | 7 ------- 1 file changed, 7 deletions(-) delete mode 100755 fastdds_python/test/types/generate.sh diff --git a/fastdds_python/test/types/generate.sh b/fastdds_python/test/types/generate.sh deleted file mode 100755 index cb231455..00000000 --- a/fastdds_python/test/types/generate.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash -if [[ -z "$(which fastddsgen)" ]]; then - echo "Cannot find fastddsgen. Please, include it in PATH environment variable" - exit -1 -fi - -fastddsgen -cdr both -python -replace test_complete.idl test_modules.idl From 81bc0e9d4d1bd85a2ede5846e8793a5607f38e31 Mon Sep 17 00:00:00 2001 From: EduPonz Date: Thu, 21 Mar 2024 18:50:08 +0100 Subject: [PATCH 3/3] Refs #20677: Apply suggestions Signed-off-by: EduPonz --- utils/scripts/update_generated_code_from_idl.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/utils/scripts/update_generated_code_from_idl.sh b/utils/scripts/update_generated_code_from_idl.sh index 37ea673a..9a7c5be4 100755 --- a/utils/scripts/update_generated_code_from_idl.sh +++ b/utils/scripts/update_generated_code_from_idl.sh @@ -33,7 +33,8 @@ for idl_file in "${idl_files[@]}"; do cd "${idl_dir}" - echo "fastddsgen -cdr both -replace -flat-output-dir -python ${file_from_gen}" + echo "Running: fastddsgen -cdr both -replace -flat-output-dir -python ${file_from_gen}" + fastddsgen -cdr both -replace -flat-output-dir -python ${file_from_gen} if [[ $? != 0 ]]; then ret_value=-1