Implement ProguardSpecInfo in Starlark This addresses the problem of needing --experimental_google_legacy_api for ProguardSpecProvider used by java_lite_proto_library. Although the latest Bazel 7 minor release exposes the provider without the need for a flag, the provider is impossible to obtain in prior versions without setting the flag. Replace the provider with a Starlark version, irregardless of Bazel version. This never fails and if there's a Bazel user that needs it, they are probably already advanced enough to set it up together with everything else. The risk of always using a starlark version is that some combinations don’t work - like native Android rules with Starlark proto rules. Or Starlark proto rules with native Android rules. PiperOrigin-RevId: 683101513 Change-Id: I7523438e74a2bd1913e8e05fad2f3af18db7eebd
diff --git a/java/common/proguard_spec_info.bzl b/java/common/proguard_spec_info.bzl index a57a0ed..b2a591a 100644 --- a/java/common/proguard_spec_info.bzl +++ b/java/common/proguard_spec_info.bzl
@@ -13,4 +13,14 @@ # limitations under the License. """ProguardSpecInfo provider""" -ProguardSpecInfo = ProguardSpecProvider +def _proguard_spec_info_init(specs): + # The constructor supports positional parameter, i.e ProguardSpecInfo([file]) + return {"specs": specs} + +ProguardSpecInfo, _ = provider( + doc = "Information about proguard specs for Android binaries.", + fields = { + "specs": "A list of proguard specs files", + }, + init = _proguard_spec_info_init, +)