-
Notifications
You must be signed in to change notification settings - Fork 791
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Signed-off-by: JesusPoderoso <[email protected]> (cherry picked from commit 47cb38c) # Conflicts: # utils/scripts/update_generated_code_from_idl.sh Co-authored-by: Jesús Poderoso <[email protected]>
- Loading branch information
1 parent
4c460ef
commit a6db7de
Showing
1 changed file
with
87 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,87 @@ | ||
#!/bin/bash | ||
|
||
files_to_exclude=( | ||
'./include/fastrtps/types/*' | ||
) | ||
|
||
files_needing_typeobject=( | ||
'./examples/cpp/dds/ContentFilteredTopicExample/HelloWorld.idl' | ||
'./test/unittest/dynamic_types/idl/Basic.idl' | ||
'./test/unittest/dynamic_types/idl/new_features_4_2.idl' | ||
'./test/unittest/dynamic_types/idl/Test.idl' | ||
'./test/unittest/xtypes/idl/Types.idl' | ||
'./test/unittest/xtypes/idl/WideEnum.idl' | ||
'./test/xtypes/idl/Types.idl' | ||
) | ||
|
||
files_needing_case_sensitive=( | ||
'./test/unittest/dynamic_types/idl/new_features_4_2.idl' | ||
) | ||
|
||
files_needing_output_dir=( | ||
'./include/fastdds/statistics/types.idl|../../../src/cpp/statistics/types' | ||
) | ||
|
||
|
||
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 | ||
|
||
readarray -d '' idl_files < <(find . -iname \*.idl -print0) | ||
|
||
for del in ${files_to_exclude[@]} | ||
do | ||
idl_files=("${idl_files[@]/$del}") | ||
done | ||
|
||
idl_files=(${idl_files[@]/$files_to_exclude}) | ||
|
||
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}" | ||
|
||
# Detect if needs type_object. | ||
[[ ${files_needing_typeobject[*]} =~ $idl_file ]] && to_arg='-typeobject' || to_arg='' | ||
|
||
# Detect if needs case sensitive. | ||
[[ ${files_needing_case_sensitive[*]} =~ $idl_file ]] && cs_arg='-cs' || cs_arg='' | ||
|
||
# Detect if needs output directory. | ||
od_arg="" | ||
for od_entry in ${files_needing_output_dir[@]}; do | ||
if [[ $od_entry = $idl_file\|* ]]; then | ||
od_entry_split=(${od_entry//\|/ }) | ||
od_arg="-d ${od_entry_split[1]}" | ||
break | ||
fi | ||
done | ||
|
||
fastddsgen -replace $to_arg $cs_arg $od_arg "$file_from_gen" | ||
|
||
if [[ $? != 0 ]]; then | ||
ret_value=-1 | ||
fi | ||
|
||
cd - | ||
done | ||
|
||
cd utils/scripts | ||
|
||
exit $ret_value |