Search code examples
bazelbazel-aspect

How can a Bazel aspect get source file list from java_library target?


Is there a way for an aspect to get a JavaSourceInfoProvider from a java_library target? A source jar works for our compiler, but to generate source debugging information we need the actual source file's location, not a transient copy.


Solution

  • I don't believe that that provider has been made available to Starlark, so you'll have to file a feature request to make it available.

    However, it might be enough to just look at the srcs attribute of the rule directly with ctx.rule.attr.srcs.