Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Considering refactoring to a "workspace" organization #183

Open
xrl opened this issue Mar 5, 2022 · 2 comments
Open

Considering refactoring to a "workspace" organization #183

xrl opened this issue Mar 5, 2022 · 2 comments

Comments

@xrl
Copy link

xrl commented Mar 5, 2022

RustDDS is current one BIG crate. This means that when projects rely on RustDDS they must build all the code in one big step. You can increase parallelism of cargo's build, potentially give library users more fine grain access to functionality, and the purpose of dependencies much more clear.

You would start by replacing the root Cargo.toml with a workspace definition. All the nested crates (I call them subcrates but I don't think that's a popular term) can continue to exist in this repo no problem.

How could you "chunk" up the RustDDS?

/
  Cargo.toml # the workspace one
  /rustdds-serialization/Cargo.toml
  /rustdds-messages/Cargo.toml
  /rustdds-network/Cargo.toml
  ... and so on ...

then in the root Cargo.toml:

[workspace]
default-members = [
	"rustdds-serialization",
        "rustdds-messages,
        "rustdds-network"
]

and rustdds-serialization/Cargo.toml:

[package]
name = "rustdds-serialization
version = "0.1.0"
authors = ["..."]
edition = "2021"

[dependencies]
# only the SPECIFIC dependencies for the serialization functionality

and cargo can roll up all the transitive dependencies of your subcrates and create a Cargo.lock at the root.

All my rust projects have transitioned to this style, it makes builds much faster and small crates have nice little test suites.

@jhelovuo
Copy link
Owner

jhelovuo commented Mar 6, 2022

That is a good suggestion.

However, before doing this, the RustDDS codebase needs to be reviewed and quite likely some code should be moved between current modules to make a more sensible module structure. Otherwise, the dependencies between subcrates could end up very convoluted.

@jhelovuo
Copy link
Owner

jhelovuo commented Mar 6, 2022

Wrote down some reorganization ideas in #184 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants