Skip to content

Commit 2e0b945

Browse files
authored
Handle the removal of to_proto and to_json from struct (#1554)
Check that the names exist before trying to remove them from the list of fields on a struct. These methods do not exist if --incompatible_struct_has_no_methods is passed or if they have been removed in a future version of Bazel.
1 parent f123577 commit 2e0b945

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

scala/private/phases/phase_default_info.bzl

+4-2
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ def phase_default_info(ctx, p):
1717
runfiles.append(java_runtime.files)
1818

1919
phase_names = dir(p)
20-
phase_names.remove("to_json")
21-
phase_names.remove("to_proto")
20+
if "to_json" in phase_names:
21+
phase_names.remove("to_json")
22+
if "to_proto" in phase_names:
23+
phase_names.remove("to_proto")
2224
for phase_name in phase_names:
2325
phase = getattr(p, phase_name)
2426

0 commit comments

Comments
 (0)