From ce400405cf349afff89a34bb99d5fe6e15030acf Mon Sep 17 00:00:00 2001 From: Charles Mita Date: Wed, 20 Mar 2024 11:58:57 +0100 Subject: [PATCH] Migrate uses of struct.to_proto Reapplies https://github.com/tensorflow/tensorboard/pull/6778 after https://github.com/tensorflow/tensorboard/pull/6721 inadvertently reverted part of it. The "to_proto" method on Starlark structs is deprecated and shouldn't be used. Instead, the proto module's "encode_text" function should be used. (https://bazel.build/rules/lib/toplevel/proto) It, along with "to_json", can be disabled in Bazel using the flag --incompatible_struct_has_no_methods The underlying implementation is the same, so there should be no observable changes in final outputs. --- tensorboard/defs/web.bzl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tensorboard/defs/web.bzl b/tensorboard/defs/web.bzl index 23bf365703..8d756bbc28 100644 --- a/tensorboard/defs/web.bzl +++ b/tensorboard/defs/web.bzl @@ -112,7 +112,7 @@ def _tf_web_library(ctx): ], ) params_file = _new_file(ctx, "-params.pbtxt") - ctx.actions.write(output = params_file, content = params.to_proto()) + ctx.actions.write(output = params_file, content = proto.encode_text(params)) ctx.actions.write( is_executable = True, output = ctx.outputs.executable,