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

some-morning-1340

12/19/2022, 4:09 PM
Hey folks, been finding that if I remove a BUILD file and run
./pants tailor <path-to-removed-file>
, the BUILD file is not regenerated even if there are still unmapped targets in that directory. Is this expected behaviour? This also happens if I run
./pants --changed-since=<commit-with-removed-file> tailor
h

happy-kitchen-89482

12/19/2022, 4:39 PM
Try
./pants tailor <path to directory containing removed file>
?
tailor
acts on dirs
s

some-morning-1340

12/19/2022, 9:29 PM
This works, but
./pants --changed-since=... tailor
still doesn’t (which I’m assuming is because
—changed-since
generates a list of files). To get around this, we could iterate through all changed files, grab the associated directory, then call tailor. But seems like having
tailor
also work on the file level would be a better fix?
h

happy-kitchen-89482

12/20/2022, 1:55 AM
Correct
that is how
--changed-since
works, you're right
Not sure what it would mean for tailor to work at the file level? It works by detecting the presence of files in a directory...
Maybe it would mean "the directory the files are in", as you suggest
s

some-morning-1340

12/20/2022, 4:40 PM
Sorry, what I mean is, it seems buggy that
./pants --changed-since=… tailor
does not regenerate removed BUILD files?
Here’s a minimal example replicating the issue (ran
./pants --changed-since=origin/main tailor
in this repo https://github.com/njgrisafi/pants-example/tree/example-tailor-issue) @happy-kitchen-89482
h

happy-kitchen-89482

12/21/2022, 9:13 PM
Gotcha, makes sense. It would be a pretty easy change to say that
./pants tailor path/to/BUILD
should do the same thing as
./pants tailor path/to
, and I think that would take care of this.
Can you open a ticket on https://github.com/pantsbuild/pants?
s

some-morning-1340

12/21/2022, 9:32 PM
2 Views