-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathbuild_simulation.sh
executable file
·386 lines (342 loc) · 14.3 KB
/
build_simulation.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
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
#!/bin/bash
#
# Copyright (c) Contributors to the Open 3D Engine Project.
# For complete copyright and license terms please see the LICENSE at the root of this distribution.
#
# SPDX-License-Identifier: Apache-2.0 OR MIT
#
# Validate the ROCSON_DEMO_LEVEL value before starting the longer git processes
if [ "$ROCSON_DEMO_LEVEL" == 'level1' ]
then
DEMO_LEVEL=demolevel1
elif [ "$ROCSON_DEMO_LEVEL" == 'level2' ]
then
DEMO_LEVEL=demolevel2
else
echo "Invalid 'level' argument '$ROCSON_DEMO_LEVEL'. Must be level1 or level2."
exit 1
fi
# Initialize ROS
. /opt/ros/${ROS_DISTRO}/setup.sh
###############################################################
# Clone and bootstrap O3DE
###############################################################
echo "Cloning o3de"
git clone --single-branch -b $O3DE_BRANCH $O3DE_REPO $O3DE_ROOT && \
git -C $O3DE_ROOT lfs install && \
git -C $O3DE_ROOT lfs pull && \
git -C $O3DE_ROOT reset --hard $O3DE_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning o3de from $O3DE_REPO"
exit 1
fi
$WORKSPACE/o3de/python/get_python.sh && \
$WORKSPACE/o3de/scripts/o3de.sh register -ep $O3DE_ROOT
if [ $? -ne 0 ]
then
echo "Error bootstrapping O3DE from $O3DE_REPO"
exit 1
fi
###############################################################
# Clone and register o3de-extras
###############################################################
echo "Cloning o3de-extras"
git clone --single-branch -b $O3DE_EXTRAS_BRANCH $O3DE_EXTRAS_REPO $O3DE_EXTRAS_ROOT && \
git -C $O3DE_EXTRAS_ROOT lfs install && \
git -C $O3DE_EXTRAS_ROOT lfs pull && \
git -C $O3DE_EXTRAS_ROOT reset --hard $O3DE_EXTRAS_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning o3de-extras from $O3DE_EXTRAS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -gp $O3DE_EXTRAS_ROOT/Gems/ROS2 && \
$WORKSPACE/o3de/scripts/o3de.sh register -gp $O3DE_EXTRAS_ROOT/Gems/ProteusRobot && \
$WORKSPACE/o3de/scripts/o3de.sh register -gp $O3DE_EXTRAS_ROOT/Gems/WarehouseAssets && \
$WORKSPACE/o3de/scripts/o3de.sh register -gp $O3DE_EXTRAS_ROOT/Gems/WarehouseAutomation
if [ $? -ne 0 ]
then
echo "Error registering o3de-extras gems"
exit 1
fi
###############################################################
# Clone and register the ROSCon2023Demo Human Worker Gem
###############################################################
echo "Cloning the ROSCon2023 Demo Human Worker Gem"
git clone --single-branch -b $ROSCON_DEMO_HUMAN_WORKER_BRANCH $ROSCON_DEMO_HUMAN_WORKER_REPO $ROSCON_DEMO_HUMAN_WORKER_ROOT && \
git -C $ROSCON_DEMO_HUMAN_WORKER_ROOT lfs install && \
git -C $ROSCON_DEMO_HUMAN_WORKER_ROOT lfs pull && \
git -C $ROSCON_DEMO_HUMAN_WORKER_ROOT reset --hard $ROSCON_DEMO_HUMAN_WORKER_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning ROSCon2023 Demo Human Worker Gem from $ROSCON_DEMO_HUMAN_WORKER_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -gp $ROSCON_DEMO_HUMAN_WORKER_ROOT
if [ $? -ne 0 ]
then
echo "Error registering the ROSCon2023 Demo Human Worker Gem"
exit 1
fi
###############################################################
# Clone and register the ROSCon2023Demo UR10 and UR20 Robots Gem
###############################################################
echo "Cloning ROSCon2023 UR10 and UR20 Robots Gem"
git clone --single-branch -b $ROSCON_DEMO_UR_ROBOTS_BRANCH $ROSCON_DEMO_UR_ROBOTS_REPO $ROSCON_DEMO_UR_ROBOTS_ROOT && \
git -C $ROSCON_DEMO_UR_ROBOTS_ROOT lfs install && \
git -C $ROSCON_DEMO_UR_ROBOTS_ROOT lfs pull && \
git -C $ROSCON_DEMO_UR_ROBOTS_ROOT reset --hard $ROSCON_DEMO_UR_ROBOTS_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning ROSCon2023 UR10 and UR20 Robots Gem from $ROSCON_DEMO_UR_ROBOTS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -gp $ROSCON_DEMO_UR_ROBOTS_ROOT
if [ $? -ne 0 ]
then
echo "Error registering the ROSCon2023 UR10 and UR20 Robots Gem"
exit 1
fi
#######################################################################
# Clone and register the ROSCon2023 OTTO 600 and OTTO 1500 Robots Gem
#######################################################################
echo "Cloning ROSCon2023 OTTO 600 and OTTO 1500 Robots Gem"
git clone --single-branch -b $ROSCON_DEMO_OTTO_ROBOTS_BRANCH $ROSCON_DEMO_OTTO_ROBOTS_REPO $ROSCON_DEMO_OTTO_ROBOTS_ROOT && \
git -C $ROSCON_DEMO_OTTO_ROBOTS_ROOT lfs install && \
git -C $ROSCON_DEMO_OTTO_ROBOTS_ROOT lfs pull && \
git -C $ROSCON_DEMO_OTTO_ROBOTS_ROOT reset --hard $ROSCON_DEMO_OTTO_ROBOTS_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning ROSCon2023 OTTO 600 and OTTO 1500 Robots Gem from $ROSCON_DEMO_OTTO_ROBOTS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -gp $ROSCON_DEMO_OTTO_ROBOTS_ROOT
if [ $? -ne 0 ]
then
echo "Error registering the ROSCon2023 OTTO 600 and OTTO 1500 Robots Gem"
exit 1
fi
#######################################################################
# Clone and register assets only gems
#######################################################################
echo "Cloning Warehouse and Generic Assets Gems"
git clone --single-branch $ROSCON_DEMO_WAREHOUSE_ASSETS_REPO $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT && \
git -C $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT lfs install && \
git -C $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT lfs pull
if [ $? -ne 0 ]
then
echo "Error cloning Warehouse Assets Gems from $ROSCON_DEMO_WAREHOUSE_ASSETS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -agp $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT
if [ $? -ne 0 ]
then
echo "Error registering the Warehouse Assets Gems"
exit 1
fi
git clone --single-branch $ROSCON_DEMO_GENERIC_ASSETS_REPO $ROSCON_DEMO_GENERIC_ASSETS_ROOT && \
git -C $ROSCON_DEMO_GENERIC_ASSETS_ROOT lfs install && \
git -C $ROSCON_DEMO_GENERIC_ASSETS_ROOT lfs pull
if [ $? -ne 0 ]
then
echo "Error cloning Generic Assets Gems from $ROSCON_DEMO_GENERIC_ASSETS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -agp $ROSCON_DEMO_GENERIC_ASSETS_ROOT
if [ $? -ne 0 ]
then
echo "Error registering the Generic Assets Gems"
exit 1
fi
#######################################################################
# Clone and register additional tooling Gems
#######################################################################
echo "Cloning the additional tooling Gems"
git clone --single-branch -b $ROSCON_DEMO_ROBOTEC_GEMS_BRANCH $ROSCON_DEMO_ROBOTEC_GEMS_REPO $ROSCON_DEMO_ROBOTEC_GEMS_ROOT && \
git -C $ROSCON_DEMO_ROBOTEC_GEMS_ROOT lfs install && \
git -C $ROSCON_DEMO_ROBOTEC_GEMS_ROOT lfs pull && \
git -C $ROSCON_DEMO_ROBOTEC_GEMS_ROOT reset --hard $ROSCON_DEMO_ROBOTEC_GEMS_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning the additional tooling Gems from $ROSCON_DEMO_ROBOTEC_GEMS_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -gp $ROSCON_DEMO_ROBOTEC_GEMS_ROOT/Gems/ROS2ScriptIntegration
if [ $? -ne 0 ]
then
echo "Error registering the additional tooling Gems"
exit 1
fi
###############################################################
# Clone and register the ROSCon2023Demo
###############################################################
echo "Cloning the RosCon2023Demo project"
git clone --single-branch -b $ROSCON_DEMO_BRANCH $ROSCON_DEMO_REPO $ROSCON_DEMO_ROOT && \
git -C $ROSCON_DEMO_ROOT lfs install && \
git -C $ROSCON_DEMO_ROOT lfs pull && \
git -C $ROSCON_DEMO_ROOT reset --hard $ROSCON_DEMO_COMMIT
if [ $? -ne 0 ]
then
echo "Error cloning RosCon2023Demo project $ROSCON_DEMO_REPO"
exit 1
fi
$WORKSPACE/o3de/scripts/o3de.sh register -pp $ROSCON_DEMO_PROJECT
if [ $? -ne 0 ]
then
echo "Error registering the RosCon2023Demo Project"
exit 1
fi
###############################################################################
# Track the git commits from all the repos
###############################################################################
echo -e "\n\
Repository | Commit | Branch\n\
----------------------------------+-----------------------------------------\n\
o3de | $(git -C $O3DE_ROOT rev-parse --short HEAD) | $(git -C $O3DE_ROOT rev-parse --abbrev-ref HEAD) \n\
o3de-extras | $(git -C $O3DE_EXTRAS_ROOT rev-parse --short HEAD) | $(git -C $O3DE_EXTRAS_ROOT rev-parse --abbrev-ref HEAD) \n\
ROSCon2023 Demo Human Worker Gem | $(git -C $ROSCON_DEMO_HUMAN_WORKER_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_HUMAN_WORKER_ROOT rev-parse --abbrev-ref HEAD) \n\
ROSCon2023 UR Robots Gem | $(git -C $ROSCON_DEMO_UR_ROBOTS_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_UR_ROBOTS_ROOT rev-parse --abbrev-ref HEAD) \n\
ROSCon2023 OTTO Robots Gem | $(git -C $ROSCON_DEMO_OTTO_ROBOTS_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_OTTO_ROBOTS_ROOT rev-parse --abbrev-ref HEAD) \n\
Warehouse Assets Gems | $(git -C $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_WAREHOUSE_ASSETS_ROOT rev-parse --abbrev-ref HEAD) \n\
Generic Assets Gems | $(git -C $ROSCON_DEMO_GENERIC_ASSETS_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_GENERIC_ASSETS_ROOT rev-parse --abbrev-ref HEAD) \n\
ROS2ScriptIntegration Gem | $(git -C $ROSCON_DEMO_ROBOTEC_GEMS_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_ROBOTEC_GEMS_ROOT rev-parse --abbrev-ref HEAD) \n\
RosCon2023Demo Project | $(git -C $ROSCON_DEMO_ROOT rev-parse --short HEAD) | $(git -C $ROSCON_DEMO_ROOT rev-parse --abbrev-ref HEAD) \n\
\n\
" >> $WORKSPACE/git_commit.txt
###############################################################
# Set the filename of the level in the registry file
###############################################################
sed -i "s/demolevel1/${DEMO_LEVEL}/g" Registry/load_level.setreg
###############################################################
# Build and install the additional ROS 2 packages and drivers
###############################################################
pushd $ROSCON_DEMO_ROOT/ros2_ws && \
./setup_submodules.bash && \
rosdep update && \
rosdep install --ignore-src --from-paths src/Universal_Robots_ROS2_Driver -y && \
colcon build --symlink-install && \
. ./install/setup.sh && \
popd
if [ $? -ne 0 ]
then
echo "Error building and installing additional ROS 2 packages and drivers"
exit 1
fi
###############################################################
# Build O3DE tools for asset processing and asset bundling
###############################################################
cmake -B $ROSCON_DEMO_PROJECT/build/tools \
-S $ROSCON_DEMO_PROJECT \
-G "Ninja Multi-Config" \
-DLY_DISABLE_TEST_MODULES=ON \
-DLY_STRIP_DEBUG_SYMBOLS=ON
if [ $? -ne 0 ]
then
echo "Error generating O3DE tools projects"
exit 1
fi
cmake --build $ROSCON_DEMO_PROJECT/build/tools \
--config profile \
--target AssetProcessorBatch AssetBundlerBatch
if [ $? -ne 0 ]
then
echo "Error building the O3DE tools projects"
exit 1
fi
###############################################################
# Build the assets for ROSCon2023Demo
###############################################################
pushd $ROSCON_DEMO_PROJECT/build/tools/bin/profile
# Initial run to process the assets
./AssetProcessorBatch
# Secondary run to re-process ones that missed dependencies
./AssetProcessorBatch
popd
###############################################################\
# Bundle the assets for ROSCon2023Demo
###############################################################\
mkdir -p $ROSCON_DEMO_PROJECT/build/bundles
mkdir -p $ROSCON_SIMULATION_HOME/Cache/linux
# Generate the asset lists file for the game
pushd $ROSCON_DEMO_PROJECT/build/tools/bin/profile
echo "Creating the game assetList ..."
./AssetBundlerBatch assetLists \
--assetListFile $ROSCON_DEMO_PROJECT/build/bundles/game_linux.assetList \
--platform linux \
--project-path $ROSCON_DEMO_PROJECT \
--addSeed levels/$DEMO_LEVEL/$DEMO_LEVEL.spawnable \
--allowOverwrites
if [ $? -ne 0 ]
then
echo "Error generating asset list from levels/$DEMO_LEVEL/$DEMO_LEVEL.spawnable"
exit 1
fi
echo "Creating the engine assetList ..."
./AssetBundlerBatch assetLists \
--assetListFile $ROSCON_DEMO_PROJECT/build/bundles/engine_linux.assetList \
--platform linux \
--project-path $ROSCON_DEMO_PROJECT \
--addDefaultSeedListFiles \
--allowOverwrites
if [ $? -ne 0 ]
then
echo "Error generating default engine asset list"
exit 1
fi
echo "Creating the game asset bundle (pak) ..."
./AssetBundlerBatch bundles \
--maxSize 2048 \
--platform linux \
--project-path $ROSCON_DEMO_PROJECT \
--allowOverwrites \
--assetListFile $ROSCON_DEMO_PROJECT/build/bundles/game_linux.assetList \
--outputBundlePath $ROSCON_SIMULATION_HOME/Cache/linux/game_linux.pak
if [ $? -ne 0 ]
then
echo "Error bundling generating game pak"
exit 1
fi
echo "Creating the engine asset bundle (pak) ..."
./AssetBundlerBatch bundles \
--maxSize 2048 \
--platform linux \
--project-path $ROSCON_DEMO_PROJECT \
--allowOverwrites \
--assetListFile $ROSCON_DEMO_PROJECT/build/bundles/engine_linux.assetList \
--outputBundlePath $ROSCON_SIMULATION_HOME/Cache/linux/engine_linux.pak
if [ $? -ne 0 ]
then
echo "Error bundling generating game pak"
exit 1
fi
# Build the game launcher monolithically
echo "Building launcher"
cmake -B $ROSCON_DEMO_PROJECT/build/game \
-S $ROSCON_DEMO_PROJECT \
-G "Ninja Multi-Config" \
-DLY_DISABLE_TEST_MODULES=ON \
-DLY_STRIP_DEBUG_SYMBOLS=ON \
-DLY_MONOLITHIC_GAME=ON \
-DALLOW_SETTINGS_REGISTRY_DEVELOPMENT_OVERRIDES=0 \
&& cmake --build $ROSCON_DEMO_PROJECT/build/game \
--config profile \
--target ./ROSCon2023Demo.GameLauncher
if [ $? -ne 0 ]
then
echo "Error bundling simulation launcher"
exit 1
fi
# Package the binaries to the simulation folder
cp $ROSCON_DEMO_PROJECT/build/game/bin/profile/ROSCon2023Demo.GameLauncher $ROSCON_SIMULATION_HOME/
cp $ROSCON_DEMO_PROJECT/build/game/bin/profile/*.json $ROSCON_SIMULATION_HOME/
cp $ROSCON_DEMO_PROJECT/build/game/bin/profile/*.so $ROSCON_SIMULATION_HOME
# Cleanup
rm -rf $O3DE_ROOT
rm -rf $O3DE_EXTRAS_ROOT
rm -rf $ROSCON_DEMO_HUMAN_WORKER_ROOT
rm -rf $ROSCON_DEMO_UR_ROBOTS_ROOT
rm -rf $ROSCON_DEMO_OTTO_ROBOTS_ROOT
rm -rf $ROSCON_DEMO_PROJECT
rm -rf /root/.o3de
exit 0