shadow-rs icon indicating copy to clipboard operation
shadow-rs copied to clipboard

Only support reproducible output by default

Open epage opened this issue 3 years ago • 5 comments

Reproducible builds is a strong area of interest for people but shadow is generated code that is inherently not reproducible and relies on people only calling a subset of calls and the compiler optimizing the rest away.

Time-derive data is an a clear case of this. git-derived data is more debatable.

epage avatar Feb 22 '22 15:02 epage

Yeah, Do you have any suggestions to shadow-rs. @epage

baoyachi avatar Feb 22 '22 15:02 baoyachi

One thought

  • Rename the git2 feature to git
  • Make git non-default
  • [x] Split out a time feature (non-default)
  • [x] Use document_features to document all of this (including the warnings about reproducibility) in rustdoc

epage avatar Feb 22 '22 16:02 epage

The main issue I see with this is documenting the API.

What if shadow exposed its functionality as a trait (even if it just wraps non-trait functions)? That way the API is browsable like normal even though it is generated.

epage avatar Feb 22 '22 16:02 epage

Wow, About what you mentioned above,I look forward to you very much. @epage

baoyachi avatar Feb 22 '22 16:02 baoyachi

As I'm considering this and #69, I'd propose the API change to

  • mod per type of source (git, time, rust, etc)
    • public functions / macros exposing accessors
    • a struct implementing a Source trait
      • Function to provide all of the ShadowConst / ConstVals
      • Accepts a env trait so we can have an implementation that records all functions used (so we report only them, rather than all envs, like build-env does)

epage avatar Feb 22 '22 17:02 epage