title: CLI Command: genesys build
The genesys build command compiles your workspace using colcon, the standard build tool for ROS 2. It provides a convenient wrapper with helpful defaults and extra features.
title:Usage
genesys build [options]
title:Options
-
--packages <pkg1> <pkg2>...or-p <pkg1>...: Build only the specified packages. If omitted, all packages in the workspace are built. -
--persist: After a successful build, this flag will add a command to source your workspace'sinstall/setup.bashfile to your shell's startup script (e.g.,~/.bashrcor~/.zshrc).
title:How It Works
- Workspace Validation: The command first checks that you are in the root of a Genesys workspace by looking for the
src/directory. - Command Execution: It then constructs and runs the following
colconcommand:colcon build --symlink-install --cmake-clean-first--symlink-install: This is a crucial flag for rapid development. It creates symbolic links from theinstalldirectory to your source files instead of copying them. This means you can edit Python files and the changes will take effect immediately without needing to rungenesys buildagain. (Note: You still need to rebuild if you add new files, messages, or change entry points insetup.py).--cmake-clean-first: This helps avoid issues with cached variables when you make significant changes to yourCMakeLists.txtfiles, ensuring a cleaner and more reliable build.- If you use the
--packagesoption, it appends--packages-select <pkg1> <pkg2>to the command.
- Real-time Output: The output from the
colconcommand is streamed directly to your terminal in real-time, so you can monitor the build progress exactly as it happens. - Persistent Sourcing: If you use the
--persistflag, the tool will automatically perform the following action upon a successful build:- It identifies your shell (
bashorzsh). - It appends a line like
source /path/to/your/project/install/setup.bashto your~/.bashrcor~/.zshrcfile. - This is idempotent; it will not add the line if it already exists.
- This action makes your workspace's packages, nodes, and launch files automatically available in any new terminal you open.
- It identifies your shell (
title:Examples
title: Build the entire workspace This is the most common use case.
genesys build
title: Build specific packages Useful when you are working on a few packages in a large workspace.
genesys build --packages my_package_1 my_package_2
title: Build and persist the workspace overlay A "fire-and-forget" command for a new workspace. After this, you can open a new terminal and your workspace will be ready to use.
genesys build --persist