sbt / zinc

Scala incremental compiler library, used by sbt and other build tools

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Replace timestamps with hashes

Friendseeker opened this issue · comments

With #1388 merged, Zinc uses Consistent Analysis Format by default which resets all timestamps stored in analysis for sake of reproducibility.

We need to identify all zinc's usage of various timestamps and remove the usage of them one by one, by replacing timestamp with content hash.

Probably need to remove sbt side usage of timestamp too. Hopefully there isn't any.

Should we make this change toggle-able as a flag in IncOptions named hermeticAnalysis?

Currently a lot of Zinc scripted tests rely on checkRecompilation, which relies on compilation timestamp to determine which cycle a source is last recompiled. This method fundamentally is incompatible with hermetic analysis, as hermetic analysis should not store any cycle-specific information. checkIterations has similar problem. I also don't see a way of rewriting these tests to avoid using checkRecompilation or checkIterations.

Looking forward to heard opinions on that.

@adpi2 @eed3si9n

Maybe we should allow some event handler to be registered that can take place of the implicit iteration counting that we do.

This makes a lot of sense! I will look into event handler approach.

Indeed a boolean flag just didn't feel right to me. It is too much complexity added and honestly I can envision future bug reports saying some bug only appears when hermeticAnalysis is set to true or false...

Another low tech approach could be a directory we can specify, which the incremental compiler can dump JSON file at the end, instead of keeping it in the Analysis. That way if you want to know how many iterations you just count the number of files in the directory etc.