Skip to content

Commit

Permalink
Handle the removal of to_proto and to_json from struct (#1554)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
c-mita committed Mar 21, 2024
1 parent f123577 commit 2e0b945
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions scala/private/phases/phase_default_info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ def phase_default_info(ctx, p):
runfiles.append(java_runtime.files)

phase_names = dir(p)
phase_names.remove("to_json")
phase_names.remove("to_proto")
if "to_json" in phase_names:
phase_names.remove("to_json")
if "to_proto" in phase_names:
phase_names.remove("to_proto")
for phase_name in phase_names:
phase = getattr(p, phase_name)

Expand Down

0 comments on commit 2e0b945

Please sign in to comment.