Skip to content
This repository was archived by the owner on Apr 18, 2022. It is now read-only.
This repository was archived by the owner on Apr 18, 2022. It is now read-only.

[MAINTENANCE] Multiple versions of crates #1948

@eliaspekkala

Description

@eliaspekkala

Description

In my investigation to reduce Amethyst build times I have found that there are many crates in Amethyst's dependency tree that Cargo isn't able to resolve into a single version. This means that Cargo will build and include several versions of some crates.

I have created a command to automatically find and list crates with many versions. The command is cargo tree --duplicate --prefix-depth | grep '^[\0]' | sort | cut -c3-.

To run the command you need cargo tree. You also need to specify the features you want to include in Amethyst's Cargo.toml.

Note that:

  • I am on this commit: a304ad8c
  • I specified these features: animation, audio, locale, network, renderer, gltf, tiles, json, sdl_controller, vulkan
  • I ran cargo update before the command

The command output:

approx v0.1.1
approx v0.3.2

arrayvec v0.4.11
arrayvec v0.5.0

hibitset v0.5.4
hibitset v0.6.2

image v0.21.3
image v0.22.3

lock_api v0.1.5
lock_api v0.3.1

num-traits v0.1.43
num-traits v0.2.8

num v0.1.42
num v0.2.0

parking_lot_core v0.4.0
parking_lot_core v0.6.2

parking_lot v0.7.1
parking_lot v0.9.0

png v0.14.1
png v0.15.0

proc-macro2 v0.4.30
proc-macro2 v1.0.4

quote v0.6.13
quote v1.0.2

rand_chacha v0.1.1
rand_chacha v0.2.1

rand_core v0.3.1
rand_core v0.4.2
rand_core v0.5.1

rand_hc v0.1.0
rand_hc v0.2.0

rand v0.4.6
rand v0.5.6
rand v0.6.5
rand v0.7.2

rusttype v0.7.9
rusttype v0.8.1

scopeguard v0.3.3
scopeguard v1.0.0

synstructure v0.10.2
synstructure v0.12.1

syn v0.14.9
syn v0.15.44
syn v1.0.5

tiff v0.2.2
tiff v0.3.1

unicode-xid v0.1.0
unicode-xid v0.2.0

This shows that are 22 crates that have multiple versions included in Amethyst.

It also shows that there are 26 older versions of crates that could potentially be removed with some upgrades/updates in Amethyst or in the crates in its dependency tree.

Steps to remove multiple versions

The table below shows the old versions that we want to remove and the steps to remove them.
You can use cargo tree or cargo tree --duplicate to investigate the steps in the cases where I haven't figured them out yet.

Note: Some of the steps will require the crate author to do the updates and then to create a release on crates.io.

Crate and version Steps to remove
approx v0.1.1 bump palette(needs release first) in amethyst_rendy, rendy-texture, and amethyst. Also bump genmesh(needs release first) in amethyst_rendy and amethyst
cgmath v0.16.1 gfx-rs/genmesh#66 Swap cgmath with nalgebra in genmesh.
arrayvec v0.4.11 4 instances, see dependency tree
hibitset v0.5.4 bump rendy in amethyst_rendy
image v0.21.3 3 instances, see dependency tree
lock_api v0.1.5 bump rendy in amethyst_rendy
num-traits v0.1.43 bump genmesh(needs release first) in amethyst_rendy and amethyst
num v0.1.42 bump num in sdl2, then bump sdl2(needs release first) in amethyst_input
parking_lot_core v0.4.0 bump rendy in amethyst_rendy
parking_lot v0.7.1 bump rendy in amethyst_rendy
png v0.14.1 bump image in winit, then bump winit(needs release first) in amethyst_window
proc-macro2 v0.4.30 13 instances, see dependency tree
quote v0.6.13 12 instances, see dependency tree
rand_chacha v0.1.1 bump quickcheck in alga_derive, then bump alga_derive(needs release first) in amethyst_core
rand_core v0.3.1 bump quickcheck in alga_derive, then bump alga_derive(needs release first) in amethyst_core. Also bump laminar in amethyst_network
rand_core v0.4.2 bump quickcheck in alga_derive, then bump alga_derive(needs release first) in amethyst_core
rand_hc v0.1.0 bump quickcheck in alga_derive, then bump alga_derive(needs release first) in amethyst_core
rand v0.4.6 gfx-rs/genmesh#66 Switch to nalgebra in genmesh then bump genmesh (needs release first) in amethyst_rendy
rand v0.5.6 bump laminar in amethyst_network
rand v0.6.5 6 instances, see dependency tree
rusttype v0.7.9 1 instance but many steps, see dependency tree
scopeguard v0.3.3 bump rendy in amethyst_rendy
synstructure v0.10.2 1 instance but many steps, see dependency tree
syn v0.14.9 bump palette_derive(needs release first) in palette, then bump palette(needs release first) in amethyst_rendy
syn v0.15.44 8 instances, see dependency tree
tiff v0.2.2 bump image in winit, then bump winit(needs release first) in amethyst_window
unicode-xid v0.1.0 4 instances, see dependency tree

Progess

This table shows the old crate versions that have been removed, the steps taken, and the PR where it was done.

Crate and version Steps to remove Removed with PR
glyph_brush v0.5.4 bump glyph_brush in amethyst_ui #1955
memmap v0.6.2 bump font-kit in amethyst_ui #1955
parking_lot v0.6.4 bump parking_lot in amethyst_assets #1955
parking_lot_core v0.3.1 bump parking_lot in amethyst_assets #1955
shred v0.7.2 bump shred in amethyst_network #1955

The PR #1952 also reduced the number of steps necessary to remove some of the crates.

Reason

To reduce build times.

Impact

I have not measured the benefits in terms of build times.

Additional Information

Use cargo tree to see Amethyst's dependency tree and the origin of the crates.

Metadata

Metadata

Assignees

No one assigned

    Labels

    team: enginetype: maintenanceA task that has no noticeable user-facing effect. Code cleanup, small refactors, etc.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions