Skip to content

Commit 2f944fb

Browse files
authored
Add install and loop options to build_locally.sh (#278)
1 parent 91622c0 commit 2f944fb

File tree

3 files changed

+55
-6
lines changed

3 files changed

+55
-6
lines changed

Makefile

+2
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,7 @@ multiversion: Makefile
1414
@echo "<html><head><meta http-equiv=\"refresh\" content=\"0; url=foxy/index.html\" /></head></html>" > build/html/index.html
1515

1616
.PHONY: help Makefile multiversion
17+
18+
# By default this is the 'html' build
1719
%: Makefile
1820
@$(BUILD) -M $@ "$(SOURCE)" "$(OUT)" $(OPTS)

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ Below are some links to help with the ports.
3737

3838
Follow the [MoveIt 2 Source Build](https://moveit.ros.org/install-moveit2/source/) instructions to setup a colcon workspace with moveit2 from source.
3939

40-
Cd into your moveit2 colcon workspace:
40+
Open a command line to your your moveit2 colcon workspace:
4141

4242
cd $COLCON_WS/src
4343

@@ -64,6 +64,11 @@ If you want to test the tutorials by generating the html pages locally on your m
6464

6565
The local website ``<LOCAL_PACKAGE_PATH>/build/html/index.html`` should automatically open in your web browser.
6666

67+
### Optional build_locally Settings
68+
69+
- *noinstall* skip the dependencies install step to speed up the script
70+
- *loop* automatically rebuild the html if a change is detected
71+
6772
## Contributing
6873

6974
We rely on the community to keep these tutorials up to date and bug free. If you find an issue with the tutorials please [open an issue on GitHub](https://github.com/ros-planning/moveit2_tutorials/issues/new) or open a PR with proposed changes.

build_locally.sh

+47-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,55 @@
1-
#!/bin/sh
1+
#!/bin/bash -eu
22

3-
# Install dependencies
4-
pip3 install --user --upgrade -r requirements.txt
3+
have_loop() {
4+
for arg in "$@"; do
5+
if [[ "${arg}" == "loop" ]]; then
6+
return 0
7+
fi
8+
done
9+
return 1
10+
}
511

6-
# Setup Environment
12+
have_noinstall() {
13+
for arg in "$@"; do
14+
if [[ "${arg}" == "noinstall" ]]; then
15+
return 0
16+
fi
17+
done
18+
return 1
19+
}
20+
21+
if [[ "$0" != "${BASH_SOURCE}" ]]; then
22+
{
23+
echo "This file is meant to be executed, not 'source'd:"
24+
echo
25+
echo " ./${BASH_SOURCE}"
26+
} >&2
27+
return 1
28+
fi
29+
30+
################################################################################
31+
# Begin Main Script
32+
################################################################################
33+
34+
# Install dependencies, unless argument says to skip
35+
if ! have_noinstall "$@"; then
36+
pip3 install --user --upgrade -r requirements.txt
37+
fi
38+
39+
# A fresh build is required because changes to some components such as css files does not rebuilt currently
40+
# See issue https://github.com/sphinx-doc/sphinx/issues/2090
741
rm -rf build
842

943
# Build
1044
make html
1145

1246
# Run
13-
xdg-open ./build/html/index.html
47+
xdg-open ./build/html/index.html &
48+
49+
# Optional build loop
50+
if have_loop "$@"; then
51+
while inotifywait -re modify,move,create,delete .; do
52+
rm -rf build
53+
make html
54+
done
55+
fi

0 commit comments

Comments
 (0)