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

lemon-elephant-51969

01/16/2020, 4:45 PM
hi there, is there a way to find the BUILD file that owns a given file?
./pants filemap
doesnt return anything for me
a

aloof-angle-91616

01/16/2020, 4:45 PM
./pants --owner-of=given/file.txt list
l

lemon-elephant-51969

01/16/2020, 4:46 PM
worked brilliantly
thank you!
a

aloof-angle-91616

01/16/2020, 4:47 PM
target selection mechanisms aren’t well-documented, i’m trying to make them more discoverable in https://github.com/pantsbuild/pants/pull/7350
sorry about that
l

lemon-elephant-51969

01/16/2020, 4:48 PM
oh nice. no worries at all. im always amazed at your guys' support in here
❤️ 2
👖 2
a

aloof-angle-91616

01/16/2020, 4:50 PM
i love to hear that!!
l

lemon-elephant-51969

01/16/2020, 5:02 PM
i wonder if you have a suggestion for what im trying to accomplish? or if pants has a built in method for this: I am trying to list just the test targets that would be affected by the changed files in my branch. i was thinking so far of something like this to fetch the affected targets:
git diff --name-only develop | grep ".scala" | while read f; do ./pants --owner-of=$f list; done | sort | uniq
but then i would need to walk up the dependee tree from every target to find all the test targets that transitively depend on those targets
a

aloof-angle-91616

01/16/2020, 5:03 PM
you can use
./pants --changed-parent=master test
!!
👍 1
i’m trying to think of the best way to discover these things
l

lemon-elephant-51969

01/16/2020, 5:04 PM
oh wow that command will find and run the tests for the affected files?
you guys thought of everything
🔥 2
a

aloof-angle-91616

01/16/2020, 5:05 PM
personally i usually use
./pants help-all | grep -i 'changed'
to try to see if any options might work but it takes a few tries to discover options i don’t yet know
h

hundreds-father-404

01/16/2020, 5:35 PM
FYI, we’re working to allow this.
./pants list src/python/foo.py
as a replacement to
—owner-of
:)
💥 1
4 Views