colcon的扩展,支持使用Cargo构建的Rust包。
项目描述
colcon-cargo
colcon-core的扩展,支持使用Cargo构建的Rust项目。
安装
$ pip3 install --user --upgrade git+https://github.com/colcon/colcon-cargo.git
使用/最小示例
构建一个示例工作空间
$ 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
验证cargo是否检测到Rust包
$ colcon list
hello-world hello-world (cargo)
hello-world2 hello-world2 (cargo)
使用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]
源生生成的install/
目录并执行
$ source install/setup.bash
$ hello-world
Hello, world!
$ hello-world2
Hello, world!
测试
使用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]
检查测试结果(cargo test
和cargo fmt --check
)。对于空模板,它们都应该成功
$ 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
项目详情
下载文件
下载适用于您平台上的文件。如果您不确定选择哪个,请了解有关安装包的更多信息。
源分发
colcon-cargo-0.1.3.tar.gz (15.3 kB 查看哈希值)
构建分发
colcon_cargo-0.1.3-py3-none-any.whl (14.3 kB 查看哈希值)