https://pantsbuild.org/ logo
b

brief-dinner-12483

12/16/2021, 8:15 PM
Is there a way to find out whether or not the transitive dependencies for a single target have changed compared to
origin/master
?
h

happy-kitchen-89482

12/16/2021, 8:17 PM
In general
./pants --changed-since=origin/master --changed-dependees=transitive <goal>
will run the pants goal on just the targets that have changed.
So for example,
./pants --changed-since=origin/master --changed-dependees=transitive test
will only run tests transitively affected by changes
b

brief-dinner-12483

12/16/2021, 8:19 PM
Is there a way to do the same thing but for a file instead of a goal?
h

happy-kitchen-89482

12/16/2021, 8:19 PM
If you need to know the actual target identities, you can do
./pants --changed-since=origin/main --changed-dependees=transitive list
b

brief-dinner-12483

12/16/2021, 8:25 PM
What I basically want is the intersection of
./pants dependencies --transitive $directory/::
and the git diff. Or even more specific, whether or not the intersection is empty.
Copy code
./pants --changed-since=origin/master --changed-dependees=transitive src/my_directory/gp::
13:25:46.15 [ERROR] You used `--changed-since` at the same time as using target arguments. Please use only one.
☝️ I think the above is basically what I want to be able to say but not sure if there's a way that works
h

happy-kitchen-89482

12/16/2021, 8:28 PM
Yeah you can't combine the two right now. You either specify "I want to act on these targets" or "I want to act on the targets that have changed since this git sha"
But you can list the affected targets with
./pants --changed-since=origin/main --changed-dependees=transitive list
and then check if the targets you care about are in that list?
1
b

brief-dinner-12483

12/16/2021, 8:35 PM
That might work! Thank you!
5 Views