aboutsummaryrefslogtreecommitdiff
path: root/lib/structs.bzl
diff options
context:
space:
mode:
Diffstat (limited to 'lib/structs.bzl')
-rw-r--r--lib/structs.bzl12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/structs.bzl b/lib/structs.bzl
index f291152..78066ad 100644
--- a/lib/structs.bzl
+++ b/lib/structs.bzl
@@ -25,10 +25,14 @@ def _to_dict(s):
transformation is only applied to the struct's fields and not to any
nested values.
"""
- attributes = dir(s)
- attributes.remove("to_json")
- attributes.remove("to_proto")
- return {key: getattr(s, key) for key in attributes}
+
+ # to_json()/to_proto() are disabled by --incompatible_struct_has_no_methods
+ # and will be removed entirely in a future Bazel release.
+ return {
+ key: getattr(s, key)
+ for key in dir(s)
+ if key != "to_json" and key != "to_proto"
+ }
structs = struct(
to_dict = _to_dict,