Hi again,
Nice to kickstart this thread too which also needs to happen...
On Thu, 2020-07-30 at 23:18 +0200, Sander Striker wrote:
> Hi,
[...]
> Couldn't we solve this in a more generic way without having to specify a
> BST_PLUGIN_IDENTITY which now would need to guarantee uniqueness etc?
Possibly for your specifically stated use case.
I think that Ben had other use cases in mind which would benefit from
being able to identify specific plugins.
I think we need to really summarize what things we want to accomplish
with identifying specific plugins in an element's dependencies, if we
want to go as far as calling APIs provided by those elements which are
outside of the core defined Element/Source APIs in BuildStream, this
could scope creep quite quickly (i.e. we'd need ways to assert versions
of other adjacently loaded plugins on top of their identities, etc, I'm
not sure we want to go down that road).
I think it's best if Ben were to ring in on this and remind me what he
wanted with identities...
> Something like the following on Element:
>
> def is_same_kind(self, element):
> return self.__class__ is element.__class__
>
> That should do the trick?
>
This would only work for identifying element plugin matches within the
_same project_. Even if a subproject had separately loaded exactly the
same plugin from exactly the same origin at exactly the same version,
it would be loaded separately into a different namespace for that
subproject.
Cheers,
-Tristan