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

Track if tasks are up-to-date based on file timestamps or checksums #1685

Closed
Nezteb opened this issue Oct 3, 2023 · 3 comments
Closed

Track if tasks are up-to-date based on file timestamps or checksums #1685

Nezteb opened this issue Oct 3, 2023 · 3 comments

Comments

@Nezteb
Copy link

Nezteb commented Oct 3, 2023

Task/taskfile supports several ways of preventing unncessary work, one of which is by fingerprinting locally generated files and their sources.

If just could support this in some capacity, I think it'd help improve just's user experience. 😄

@laniakea64
Copy link
Contributor

While waiting for just dev to respond, here's a possible workaround example: a recipe foo that only needs to run if files a.txt and b.txt have different checksums since last run -

foo:
	#!/bin/bash
	job=foo
	sha256sums={{quote(justfile_directory() / '.sha256sums-') + '"$job"'}}
	dependencies='a.txt b.txt'
	if [[ -f "$sha256sums" ]] && sha256sum --status -c "$sha256sums" ;then
	  echo "Job '$job' is up-to-date"
	  exit 0
	fi
	sha256sum $dependencies > "$sha256sums"
	echo "Running job '$job'..."

(This example assumes files a.txt and b.txt always exist.)

@casey
Copy link
Owner

casey commented Oct 9, 2023

I think this is a dupe of #867, have a look.

@casey casey closed this as completed Oct 9, 2023
@nmay231 nmay231 mentioned this issue Feb 16, 2024
18 tasks
@qtfkwk
Copy link

qtfkwk commented Jun 9, 2024

I created https://crates.io/crates/mkrs primarily for this reason (and to write the Makefile in markdown); it seems like the same approach may not fit in just's design. Mkrs distinguishes between file and non-file targets, and runs the recipe for a file target if -B (force processing), file does not exist, or is outdated (any of target's source files are newer than the target file). Please feel free to use as it as a reference. Thanks!

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

4 participants