bazelbuild / bazel-skylib

Common useful functions and rules for Bazel
https://bazel.build/
Apache License 2.0
393 stars 180 forks source link

Strip compatible_with from bzl_library rules #522

Closed aiuto closed 2 months ago

aiuto commented 4 months ago

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 commented 4 months ago

cc: @ murali42

aiuto commented 4 months ago

cc: @gregestren

brandjon commented 4 months ago

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.

gregestren commented 4 months ago

Looks reasonable to me.

comius commented 2 months ago

@aiuto should we merge this?

aiuto commented 2 months ago

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