Skip to main content

Extension for colcon to support Ament Cargo packages.

Project description

colcon-ros-cargo

Build cargo projects with colcon.

Usage

Packages need to have a package.xml in addition to Cargo.toml. You should see such packages classified as ament_cargo in the output of colcon list. If they are classified as ros.ament_cargo instead, the colcon-ros-cargo extension has not been found by colcon. Make sure that you have built and loaded (source install/setup.bash) the extension.

Simply list dependencies (other ament_cargo packages or message packages) in Cargo.toml and package.xml as if they were hosted on crates.io. colcon-ros-cargo will find the dependencies and create a .cargo/config.toml file that helps cargo find these packages.

Extra arguments to cargo can be passed via the --cargo-args option, e.g. colcon build --cargo-args --release.

After building, run binaries with ros2 run.

colcon-ros-cargo also aims to support using cargo directly as the primary build tool. Just build with colcon once, to make sure all non-Cargo dependencies are built and the .cargo/config.toml file exists, and then using cargo will just work – cargo build, cargo clippy, cargo doc, etc. When the dependency graph changes, rebuild with colcon.

Limitations

This is by far not a perfect build system.

Notably, there is quadratic build cost as a function of the dependency chain length. To illustrate this, assume there are packages A, B and C, where C depends on B and B depends on A. If colcon builds this workspace, it builds A first, then B, then C. However, Cargo will also build all the dependencies, i.e., to build B, Cargo will build A again, and to build C, it will build A and B again.

colcon test is not yet supported.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

colcon-ros-cargo-0.1.0.tar.gz (9.3 kB view details)

Uploaded Source

Built Distribution

colcon_ros_cargo-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file colcon-ros-cargo-0.1.0.tar.gz.

File metadata

  • Download URL: colcon-ros-cargo-0.1.0.tar.gz
  • Upload date:
  • Size: 9.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for colcon-ros-cargo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 83036f315c86fab6d714d3d438415a96b604f822cdae1c91413e0b6fe45f861c
MD5 15e7821c54dfa0dd89e28e2e1993f48d
BLAKE2b-256 39f282028e94712d00dacf1532169ec4f8b7c765cb220bb6f13728bc55d4ed3c

See more details on using hashes here.

File details

Details for the file colcon_ros_cargo-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for colcon_ros_cargo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e93f6553f01b342ff6a4754cbb2a18d84fde2716e74a6327c8433e30fb61a6b2
MD5 7a2812a09481e3c27c723280606fa630
BLAKE2b-256 d0d33829184d5b78c0bce992eaa4da11b2696f064a88787744b57e9c2eacc7e0

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page