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

Allow modularized rust targets #445

Open
dmitrii-ubskii opened this issue Jun 2, 2023 · 1 comment
Open

Allow modularized rust targets #445

dmitrii-ubskii opened this issue Jun 2, 2023 · 1 comment

Comments

@dmitrii-ubskii
Copy link
Member

What we have

Currently, a rust_library / rust_binary target is structured essentially like a cargo project without a Cargo.toml.

What we want

If each module of the library is in its own designated bazel package, we can leverage Bazel to enforce the structure. In particular, Bazel bans cyclic dependencies, which will force one-directional coupling between the domain-level modules.

The assemble_crate rule will then generate a single root lib.rs, in which the top-level rust_librarys will be represented as modules, such that we can package and deploy the entire library as a single crate.

Potential pitfalls

  • Inconsistent imports between the "dev" and "deploy" versions of the crate: is it typedb_client::common, typedb_client_common, or crate::common? All can be valid at different points, and none is valid at all points.
@flyingsilverfin
Copy link
Member

After we allow this, besides moduralising our Rust projects, we should also modularise our Rust project tests, which currently generally all reside within one test target in order to re-use the common functionalities. Instead, we should have Rust test libraries that are used by different test targets.

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

No branches or pull requests

2 participants