Skip to content

Optimize cargo dependency rebuilds/package discovery #29

@jdiez17

Description

@jdiez17

Hi, thanks for your work on the Rust for ROS2 ecosystem!

I'm running into the limitation described in the README:

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.

Have you considered setting up a Cargo workspace with all of the Rust packages, so that they can share a build directory, and then install them to the appropriate locations per ROS2 workspace layout?

This also makes it easy to refer to other crates in the workspace without having to add a [patch.crates-io]. You can see an example of this here: https://github.com/raccoon-os/rccn_userspace_ws/blob/master/Cargo.toml.

With this setup, I can run cargo build at the root of the repository and all of the packages are built with a shared build cache. They then just need to be installed to install/pkg/lib etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions