On Thu, Dec 26, 2024 at 10:37 AM David A. Wheeler <dwhee...@dwheeler.com> wrote: > > > On Dec 23, 2024, at 7:56 PM, Britton Leo Kerin <britton.ke...@gmail.com> > > wrote: > > > > Another crack at per-target .ONESHELL. > > > > The major problem with v3 was that the shared struct commands for > > implicit rules, .DEFAULT rules suffix rules etc. caused use of .ONESHELL > > with any target covered by such a rules to "infect" other targets > > sharing the recipe (but not themselves named as .ONESHELL prerequisites) > > with oneshell-ness. That isn't how other special targets work wrt > > their dependencies and would obviously be a bug. > > > > The current version here "fixes" this by adding oneshell_* versions of > > some struct commands fields and using them as appropriate. I added a > > bunch of tests to ensure I'd found all the sharing and handled it > > correctly. > > I didn't look at the proposed code changes, but this *behavior* seems exactly > correct. > ".ONESHELL", applied to a specific target, should *only* apply to that target > and > not to anything else it calls. It's only a property of that specific target.
Well it's a lot better than the bug described above, but is having the same recipe sometimes evaluated as one-shell and sometimes not something you would *ever* do on purpose? One of the major applications I can see for per-target one-shell is incremental adoption, but even in that case the recipe is presumably going to get audited and reasoned about for all the targets covered by the implicit rule. The efficiency gain you might get from doing only some targets from a rule as oneshell would never be worth the risk and weirdness of having the recipe run different ways (and none of the other benefits of oneshell would accrue). So I think it's better for it just to be an error. The fact that that also simplifies the implementation considerably is another strong clue that it's the way to go. Oneshell is really a recipe property anyway, and the use of the target syntax to express it is therefore slightly weirder than for other special targets. Requiring it to be consistent with the implicit and pattern rules makes sense. Paul how would you like this to work? I'd like to wrap up this small project soon. Britton