Exclude examples from tower-http dependencies and MSRV inspection
tottoto opened this issue · comments
Feature Request
Motivation
The motivation to exclude examples from tower-http
dependencies and MSRV inspection is to improve ci robustness and allow us to free from tower-http
's limitations such as MSRV in examples. As tower-http
is relatively lower layer library and it's real world examples tend to use a lot of crates as dependencies, treating their dependencies together impose extra limitations. I think these limitations might not be worthy for tower-http
.
Proposal
This proposal and the alternative's content are thanks to #372 (comment).
Declares default-members = ["tower-http"]
in the workspace manifest, and remove --workspace
from all the CI jobs.
Alternatives
Moves examples to its own workspace. But this is not a good idea as decreases development experience with rust-analyzer
.
This proposal seems not to work out as follows.
Declares default-menbers
at Cargo.toml
as
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,4 +1,5 @@
[workspace]
+default-members = ["tower-http"]
members = [
"tower-http",
"examples/*",
and disable env-filters
of tracing-subscriber
at tower-http/Cargo.toml
to remove duplicate regex-syntax
dependency detected by cargo-deny
.
--- a/tower-http/Cargo.toml
+++ b/tower-http/Cargo.toml
@@ -47,7 +47,7 @@ hyper = { version = "0.14", features = ["full"] }
once_cell = "1"
tokio = { version = "1", features = ["full"] }
tower = { version = "0.4.10", features = ["buffer", "util", "retry", "make", "timeout"] }
-tracing-subscriber = "0.3"
+tracing-subscriber = { version = "0.3", default_features = false, features = ["fmt"] }
uuid = { version = "1.0", features = ["v4"] }
serde_json = "1.0"
zstd = "0.11"
cargo-deny
still reports duplicate regex-syntax
as follows though it is not depended by tower-http
.
$ cargo deny --all-features --manifest-path ./tower-http/Cargo.toml check
error[duplicate]: found 2 duplicate entries for crate 'regex-syntax'
┌─ /home/test/tower-http/Cargo.lock:74:1
│
74 │ ╭ regex-syntax 0.6.29 registry+https://github.com/rust-lang/crates.io-index
75 │ │ regex-syntax 0.7.2 registry+https://github.com/rust-lang/crates.io-index
│ ╰────────────────────────────────────────────────────────────────────────^ lock entries
│
= regex-syntax v0.6.29
└── regex-automata v0.1.10
└── matchers v0.1.0
└── tracing-subscriber v0.3.17
└── (dev) tower-http v0.4.0
= regex-syntax v0.7.2
└── regex v1.8.4
└── tracing-subscriber v0.3.17
└── (dev) tower-http v0.4.0
When removing examples/*
for testing as follows, this does not occur.
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,5 +1,6 @@
[workspace]
+default-members = ["tower-http"]
members = [
"tower-http",
- "examples/*",
+ # "examples/*",
]
Therefore as cargo-deny
seems not to be able to distinguish feature gated dependencies by each members
, we might require other approches.
Yes, this doesn't help for cargo deny
, which bases its analysis on Cargo.lock
. I think the duplicate dependency should just be allowed in deny.toml
.
This has already been resolved as the msrv ci is split from examples. And duplicate dependencies checking is changed to warning from deny.