Does this ring any bells?
# development
h
Does this ring any bells?
w
is it a custom target type?... the adaptor situation is a bit of a mess, unfortunately.
h
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
Hm
h
It uses an
rglobs
to glob over a bunch of html files in subdirs
w
is it being generated?
h
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
the
test
rules definitely consume resources, so perhaps the callsite is relevant?
h
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
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
correct. you don't need to do that.
in the linked example:
maybe_source_target.sources.snapshot
is a Snapshot
h
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
SourcesField i think...?
unknown.
h
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
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
Hmm, it appears to be a
pants.source.wrapped_globs.EagerFilesetWithSpec
in all cases (!)
w
Yea, that might make sense. A HydratedTarget has had its globs expanded.
h
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
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
We probably do have such an interest at this point...
w
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
thx, will read it carefully
a
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.