roslaunch_test_generator.sh 860 Bytes
Newer Older
Jon Azpiazu's avatar
Jon Azpiazu committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env bash

if [[ $(basename $(pwd)) != "src" ]] ; then
  echo This script must be run from the src folder
  exit
fi

for foo in $(find $(pwd) -name "package.xml") ; do
  package_name=$(basename $(realpath $(dirname $foo)))
  echo Entering package: $package_name
  cd $(realpath $(dirname $foo))
  if [[ -n $(grep -i "roslaunch_add_file_check" CMakeLists.txt) ]] ; then
    echo Package $package_name already has roslaunch_add_file_check - skipping
  else
    if [[ -n $(find . -type f -name "*.launch") ]] ; then
      echo Adding roslaunch_add_file_check to $package_name
cat <<EOT >> CMakeLists.txt

## WARNING: automatically generated code; can be (and probably is) very buggy
if(CATKIN_ENABLE_TESTING)
find_package(catkin REQUIRED COMPONENTS
roslaunch
)
roslaunch_add_file_check(
$(find . -type f -name "*.launch")
)
endif()
EOT
    fi
  fi
done