Skip to content

Commit

Permalink
Implement ProguardSpecInfo in Starlark
Browse files Browse the repository at this point in the history
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
  • Loading branch information
comius authored and rules_java Copybara committed Oct 7, 2024
1 parent 110064d commit f552441
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion java/common/proguard_spec_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)

0 comments on commit f552441

Please sign in to comment.