Skip to content

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

Description

@garrett-hopper

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.

Activity

  1. casey commented on May 2, 2019

    @casey
    Owner

    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.

  2. runeimp commented on May 3, 2019

    @runeimp

    @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. 😃

  3. garrett-hopper commented on May 3, 2019

    @garrett-hopper
    Author

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

  4. runeimp commented on May 3, 2019

    @runeimp

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

  5. garrett-hopper commented on May 3, 2019

    @garrett-hopper
    Author

    Looks great, @runeimp! :)

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

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions