rust-cssparser icon indicating copy to clipboard operation
rust-cssparser copied to clipboard

Do not generate colors phf map at compile time

Open RazrFalcon opened this issue 6 years ago • 3 comments

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.

RazrFalcon avatar Feb 07 '19 11:02 RazrFalcon

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

SimonSapin avatar Feb 07 '19 11:02 SimonSapin

Yes, but they are slowing down the build process.

RazrFalcon avatar Feb 07 '19 11:02 RazrFalcon

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...

emilio avatar Apr 06 '24 17:04 emilio