servo / rust-cssparser

Rust implementation of CSS Syntax Level 3
https://drafts.csswg.org/css-syntax/
Mozilla Public License 2.0
732 stars 128 forks source link

Do not generate colors phf map at compile time #236

Open RazrFalcon opened 5 years ago

RazrFalcon commented 5 years ago

phf_codegen is a pretty big dependency and colors will not change from build to build, so maybe it's better to keep the colors map as a "prebuilt" file? Something like this.

The source of the problem:

cssparser v0.24.1 (./rust-cssparser-0.24.1)                                         
├── cssparser-macros v0.3.4 (./rust-cssparser-0.24.1/macros)
│   ├── phf_codegen v0.7.24
│   │   ├── phf_generator v0.7.24
│   │   │   ├── phf_shared v0.7.24
│   │   │   │   └── siphasher v0.2.3
│   │   │   └── rand v0.6.5
│   │   │       ├── libc v0.2.48
│   │   │       ├── rand_chacha v0.1.1
│   │   │       │   └── rand_core v0.3.1
│   │   │       │       └── rand_core v0.4.0
│   │   │       │   [build-dependencies]
│   │   │       │   └── autocfg v0.1.2
│   │   │       ├── rand_core v0.4.0 (*)
│   │   │       ├── rand_hc v0.1.0
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       ├── rand_isaac v0.1.1
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       ├── rand_jitter v0.1.3
│   │   │       │   └── rand_core v0.4.0 (*)
│   │   │       ├── rand_os v0.1.2
│   │   │       │   ├── libc v0.2.48 (*)
│   │   │       │   └── rand_core v0.4.0 (*)
│   │   │       ├── rand_pcg v0.1.1
│   │   │       │   └── rand_core v0.3.1 (*)
│   │   │       │   [build-dependencies]
│   │   │       │   └── rustc_version v0.2.3
│   │   │       │       └── semver v0.9.0
│   │   │       │           └── semver-parser v0.7.0
│   │   │       └── rand_xorshift v0.1.1
│   │   │           └── rand_core v0.3.1 (*)
│   │   │       [build-dependencies]
│   │   │       └── autocfg v0.1.2 (*)
│   │   └── phf_shared v0.7.24 (*)

It's like 20 dependencies just to build a phf map, that never changes.

SimonSapin commented 5 years ago

I generally dislike having generated files in a source repository. And these are build-dependencies, not part of the final binary.

RazrFalcon commented 5 years ago

Yes, but they are slowing down the build process.

emilio commented 5 months ago

Happy to take a patch here as long as it's well documented how to tweak it as needed.

Specially since those colors are not gonna change any time soon...