-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not all attributes are present in module tags with sensible default values #14528
Comments
/cc @Wyverald Is this work as intended? I guess you can also specify a default value? |
This behaves differently from repository or regular rules. I sincerely hope that this isn't the intended behaviour as it's inconsistent. My expectation would be for these attributes to be set to |
This certainly isn't intended -- in fact, if you |
I've located the root cause -- the fix is in flight. |
Note: We're probably not cherrypicking this fix into 5.0 so please use a rolling release to test bzlmod-related stuff. |
@Wyverald While I agree with the decision not to cherrypick #14447 into 5.0, I would like to speak out in favor of cherrypicking this fix. bzlmod is picking up traction in the community right now and the release of 5.0 will be when most actively maintained rulesets will start to add support for it. That means that bugs like this, where established patterns unexpectedly don't work in the new setting and have to be worked around in non-optimal ways, will lead to the creation of "legacy code" on day 1 of the availability of this new feature. That can hamper adoption as well as create anti-patterns that will stay with bzlmod for a long time due to backwards compatibility concerns. |
I hit an
End up hitting:
I've been told this issue is the root cause. Hence, could we get this cherry-picked so that we can use If we don't cherry-pick the patch: could we enable a fail-fast where at |
You can use |
re: cherrypicking, after much deliberation with Yun, we've decided to cherrypick the bzlmod-related fixes (~3 commits) into 5.0, given that these are for an explicitly experimental feature and won't affect any other component of Bazel, and are hence very low-risk, despite them not strictly being regressions. This does mean that any breakages resulting from those fixes won't be fixed before 5.0 actually ships. If this does happen (and unrelated bugs are likely to be discovered anyhow), we'll try to fix them in a 5.1 point release. |
(#13316) Attribute values are stored normally as "native" values (ie. Java types), and we Starlarkify them before exposing them to Starlark. We were, however, not doing it for attribute default values, which means that the Java `null` was not being converted to Starlark `None`, and the Java `ImmutableMap` was not being converted to Starlark `Dict`, etc. Fixes #14528. PiperOrigin-RevId: 421046160
Description of the problem / feature request:
When using bazel 5.0.0rc3, declare a module tag similar to:
If the tag is used in
MODULE.bazel
file without a value (eg.mytag()
), then in the module's implementation function calls tomytag.target
will fail, whereas it's expected they returnNone
, as happens with empty attributes on repository and regular rules.The text was updated successfully, but these errors were encountered: