forked from ros-navigation/navigation2
-
Notifications
You must be signed in to change notification settings - Fork 1
/
buildall.sh
executable file
·154 lines (140 loc) · 3 KB
/
buildall.sh
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
#!/bin/bash
set -e
ROS2_WS=ros2_ws
NAV2_DEPS=navstack_dependencies_ws
TB_WS=turtlebot3_ws
NAV2_WS=navigation2_ws
BINARY_WS=/tmp/ros2-linux
ROS2_BINARY_URL=https://ci.ros2.org/view/packaging/job/packaging_linux/lastSuccessfulBuild/artifact/ws/ros2-package-linux-x86_64.tar.bz2
ROS2_BUILD_TYPE=Release
NAV2_DEPS_BUILD_TYPE=Release
TB_BUILD_TYPE=Release
NAV2_BUILD_TYPE=Debug
BINARY=False
clean_workspace() {
local CWD=`pwd`
cd $1
echo cleaning $1
rm -rf build install log
cd $CWD
}
build_workspace() {
local CWD=`pwd`
cd $1
echo building $1
colcon build --symlink-install --merge-install --packages-skip ros1_bridge --cmake-args -DCMAKE_BUILD_TYPE=$2
cd $CWD
}
source_workspace() {
source $1/install/setup.bash
}
update_ros2_ws() {
local CWD=`pwd`
cd $ROS2_WS
rm -rf src
rm -f ros2.repos
mkdir src
if [ "$ROS2_REPOS" == "" ]; then
wget https://raw.githubusercontent.com/ros2/ros2/master/ros2.repos
#wget https://raw.githubusercontent.com/ros2/ros2/release-latest/ros2.repos
vcs import src < ros2.repos
vcs export src --exact > ~/ros2versions/`date +%F-%H-%M-%S`.repos
else
vcs import src < $ROS2_REPOS
fi
cd $CWD
}
update_ros2_binary() {
local CWD=`pwd`
rm -rf $BINARY_WS
cd /tmp
wget -O - $ROS2_BINARY_URL | tar jxvf -
cd $CWD
}
update_nav2_dependencies() {
local CWD=`pwd`
cd $NAV2_DEPS
rm -rf src
mkdir src
vcs import src < ../$NAV2_WS/navigation2/tools/ros2_dependencies.repos
cd $CWD
}
update_tb3() {
local CWD=`pwd`
cd $TB_WS
vcs pull
cd $CWD
}
update_tb3_repos() {
local CWD=`pwd`
cd $TB_WS
rm -rf src
rm turtlebot3.repos
mkdir src
wget https://raw.githubusercontent.com/ROBOTIS-GIT/turtlebot3/ros2/turtlebot3.repos
vi turtlebot3.repos
vcs import src < turtlebot3.repos
cd $CWD
}
for opt in "$@" ; do
case "$opt" in
clean)
clean_workspace $ROS2_WS
clean_workspace $NAV2_DEPS
clean_workspace $TB_WS
clean_workspace $NAV2_WS
;;
release)
ROS2_BUILD_TYPE=Release
NAV2_DEPS_BUILD_TYPE=Release
TB_BUILD_TYPE=Release
NAV2_BUILD_TYPE=Release
;;
debug)
ROS2_BUILD_TYPE=Debug
NAV2_DEPS_BUILD_TYPE=Debug
TB_BUILD_TYPE=Release
NAV2_BUILD_TYPE=Debug
;;
update)
update_ros2_ws
exit 0
;;
updatebinary)
update_ros2_binary
exit 0
;;
updatedeps)
update_nav2_dependencies
exit 0
;;
updatetb3)
update_tb3
exit 0
;;
updatetb3repos)
update_tb3_repos
exit 0
;;
binary)
ROS2_WS=$BINARY_WS
BINARY=True
;;
*)
echo "Invalid parameter $opt"
exit 1
;;
esac
done
if [ "$BINARY" == "True" ]; then
source $ROS2_WS/setup.bash
else
build_workspace $ROS2_WS $ROS2_BUILD_TYPE
source_workspace $ROS2_WS
fi
build_workspace $NAV2_DEPS $NAV2_DEPS_BUILD_TYPE
source_workspace $NAV2_DEPS
build_workspace $NAV2_WS $NAV2_BUILD_TYPE
source_workspace $NAV2_WS
build_workspace $TB_WS $TB_BUILD_TYPE
source_workspace $TB_WS