bazel-skylib icon indicating copy to clipboard operation
bazel-skylib copied to clipboard

Strip compatible_with from bzl_library rules

Open aiuto opened this issue 1 year ago • 4 comments

Wrap bzl_library in a macro so that we can force off some global attributes that are never appropriate for analysis of build rules.

The motivation is that when people use package(default_compatible_with=X) alongside bzl_library, they have accidentally marked their build rules as eligible to deliver to some target environment. This can cause ... scoped tests on cross platform projects to fail because the user defined rules are not the code we are shipping.

An alternative idea was to use a rule initializer for this. That is the better solution, but it would require a newer version of Bazel, so I opted for the backwards compatible solution.

aiuto avatar Jun 06 '24 00:06 aiuto

cc: @ murali42

aiuto avatar Jun 06 '24 00:06 aiuto

cc: @gregestren

aiuto avatar Jun 06 '24 03:06 aiuto

Er, didn't mean to remove other reviewers per se, just meant I'd like to ensure Sasha makes the decision here since this concerns bzl_library.

brandjon avatar Jun 06 '24 14:06 brandjon

Looks reasonable to me.

gregestren avatar Jun 06 '24 15:06 gregestren

@aiuto should we merge this?

comius avatar Jul 12 '24 19:07 comius

I think we should merge it. I no longer have merge rights, so I didn't do it myself.

aiuto avatar Jul 15 '24 17:07 aiuto