# colcon-cargo
[](https://github.com/colcon/colcon-cargo/actions/workflows/ci.yaml?query=branch%3Amain+event%3Apush)
An extension for [colcon-core](https://github.com/colcon/colcon-core) to
support Rust projects built with Cargo.
## Install
```sh
$ pip3 install --user --upgrade git+https://github.com/colcon/colcon-cargo.git
```
## Usage / Minimal example
<details>
<summary>Build a sample workspace</summary>
<br>
```sh
$ mkdir ws/
$ cd ws/
$ cargo init hello_world
$ cargo init hello_world2
$ tree .
.
├── hello-world
│ ├── Cargo.toml
│ └── src
│ └── main.rs
└── hello-world2
├── Cargo.toml
└── src
└── main.rs
4 directories, 4 files
```
</details>
Verify that cargo detects the Rust packages:
```sh
$ colcon list
hello-world hello-world (cargo)
hello-world2 hello-world2 (cargo)
```
Build them with Cargo:
```sh
$ colcon build
Starting >>> hello_world
Starting >>> hello_world_2
Finished <<< hello_world_2 [1.84s]
Finished <<< hello_world [1.94s]
Summary: 2 packages finished [2.34s]
```
Source the generated `install/` directory and execute:
```sh
$ source install/setup.bash
$ hello-world
Hello, world!
$ hello-world2
Hello, world!
```
### Testing
Test the packages with cargo:
```sh
$ colcon test
Starting >>> hello_world_2
Starting >>> hello_world
Finished <<< hello_world [0.24s]
Finished <<< hello_world_2 [0.25s]
Summary: 2 packages finished [0.39s]
```
Inspect the test results (`cargo test` and `cargo fmt --check`).
They should all succeed for the empty templates:
```sh
$ colcon test-result --all
build/hello_world_2/cargo_test.xml: 2 tests, 0 errors, 0 failures, 0 skipped
build/hello_world/cargo_test.xml: 2 tests, 0 errors, 0 failures, 0 skipped
Summary: 4 tests, 0 errors, 0 failures, 0 skipped
```
Raw data
{
"_id": null,
"home_page": null,
"name": "colcon-cargo",
"maintainer": "Easymov Robotics",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "dev@easymov.fr",
"keywords": "colcon",
"author": "G\u00e9rald Lelong",
"author_email": "gerald.lelong@easymov.fr",
"download_url": "https://files.pythonhosted.org/packages/b2/2a/3a7d5e40e87f6b25cba32bacd7f63c619542245ab1e64021658bb0ea7d2c/colcon-cargo-0.1.3.tar.gz",
"platform": null,
"description": "# colcon-cargo\n\n[](https://github.com/colcon/colcon-cargo/actions/workflows/ci.yaml?query=branch%3Amain+event%3Apush)\n\nAn extension for [colcon-core](https://github.com/colcon/colcon-core) to\nsupport Rust projects built with Cargo.\n\n## Install\n```sh\n$ pip3 install --user --upgrade git+https://github.com/colcon/colcon-cargo.git\n```\n\n## Usage / Minimal example\n\n<details>\n<summary>Build a sample workspace</summary>\n<br>\n\n```sh\n$ mkdir ws/\n$ cd ws/\n$ cargo init hello_world\n$ cargo init hello_world2\n$ tree .\n\n.\n\u251c\u2500\u2500 hello-world\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 Cargo.toml\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 src\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 main.rs\n\u2514\u2500\u2500 hello-world2\n \u251c\u2500\u2500 Cargo.toml\n \u2514\u2500\u2500 src\n \u2514\u2500\u2500 main.rs\n\n4 directories, 4 files\n\n```\n\n</details>\n\nVerify that cargo detects the Rust packages:\n\n```sh\n$ colcon list\n\nhello-world hello-world (cargo)\nhello-world2 hello-world2 (cargo)\n```\n\nBuild them with Cargo:\n\n```sh\n$ colcon build\n\nStarting >>> hello_world\nStarting >>> hello_world_2\nFinished <<< hello_world_2 [1.84s]\nFinished <<< hello_world [1.94s]\n\nSummary: 2 packages finished [2.34s]\n```\n\nSource the generated `install/` directory and execute:\n\n```sh\n$ source install/setup.bash\n$ hello-world\n\nHello, world!\n\n$ hello-world2\n\nHello, world!\n```\n\n### Testing\n\nTest the packages with cargo:\n\n```sh\n$ colcon test\nStarting >>> hello_world_2\nStarting >>> hello_world\nFinished <<< hello_world [0.24s] \nFinished <<< hello_world_2 [0.25s]\n\nSummary: 2 packages finished [0.39s]\n```\n\nInspect the test results (`cargo test` and `cargo fmt --check`).\nThey should all succeed for the empty templates:\n\n```sh\n$ colcon test-result --all\nbuild/hello_world_2/cargo_test.xml: 2 tests, 0 errors, 0 failures, 0 skipped\nbuild/hello_world/cargo_test.xml: 2 tests, 0 errors, 0 failures, 0 skipped\n\nSummary: 4 tests, 0 errors, 0 failures, 0 skipped\n```\n\n\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "Extension for colcon to support cargo packages.",
"version": "0.1.3",
"project_urls": null,
"split_keywords": [
"colcon"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "7bcca72eb9b202be63feb374dedfd082e8092f975b5491b910139e697feac224",
"md5": "51ba7d736a272abf449c893a0f5592b0",
"sha256": "68767bec254846e0f1a145a0de78455de58be56c15ab892d23de6e1d00160f36"
},
"downloads": -1,
"filename": "colcon_cargo-0.1.3-py3-none-any.whl",
"has_sig": false,
"md5_digest": "51ba7d736a272abf449c893a0f5592b0",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 14280,
"upload_time": "2024-08-27T06:28:14",
"upload_time_iso_8601": "2024-08-27T06:28:14.309586Z",
"url": "https://files.pythonhosted.org/packages/7b/cc/a72eb9b202be63feb374dedfd082e8092f975b5491b910139e697feac224/colcon_cargo-0.1.3-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b22a3a7d5e40e87f6b25cba32bacd7f63c619542245ab1e64021658bb0ea7d2c",
"md5": "8912d3a3be97556c5c03092a20b89fbe",
"sha256": "157a7736ca39365bc1a8f0362afd37981351f1fc1010b6c3314fa6aa6c534967"
},
"downloads": -1,
"filename": "colcon-cargo-0.1.3.tar.gz",
"has_sig": false,
"md5_digest": "8912d3a3be97556c5c03092a20b89fbe",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 15294,
"upload_time": "2024-08-27T06:28:16",
"upload_time_iso_8601": "2024-08-27T06:28:16.459255Z",
"url": "https://files.pythonhosted.org/packages/b2/2a/3a7d5e40e87f6b25cba32bacd7f63c619542245ab1e64021658bb0ea7d2c/colcon-cargo-0.1.3.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-27 06:28:16",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "colcon-cargo"
}