https://pantsbuild.org/ logo
b

bitter-ability-32190

05/15/2023, 3:56 PM
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

happy-kitchen-89482

05/15/2023, 4:07 PM
Can't you tweak the globs to not fail the match?
b

bitter-ability-32190

05/15/2023, 4:08 PM
I don't follow?
h

happy-kitchen-89482

05/15/2023, 4:09 PM
Why do you have an unmatched source glob to begin with?
b

bitter-ability-32190

05/15/2023, 4:10 PM
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

happy-kitchen-89482

05/15/2023, 4:11 PM
I see
Can you produce the BUILD file programmatically as well? 🙂
b

bitter-ability-32190

05/15/2023, 4:12 PM
Hehe we do in other places, but no. That means we'd dirty a file tracked by
git
😉
h

happy-kitchen-89482

05/15/2023, 4:13 PM
Could be a separate
BUILD.generated
file that is gitignored?
b

bitter-ability-32190

05/15/2023, 4:14 PM
Sure, but now we're severely engineering around Pants 😐
h

happy-kitchen-89482

05/15/2023, 4:15 PM
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

bitter-ability-32190

05/15/2023, 4:16 PM
Fair 🙂
h

happy-kitchen-89482

05/15/2023, 4:16 PM
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

bitter-ability-32190

05/15/2023, 4:16 PM
Ehhh I'm not a fan of symbolic syntax. (See the visibility rules 😛 )
h

happy-kitchen-89482

05/15/2023, 4:16 PM
That seems to require a lot less new plumbing
b

bitter-ability-32190

05/15/2023, 4:17 PM
Let's see what others say as far as if this is rare or not, and go from there 🙂
h

happy-kitchen-89482

05/15/2023, 4:17 PM
Yeah but I'm not a fan of added complexity, so meet me half way here
b

bitter-ability-32190

05/15/2023, 4:18 PM
It might be I'm in the minority, so we do nothing 🙂
c

curved-television-6568

05/15/2023, 5:05 PM
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.