Open Bug 1404894 Opened 6 years ago Updated 1 year ago

forbid multiple crate versions when vendoring

Categories

(Firefox Build System :: General, enhancement)

enhancement

Tracking

(firefox58 affected)

Tracking Status
firefox58 --- affected

People

(Reporter: froydnj, Unassigned)

References

Details

We have a number of crates that have multiple versions vendored.  The "unnecessary" crates and versions are:

aho-corasick-0.6.2
bindgen-0.29.0
bitflags-0.7.0
bitflags-0.8.2
cfg-if-0.1.0
core-foundation-sys-0.3.1
env_logger-0.4.1
gcc-0.3.42
kernel32-sys-0.1.4
lazy_static-0.1.16
lazy_static-0.2.2
log-0.3.6
num-traits-0.1.37
regex-0.2.1
regex-syntax-0.4.0
rustc-serialize-0.3.22
semver-0.1.20
thread-id-3.0.0

I think servo has a lint set up that will complain if the dependency graph has multiple versions of a given crate, save for a few exceptional ones.  We should adopt a similar policy:

1. Set up a whitelist of the crates above.
2. Modify `mach vendor rust` to check for multiple crate versions.
3. If we try to vendor multiple versions of a crate not on the above list, print a nice error message and refuse to vendor.
4. If we vendor and one of the above crates suddenly doesn't have multiple versions, print a message about removing the appropriate crate from the whitelist prior to vendoring, and refuse to vendor.

Ideally, this plan will get us to a cleaner dependency graph and fewer unnecessary vendorings into m-c.  The only wrinkle I can think of--besides annoying people who now feel like they have to go clean up a bunch of crates which might not be their problem--is that auto-vendoring on servo imports might now go horribly wrong.  Not sure what to do about that.
I'm not sure this is a good idea. I think it will increase the burden on importing rust code significantly. Even totally unrelated projects (e.g. rust-url and webrender) that are vendored into m-c would need to make sure their entire dependency trees use compatible versions which IMO might be excessive. And there might be good reasons for needing different versions of a crate in different places (presumably this is why servo has an exceptions list).
Presumably multiple versions of the same create will increase binary size? Some people are quite sensitive to installer/binary size bloat and incurring work to avoid extra kilobytes due to multiple crate versions could be justified...
Product: Core → Firefox Build System
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.