-
Notifications
You must be signed in to change notification settings - Fork 961
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
fix: Remove circular dependencies across workspace #3023
Conversation
This comment was marked as resolved.
This comment was marked as resolved.
The fact that `libp2p-swarm-derive` is a separate crate is an implementation detail and only required because `cargo` needs to compile this crate separately. It semantically belongs to `libp2p-swarm` so this is where the tests should be.
This allows us to depend on the macro without depending on the entire `libp2p` crate which causes circular dependencies in our tests.
These create circular dependencies to the root libp2p crate in tests.
333eb04
to
7d74261
Compare
…2p-dev-dependency
That's interesting! Do you know how other projects which have a similar setup are performing builds? |
Sorry, that description is outdated as of the latest commits. Nope, I haven't looked at any other projects yet. |
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
The motivation for landing this is (among other things) to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good to me. Thanks especially for the developer experience improvement.
CI error should be fixed now, please merge whenever you are ready @mxinden! |
This pull request has merge conflicts. Could you please resolve them @thomaseizinger? 🙏 |
WebRTC failure seems to be consistent (i.e. non-flaky as assumed in #3223). @thomaseizinger can you take a look? |
Can confirm, it is not a flake. The new "swarmless" test doesn't work for WebRTC because it is not polling the |
…t-libp2p into 2173-no-libp2p-dev-dependency
Okay, test should pass now. The solution is a bit verbose. I think we should transition |
It's been a long journey but I am very happy that this is merged 🎉 |
Circular dependencies are problematic in several ways: - They result in cognitive overhead for developers, in trying to figure out what depends on what. - They present `cargo` with limits in what order the crates can be compiled in. - They invalidate build caches unnecessarily thus forcing `cargo` to rebuild certain crates. - They cause problems with tooling such as `release-please`. To actually break the circular dependencies, this patch inlines the uses of `development_transport` in the examples and tests for all sub-crates. This is only meant to be a short-term fix until libp2p#3111 and libp2p#2888 are fixed. To ensure we don't accidentally reintroduce this dependency, we add a basic CI that queries `cargo metadata` using `jq`. Resolves libp2p#3053. Fixes libp2p#3223. Related: libp2p#2918 (comment) Related: googleapis/release-please#1662
Description
Circular dependencies are problematic in several ways:
cargo
with limits in what order the crates can be compiled in.cargo
to rebuild certain crates.release-please
.To actually break the circular dependencies, this patch inlines the uses of
development_transport
in the examples and tests for all sub-crates. This is only meant to be a short-term fix until #3111 and #2888 are fixed.To ensure we don't accidentally reintroduce this dependency, we add a basic CI that queries
cargo metadata
usingjq
.Resolves #3053.
Fixes #3223.
Related: #2918 (comment)
Related: googleapis/release-please#1662
Links to any relevant issues
development_transport
in examples and tests #3056.prelude
configuration option toNetworkBehaviour
macro #3055.libp2p-mdns
to compile without feature-flags #3131Open Questions
Change checklist
I have added tests that prove my fix is effective or that my feature worksA changelog entry has been made in the appropriate crates