Skip to content

Commit 15fd33c

Browse files
JesusPoderosomergify[bot]
authored andcommitted
Update types regeneration script homing path (#5093)
Signed-off-by: JesusPoderoso <[email protected]> (cherry picked from commit 47cb38c) # Conflicts: # utils/scripts/update_generated_code_from_idl.sh
1 parent 53e903a commit 15fd33c

File tree

1 file changed

+87
-0
lines changed

1 file changed

+87
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
#!/bin/bash
2+
3+
files_to_exclude=(
4+
'./include/fastrtps/types/*'
5+
)
6+
7+
files_needing_typeobject=(
8+
'./examples/cpp/dds/ContentFilteredTopicExample/HelloWorld.idl'
9+
'./test/unittest/dynamic_types/idl/Basic.idl'
10+
'./test/unittest/dynamic_types/idl/new_features_4_2.idl'
11+
'./test/unittest/dynamic_types/idl/Test.idl'
12+
'./test/unittest/xtypes/idl/Types.idl'
13+
'./test/unittest/xtypes/idl/WideEnum.idl'
14+
'./test/xtypes/idl/Types.idl'
15+
)
16+
17+
files_needing_case_sensitive=(
18+
'./test/unittest/dynamic_types/idl/new_features_4_2.idl'
19+
)
20+
21+
files_needing_output_dir=(
22+
'./include/fastdds/statistics/types.idl|../../../src/cpp/statistics/types'
23+
)
24+
25+
26+
yellow='\E[1;33m'
27+
textreset='\E[1;0m'
28+
29+
current_dir=$(git rev-parse --show-toplevel)
30+
31+
if [[ ! "$(pwd -P)" -ef "$current_dir" ]]; then
32+
echo -e "${red}This script must be executed in the repository root directory.${textreset}"
33+
exit -1
34+
fi
35+
36+
if [[ -z "$(which fastddsgen)" ]]; then
37+
echo "Cannot find fastddsgen. Please, include it in PATH environment variable"
38+
exit -1
39+
fi
40+
41+
readarray -d '' idl_files < <(find . -iname \*.idl -print0)
42+
43+
for del in ${files_to_exclude[@]}
44+
do
45+
idl_files=("${idl_files[@]/$del}")
46+
done
47+
48+
idl_files=(${idl_files[@]/$files_to_exclude})
49+
50+
ret_value=0
51+
52+
for idl_file in "${idl_files[@]}"; do
53+
idl_dir=$(dirname "$idl_file")
54+
file_from_gen=$(basename "$idl_file")
55+
56+
echo -e "Processing ${yellow}$idl_file${textreset}"
57+
58+
cd "${idl_dir}"
59+
60+
# Detect if needs type_object.
61+
[[ ${files_needing_typeobject[*]} =~ $idl_file ]] && to_arg='-typeobject' || to_arg=''
62+
63+
# Detect if needs case sensitive.
64+
[[ ${files_needing_case_sensitive[*]} =~ $idl_file ]] && cs_arg='-cs' || cs_arg=''
65+
66+
# Detect if needs output directory.
67+
od_arg=""
68+
for od_entry in ${files_needing_output_dir[@]}; do
69+
if [[ $od_entry = $idl_file\|* ]]; then
70+
od_entry_split=(${od_entry//\|/ })
71+
od_arg="-d ${od_entry_split[1]}"
72+
break
73+
fi
74+
done
75+
76+
fastddsgen -replace $to_arg $cs_arg $od_arg "$file_from_gen"
77+
78+
if [[ $? != 0 ]]; then
79+
ret_value=-1
80+
fi
81+
82+
cd -
83+
done
84+
85+
cd utils/scripts
86+
87+
exit $ret_value

0 commit comments

Comments
 (0)