bazel icon indicating copy to clipboard operation
bazel copied to clipboard

ApiExporter: capture missing attributes

Open sluongng opened this issue 1 month ago • 3 comments

There could be special attributes, such as 'package_metadata' and 'applicable_licenses' defined in lib/packages/RuleClass.java, that are not part of the exported builtin.pb. This causes language servers such as starpls to fail diagnosing when encounter these attributes.

Fix this by exposing ConfiguredRuleClassProvider from SymbolFamilies and route it down to ApiExporter.collectRuleInfo. There, we include all the previously unseen attributes into the exported data.

Note that this fix would only add the 'package_metadata' attribute to the final proto and not 'applicable_licenses' because the latter is currently an alias of the former.

Part of https://github.com/withered-magic/starpls/issues/410

sluongng avatar Dec 03 '25 16:12 sluongng

Open question: should I add applicable_licenses attribute to the exported proto so starpls stop yelling about the unknown attribute? Or we can add a hardcoded clause in starpls to tell people to s/applicable_licenses/package_metadata?

sluongng avatar Dec 03 '25 16:12 sluongng

Open question: should I add applicable_licenses attribute to the exported proto so starpls stop yelling about the unknown attribute? Or we can add a hardcoded clause in starpls to tell people to s/applicable_licenses/package_metadata?

I would not add it to the exported proto. The notification should be sufficient. It is been package_metadata since bazel 7. Once bazel 9 comes out, even teams supporting LTS-2 will all be on 7 and can migrate.

aiuto avatar Dec 04 '25 15:12 aiuto

cc: @tetromino as Im not sure who is the right owner for this code path.

sluongng avatar Dec 05 '25 09:12 sluongng