Anyone have opinions on per-target kob on ignore/w...
# development
b
Anyone have opinions on per-target kob on ignore/warn/error of unmatched source(s) glob?
We want it to be
error
at $work but we have 2 places where the build process is bootstrapped outside of Pants and ad-hoc (we can't move it into Pants either). So instead of erroring, we warn and silence those 2 warnings. But that means more warnings pop up and people just ignore them.
h
Can't you tweak the globs to not fail the match?
b
I don't follow?
h
Why do you have an unmatched source glob to begin with?
b
Because the files may or may not exist on disk. 🙂 These files are produced programmatically, and not in a way we can have Pants do it for us. So for most people, they don't exist. And for the few who care, they do
h
I see
Can you produce the BUILD file programmatically as well? 🙂
b
Hehe we do in other places, but no. That means we'd dirty a file tracked by
git
😉
h
Could be a separate
BUILD.generated
file that is gitignored?
b
Sure, but now we're severely engineering around Pants 😐
h
Yes, but this is a very specific case
I'm mildly leery of per-target knobs for this, unless the implementation is fairly trivial
b
Fair 🙂
h
What about something like
~path/to/file.py
meaning that the file need not exist
So not unmatched globs, but you can enumerate files that needn't match
b
Ehhh I'm not a fan of symbolic syntax. (See the visibility rules 😛 )
h
That seems to require a lot less new plumbing
b
Let's see what others say as far as if this is rare or not, and go from there 🙂
h
Yeah but I'm not a fan of added complexity, so meet me half way here
b
It might be I'm in the minority, so we do nothing 🙂
c
From the issue comment I posted, I have an idea about flagging a value as being “default” so it doesn’t warn/error on unmatched globs. There are a few different ways how to get that that I can think of.. either it could be the thing it does when set using
__defaults__
or maybe with a
sources=default([…])
to indicate the value should be treated as a default value.. I also did think of Benjy’s idea to mark inidividual globs as optional, but that covers another use case than what I had in mind (could be used, but would be awkward). My use case is to re-use/augment the default set of globs for a targets sources value, having to mark each individual glob optional in that case would be a bit janky.