Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

jbuilder uses timestamps only for change detection #158

Closed
mmottl opened this issue Jun 20, 2017 · 3 comments
Closed

jbuilder uses timestamps only for change detection #158

mmottl opened this issue Jun 20, 2017 · 3 comments

Comments

@mmottl
Copy link
Contributor

mmottl commented Jun 20, 2017

It happens sometimes that a developer edits a file, saves it, and then quickly undos the change followed by another save before building. jbuilder will perceive the file as changed regardless of contents, because it apparently just uses timestamps to detect changes. This problem can also happen if, for example, an intermediate file is equivalent to the previous version, maybe because a change didn't affect code generation.

I think it would be better to hash all input files and (intermediate) targets to reduce build times in these cases. Other build tools support this, too, e.g. ocamlbuild, and probably omake. Hashing is usually very much cheaper than any compilation step. An unchanged timestamp should, of course, be interpreted as "no change" to avoid hashing all files all the time.

@jaredly
Copy link

jaredly commented Jun 20, 2017

Would also be nice to diff at the AST level as a second early bailout

@ghost
Copy link

ghost commented Jun 26, 2017

There a re a couple of things to sort to make this work:

  1. change the way aliases are handled; currently creating an alias essentially does touch <some-file>. They would now have to produce a file whose contents reflects the contents of the dependencies of the alias
  2. decide how to checksum files. We can't rely on external system tools as this is not portable, and calling Digest.file synchronously for every file is likely to be noticeable on large trees. We could create a auxiliary tool for this

I'm also thinking of adding a bridge with jenga so that we can use jenga with jbuilder projects. This will solve this issue as jenga already handles all this properly.

@ghost
Copy link

ghost commented Aug 17, 2017

Jbuilder is now hashing files

@ghost ghost closed this as completed Aug 17, 2017
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants