Some changes to correct the behavior snyk/maven/aspect.bzl and to aggregate the dependency tree more efficiently
The function _maven_deps_aspect_impl is applied recursively to the aspect target and it's dependency tree (following the desired attributes)
The coordinates are collected for each target when the function is applied to it
A depset dependency tree is constructed for each target, depending on its dependencies' depsets (It is important to not expand the depset here on each target because that uses memory exponentially. The depset's transitive attr can be provided with the depsets from the target's dependencies instead so that a tree is constructed instead)
Additional notes:
I replaced the use of extend with append since append allows for adding a single item which is what was being done in all places
I reversed the if branches when maven coords are found just to avoid the negation on boolean logic and because the else-branch was previously the "happy path." I think this makes the code a little easier to follow.
Some changes to correct the behavior snyk/maven/aspect.bzl and to aggregate the dependency tree more efficiently
_maven_deps_aspect_impl
is applied recursively to the aspect target and it's dependency tree (following the desired attributes)Additional notes:
extend
withappend
since append allows for adding a single item which is what was being done in all places