I like this approach (better than the simpler version I proposed in reddit). Also, the reason I prefer this, over the simple meta-crate alternative that many others brought up, is the fine-grained control over which crates are fetched and compiled. I have a few things to add (let’s call this tight group of crates: a clique):
[cliques]
platform = "2.6"
security = "1.1"
piston = "1.9"
[dependencies]
libc = "platform"
regex = "platform"
crypto = "security"
...
A few more advantages apart from the ones I mentioned in reddit:
- Distributed curation of various cliques
- Minimize effects of “endorsement”
But of course this brings an additional layer of version conflicts, and adds to the complexity; such as crate collisions (with conflicting versions) between cliques. One way to adapt to this is to strictly follow a few conventions. One that comes to my mind:
- Every clique version should be compatible with at least one version of the “platform”.
- Every clique version should maintain a list of rustc versions it compiles with.
To make this easy for clique maintenance, the “platform” clique should only contain a very few and extremely popular/useful crates (may be around 10-20) with a high degree of maintenance guarantee.
To make this easy for general users, may be cargo should suggest clique/crate versions when there are conflicts based on compatibility metadata with rustc and platform.
Update: -ed!
Update 2: – OR –
Avoid having library users from dealing with such complexty and let these “cliques” be used exclusively for automatic version matching and suggestion by cargo.
The users should not specify which cliques it depends on. And all crates should have membership metadata on various cliques for use by cargo intelligence.
PS: Sadly, the documentation concern is completely ignored!