https://pantsbuild.org/ logo
#development
Title
# development
h

hundreds-father-404

07/13/2020, 8:55 PM
Hm. I have no idea how with explicit deps in BUILD files we plan to distinguish between what is a target address vs. a generated subtarget. If there’s a
:
, then we know it’s a target address. Otherwise, we don’t know how to distinguish between the address shorthand of leaving off
:foo
when the parent directory is
foo/
. It’s not reliable to look for a file extension, because not all files have it and dirs can have them. We can’t call
Path.is_file()
because that’s not engine safe, afacit.
With file args, we tried our best to solve this via several heuristics: 1. if
:
is there, it’s an address. 2. if there’s a file suffix, assume it’s a file. 3. Finally, call
Path.is_file()
w

witty-crayon-22786

07/13/2020, 9:06 PM
3) continues to be a way to break this tie, i think
the Specs are parsed outside the engine right now, iirc. could move parsing in if you want that operation cached (and then use a Snapshot)
(but as long as it’s outside, it’s relatively safe to do)
h

hundreds-father-404

07/13/2020, 9:35 PM
Yes, but this needs to happen within the resolve dependencies rule
w

witty-crayon-22786

07/13/2020, 9:39 PM
ah. yea, then the Snapshot equivalent of “is_file”, probably. makes it a bit more important to do this at the directory level, probably.
and more reason to follow up on the “list without Snapshotting” thing… it’s on my list.
h

hundreds-father-404

07/13/2020, 9:44 PM
Okay. For the sake of landing this, I’ll for now assume anything without an extension is a directory, meaning shorthand for address. This is a pretty particular edge case: you’re using explicit generated subtargets (rather than dep inference) on a file without an extension