rust-secure-code / cargo-supply-chain

Gather author, contributor and publisher data on crates in your dependency graph.
Apache License 2.0
316 stars 19 forks source link

Long incremental build times due to JSON schema generation #68

Closed Shnatsel closed 2 years ago

Shnatsel commented 2 years ago

The incremental build times got significantly longer after I added JSON schema generation.

But it's supposed to be stable and not change between releases, let alone incremental builds, so we really don't need to re-generate it on every build. Instead, we could generate it once, hardcode it, and then only generate it when running tests and ensuring that it's the same as the one we've recorded earlier.

Shnatsel commented 2 years ago

Code in question:

https://github.com/rust-secure-code/cargo-supply-chain/blob/dd5861164884a4178b5318de95608c7c9e713f1e/src/subcommands/help.rs#L16

Instead of using this macro, we need to capture its output, hardcode it, and write a test that calls the macro and ensures our hardcoded string is the same as the macro output.