Skip to main content

Extension for colcon to support cargo packages.

Project description

colcon-cargo

CI

An extension for colcon-core to support Rust projects built with Cargo.

Install

$ pip3 install --user --upgrade git+https://github.com/colcon/colcon-cargo.git

Usage / Minimal example

Build a sample workspace
$ 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

Verify that cargo detects the Rust packages:

$ colcon list

hello-world     hello-world     (cargo)
hello-world2    hello-world2    (cargo)

Build them with Cargo:

$ 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:

$ source install/setup.bash
$ hello-world

Hello, world!

$ hello-world2

Hello, world!

Testing

Test the packages with cargo:

$ 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:

$ 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

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-cargo-0.1.3.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

colcon_cargo-0.1.3-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file colcon-cargo-0.1.3.tar.gz.

File metadata

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

File hashes

Hashes for colcon-cargo-0.1.3.tar.gz
Algorithm Hash digest
SHA256 157a7736ca39365bc1a8f0362afd37981351f1fc1010b6c3314fa6aa6c534967
MD5 8912d3a3be97556c5c03092a20b89fbe
BLAKE2b-256 b22a3a7d5e40e87f6b25cba32bacd7f63c619542245ab1e64021658bb0ea7d2c

See more details on using hashes here.

File details

Details for the file colcon_cargo-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: colcon_cargo-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.12

File hashes

Hashes for colcon_cargo-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 68767bec254846e0f1a145a0de78455de58be56c15ab892d23de6e1d00160f36
MD5 51ba7d736a272abf449c893a0f5592b0
BLAKE2b-256 7bcca72eb9b202be63feb374dedfd082e8092f975b5491b910139e697feac224

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