# 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.
Raw data
{
"_id": null,
"home_page": "https://colcon.readthedocs.io",
"name": "colcon-ros-cargo",
"maintainer": "Nikolai Morin",
"docs_url": null,
"requires_python": null,
"maintainer_email": "nnmmgit@gmail.com",
"keywords": "colcon",
"author": "Nikolai Morin",
"author_email": "nnmmgit@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/48/a6/0c083c097d6d5e875fd8c8233303f33e16307e6e04dad38db238a2a51818/colcon_ros_cargo-0.2.0.tar.gz",
"platform": null,
"description": "# colcon-ros-cargo\nBuild cargo projects with colcon.\n\n\n## Usage\nPackages 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. \n\nSimply 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.\n\nExtra arguments to `cargo` can be passed via the `--cargo-args` option, e.g. `colcon build --cargo-args --release`.\n\nAfter building, run binaries with `ros2 run`.\n\n`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 \u2013 `cargo build`, `cargo clippy`, `cargo doc`, etc. When the dependency graph changes, rebuild with `colcon`.\n\n\n## Limitations\nThis is by far not a perfect build system.\n\nNotably, 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.\n\n`colcon test` is not yet supported.\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "Extension for colcon to support Ament Cargo packages.",
"version": "0.2.0",
"project_urls": {
"Changelog": "https://github.com/colcon/colcon-ros-cargo/milestones?state=closed",
"GitHub": "https://github.com/colcon/colcon-ros-cargo/",
"Homepage": "https://colcon.readthedocs.io"
},
"split_keywords": [
"colcon"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "d013ff61c421eb72c74e82d5c3c9927e96434479f2ce6bea086332966a017dcb",
"md5": "db95da1ddc21d8dccc91be06f5d7896c",
"sha256": "6faf41fcda00c328a7606fd91e0fdb47065a68c896743fed282b7eff866081ea"
},
"downloads": -1,
"filename": "colcon_ros_cargo-0.2.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "db95da1ddc21d8dccc91be06f5d7896c",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 8122,
"upload_time": "2024-11-28T13:59:08",
"upload_time_iso_8601": "2024-11-28T13:59:08.124218Z",
"url": "https://files.pythonhosted.org/packages/d0/13/ff61c421eb72c74e82d5c3c9927e96434479f2ce6bea086332966a017dcb/colcon_ros_cargo-0.2.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "48a60c083c097d6d5e875fd8c8233303f33e16307e6e04dad38db238a2a51818",
"md5": "faf518b9669d1efb494f89579811910d",
"sha256": "ef4b5a08c2513d2ab608fbcee5aaae76c73c44dd25d7de2f2db4f55195977d4f"
},
"downloads": -1,
"filename": "colcon_ros_cargo-0.2.0.tar.gz",
"has_sig": false,
"md5_digest": "faf518b9669d1efb494f89579811910d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 9824,
"upload_time": "2024-11-28T13:59:09",
"upload_time_iso_8601": "2024-11-28T13:59:09.393991Z",
"url": "https://files.pythonhosted.org/packages/48/a6/0c083c097d6d5e875fd8c8233303f33e16307e6e04dad38db238a2a51818/colcon_ros_cargo-0.2.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-11-28 13:59:09",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "colcon",
"github_project": "colcon-ros-cargo",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "colcon-ros-cargo"
}