Skip to content

Commit

Permalink
Add message for attribute access to use get_attr or get_attrs ins…
Browse files Browse the repository at this point in the history
…tead

Reviewed By: iguridi

Differential Revision: D64251951

fbshipit-source-id: e1af1a02570dd8e8143d95fa2875cb3b8e6867ab
  • Loading branch information
Nero5023 authored and facebook-github-bot committed Oct 12, 2024
1 parent b53cc54 commit f454e81
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/buck2_bxl/src/bxl/starlark_defs/nodes/configured.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,9 @@ fn configured_target_node_value_methods(builder: &mut MethodsBuilder) {
/// You should store the result of this function call for further usage in the code rather than calling
/// `attrs_eager()` each time you need to access the attrs.
///
/// Right now, it is not recommended to use this method. Instead, use `get_attr` and `get_attrs` methods.
/// We will deprecate this method in the future.
///
/// Sample usage:
/// ```text
/// def _impl_attrs_eager(ctx):
Expand Down Expand Up @@ -254,6 +257,9 @@ fn configured_target_node_value_methods(builder: &mut MethodsBuilder) {
/// `attrs_lazy()` each time to get the `lazy_attrs` object. Note that if the `get()` is `None`,
/// then any methods called on `None` will result in an error.
///
/// Right now, it is not recommended to use this method. Instead, use `get_attr` and `get_attrs` methods.
/// We will deprecate this method in the future.
///
/// Sample usage:
/// ```text
/// def _impl_attrs_lazy(ctx):
Expand All @@ -279,6 +285,9 @@ fn configured_target_node_value_methods(builder: &mut MethodsBuilder) {
/// `resolved_attrs_lazy()` each time to get the `lazy_resolved_attrs` object. Note that if the `get()` is `None`,
/// then any methods called on `None` will result in an error.
///
/// Right now, it is not recommended to use this method. Instead, use `get_attr` and `get_attrs` methods.
/// We will deprecate this method in the future.
///
/// Sample usage:
/// ```text
/// def _impl_resolved_attrs_lazy(ctx):
Expand Down Expand Up @@ -306,6 +315,9 @@ fn configured_target_node_value_methods(builder: &mut MethodsBuilder) {
/// You should store the result of this function call for further usage in the code rather than calling
/// `resolved_attrs_eager()` each time you need all the resolved attrs.
///
/// Right now, it is not recommended to use this method. Instead, use `get_attr` and `get_attrs` methods.
/// We will deprecate this method in the future.
///
/// Sample usage:
/// ```text
/// def _impl_resolved_attrs_eager(ctx):
Expand Down
2 changes: 2 additions & 0 deletions app/buck2_bxl/src/bxl/starlark_defs/nodes/unconfigured.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ impl<'a> UnpackValue<'a> for StarlarkTargetNode {
#[starlark_module]
fn target_node_value_methods(builder: &mut MethodsBuilder) {
/// Gets the coerced attributes from the unconfigured target node. Returns a struct.
/// Right now, it is not recommended to use this method. Instead, use `get_attr` and `get_attrs` methods.
/// We will deprecate this method in the future.
///
/// Sample usage:
/// ```text
Expand Down

0 comments on commit f454e81

Please sign in to comment.