Subject: Re: redoing unnecessary targets when a do file is modified but the output remains unchanged

From: Sergey Matveev <[email-masked]>
Date: Sun, 21 Feb 2021 11:38:59 +0300

Greetings!

*** Karolis K [2021-02-17 22:40]:
>In an ideal case I think only the file with a modified do script should be rebuilt, and then, since the output is the same, all other dependencies should simply pass.
>But maybe I am missing something?

You are right -- currently it is sub-optimal. The reason is simple: when
you determine if target is out-of-date (OOD), you recursively go through
the dependecies from "up to bottom" and if you see any OOD one, then the
whole path is considered OOD and rebuild starts. Simple algorithm.

I have encountered exactly that kind of problem with redo-always-ed
targets, which in my case are usually targets checking for environment
variables and configuration files changes. And nearly everyone depends
on them, because all build commands/options depends on envvars and
configuration. And that lead to rebuilding of nearly everything. But I
made a two-stage building and dependency tracking: track some of
"always" targets, rebuild them and then start an ordinary OOD detection
and targets rebuilding. And exactly here if rebuilt "always" targets are
not changed, then OOD works as we expect to skip building.

I must think about some kind of feedback channel that tells that target
is not changed after the rebuild. Will think about that and implement.
It will be useful optimization and safe (because of hashes there should
not be situations when something is skipped mistakenly).

-- 
Sergey Matveev (http://www.stargrave.org/)
OpenPGP: CF60 E89A 5923 1E76 E263  6422 AE1A 8109 E498 57EF