https://pantsbuild.org/ logo
#general
Title
# general
w

wonderful-iron-54019

05/14/2020, 4:18 PM
Small bit of feedback on file arguments: we frequently keep README files next to the code in our repos for documentation / runbooking etc. Recently ran into a build issue where changing a readme triggered a . failure:
Copy code
Please check that there is a BUILD file in `src/media_processing/xcoder_audio_levels` with a target whose `sources` field includes `src/media_processing/xcoder_audio_levels/README.md`. See <https://www.pantsbuild.org/build_files.html>.
Naturally, these files do not belong to a target since they are not runtime artifacts. If there is an option to safely ignore 'orphaned' files, consider including that in the error message. If there isn't would like to kindly request one as building a good exclustion list can become quite cumbersome
👍 1
w

witty-crayon-22786

05/14/2020, 4:19 PM
there is!
but yes, good point.
Copy code
--owners-not-found-behavior=<OwnersNotFoundBehavior> (default: error)
What to do when file arguments do not have any owning target. This happens when there are no targets whose `sources` fields include the file argument.
for automated cases you’ll probably want
--owners-not-found-behavior=ignore
w

wonderful-iron-54019

05/14/2020, 4:23 PM
ah thank you
w

witty-crayon-22786

05/14/2020, 4:23 PM
i’ll follow up on adding the option to the error message though: thanks!
w

wonderful-iron-54019

05/14/2020, 4:29 PM
thank you! if you don't mind me asking, what's the justification for the
error
default? it seems like especially for newer features where an ignore would not be dangerous that
warn
is more appropriate as users could be nudged without encountering errors unexpectedly
for . example, we had been using file args in our build successfully for a few days until we hit a changed file without a build owner
w

witty-crayon-22786

05/14/2020, 4:30 PM
sorry for the trouble.
w

wonderful-iron-54019

05/14/2020, 4:30 PM
oh no worries at all1
just thought i'd ask the question
w

witty-crayon-22786

05/14/2020, 4:31 PM
the reason in this case is that this unified two features:
--owner-of
, which people sometimes used manually, but which was mostly used in automation, with CLI “specs” (which used to only be targets)
when users specify targets on the CLI, they want to know if they don’t exist… likewise, we felt it was important that if a user specified a file or file glob on the CLI, they would see an error if it didn’t exist or wasn’t owned*
but in automated cases “not owned” is a non-issue (…not existing might be an issue!)
w

wonderful-iron-54019

05/14/2020, 4:33 PM
ah understood
thanks for the context
a

aloof-angle-91616

05/14/2020, 4:34 PM
please continue to ask questions like this — very important to not let us get complacent about breaking users!
h

hundreds-father-404

05/14/2020, 5:21 PM
@witty-crayon-22786 would
--pants-ignore
be relevant too? You could add
**/README.md
to it, although that would mean you could never add that file to the
sources
of a target, which could be an issue
a

aloof-angle-91616

05/14/2020, 5:22 PM
could we allow explicit sources (i.e. not globs) to override a pants ignore setting?
w

witty-crayon-22786

05/14/2020, 5:23 PM
@hundreds-father-404: the bit of context that i was assuming here is that this is related to the
--spec-file
question from the other day. is that right @wonderful-iron-54019 ?
@hundreds-father-404: but… no, i don’t think it’s relevant actually. ignoring the file would switch that particular error from a “no owners for file” to “file didn’t exist”
👍 1
w

wonderful-iron-54019

05/14/2020, 5:24 PM
yes correct
we switched to spec-files b/c didn't want . our changes . to .accomodate the
globs
deprecations to trigger a system wide redeploy, so we were grepping . out the BUILD files
👍 2
h

hundreds-father-404

05/14/2020, 5:26 PM
Makes sense. I think erroring will still be the right behavior because of the risk of warnings getting lost in scripts and CI, so long as the error message is improved to explain
--owners-not-found-behavior
.
👍 1
w

witty-crayon-22786

05/14/2020, 7:39 PM
6 Views