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

Tracking Incremental Changes (Avoid re-running builds) #424

Closed
garrett-hopper opened this issue May 2, 2019 · 5 comments
Closed

Tracking Incremental Changes (Avoid re-running builds) #424

garrett-hopper opened this issue May 2, 2019 · 5 comments

Comments

@garrett-hopper
Copy link

Is there a recommended way of tracking when files in a folder change and only re-running a build when it would actually create a new artifact?
I know just is 'just' a task runner, but using it is far more desirable then Makefiles. Having a good way of doing this kind of incremental builds (running just twice in a row would cause the second run to do nothing) would be great.
I suppose the user may need to have a system to generate a hash of the folder/files that they depend on and implement their own check in their just targets. I don't know of any tools that could do this well though.

@casey
Copy link
Owner

casey commented May 2, 2019

Just doesn't support this functionality natively, but there are some possible workarounds:

  • Use Make for recipes which would benefit from incremental compilation (you could call these recipes from Just, so you don't need to remember which recipes use Make and which use Just)

  • Write a recipe that uses entr or cargo-watch to re-run a recipe when a file changes. This isn't quite what you asked for, but would be a way to at least only rerun a build command when something changes.

@casey casey closed this as completed May 2, 2019
@runeimp
Copy link

runeimp commented May 3, 2019

@Jumblemuddle you might use a tool like chkfilehash in https://github.com/leonidessaguisagjr/filehash. I played with it a bit and you can do something like

$ pip install filehash
build src='source.rs':
	#!/bin/sh
	if [[ $(chkfilehash -c {{src}}.sha256 | grep OK) -eq 0 ]]; then
		echo "No changes to rebuild"
		exit 0
	fi
	chkfilehash {{src}} > {{src}}.sha256
	echo "We will rebuild!"

This requires you have Python installed already. But I'm sure there are other tools available as well. Actually makes me want to make a simple tool in Go for a tool supported on many platforms without any dependencies. 😃

@garrett-hopper
Copy link
Author

Thanks, @casey and @runeimp, these are great suggestions.

@runeimp
Copy link

runeimp commented May 3, 2019

@Jumblemuddle check out https://github.com/runeimp/filedelta if you like. 😃

@garrett-hopper
Copy link
Author

Looks great, @runeimp! :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants