https://pantsbuild.org/ logo
h

happy-kitchen-89482

08/15/2019, 12:58 AM
Does this ring any bells?
w

witty-crayon-22786

08/15/2019, 4:30 PM
is it a custom target type?... the adaptor situation is a bit of a mess, unfortunately.
h

happy-kitchen-89482

08/15/2019, 5:30 PM
It's a
resources
target, so it doesn't have a custom adaptor, just the one generated in
_make_target_adaptor
Don't know if that should make a difference
w

witty-crayon-22786

08/15/2019, 5:30 PM
Hm
h

happy-kitchen-89482

08/15/2019, 5:31 PM
It uses an
rglobs
to glob over a bunch of html files in subdirs
w

witty-crayon-22786

08/15/2019, 5:32 PM
is it being generated?
h

happy-kitchen-89482

08/15/2019, 5:33 PM
It's just a regular BUILD file target, we've not had trouble with it in general use, this is happening in a custom rule.
w

witty-crayon-22786

08/15/2019, 5:34 PM
the
test
rules definitely consume resources, so perhaps the callsite is relevant?
h

happy-kitchen-89482

08/15/2019, 5:35 PM
I'm assuming it must be...
can read starting from halfway down this thread: https://pantsbuild.slack.com/archives/C046T6T9U/p1565815021108500 ... the target API for v2 effectively hasn't been designed, and the current situation is supposed to be temporary
h

happy-kitchen-89482

08/15/2019, 5:40 PM
I had assumed
get_sources()
(which does its own check for the sources attr) is the right thing to use, instead of checking
if not hasattr(maybe_source_target, 'sources'):
ourselves
In this particular case I don't need the source file contents, just the paths.
So `Get`ting the FileContent seems like overkill.
w

witty-crayon-22786

08/15/2019, 5:41 PM
correct. you don't need to do that.
in the linked example:
maybe_source_target.sources.snapshot
is a Snapshot
h

happy-kitchen-89482

08/15/2019, 5:50 PM
Ah yes, and I can get the paths from there, that will work I imagine
Let's see...
What is the type of
maybe_source_target.sources
?
w

witty-crayon-22786

08/15/2019, 6:05 PM
SourcesField i think...?
unknown.
h

happy-kitchen-89482

08/15/2019, 6:05 PM
There is some magic going on here
That's what I thought, but SourcesField doesn't appear to have a
snapshot
member
And also
get_sources()
seems to assume that it's one of the types that
BaseGlobs.from_sources_field
can handle
Namely "a list/tuple/set, a string or a BaseGlobs instance"
w

witty-crayon-22786

08/15/2019, 6:09 PM
the current state of this API is described in https://github.com/pantsbuild/pants/issues/4535 ... there is a lot of design to do.
h

happy-kitchen-89482

08/15/2019, 6:14 PM
Hmm, it appears to be a
pants.source.wrapped_globs.EagerFilesetWithSpec
in all cases (!)
w

witty-crayon-22786

08/15/2019, 6:16 PM
Yea, that might make sense. A HydratedTarget has had its globs expanded.
h

happy-kitchen-89482

08/15/2019, 6:16 PM
Which is exactly the type being choked on in the error at the top of this thread. So now I'm so confused 🙂
These are all of type (subclass of) TargetAdaptor though
w

witty-crayon-22786

08/15/2019, 6:20 PM
there are a bunch of weird interplays between Target and TargetAdaptor and HydratedTarget. there are a few weeks worth of work in this area that we hope to do when we revisit work on v2. if you all have an interest in diving in to do it, i'm happy to help
h

happy-kitchen-89482

08/15/2019, 6:21 PM
We probably do have such an interest at this point...
w

witty-crayon-22786

08/15/2019, 6:22 PM
4535 and all of the comments that follow describe some of the concerns. and unfortunately we just really haven't had the time to dive in.
i've renamed https://github.com/pantsbuild/pants/issues/4535 and updated the description to make it clear that there is more work to do there.
h

happy-kitchen-89482

08/15/2019, 6:54 PM
thx, will read it carefully
a

average-vr-56795

08/27/2019, 1:10 PM
My guess is this is https://github.com/pantsbuild/pants/issues/6659 FWIW tl;dr: Something which we treat as immutable, we actually mutate in scary type-changing ways, and assume no one ever looks at it again.