Skip to content

Commit 6be2464

Browse files
authored
Bring proto update script up to date to deal with new protos in TF2.11 (#5997)
* Motivation for features / changes In TF 2.11 the tensorflow/tsl/protobuf directory is created(https://github.com/tensorflow/tensorflow/tree/master/tensorflow/tsl/protobuf). This directory has a histogram.proto file which is referenced from summary.proto(https://github.com/tensorflow/tensorflow/blob/master/tensorflow/core/framework/summary.proto#L5). Additionally that proto is imported with the public keyword which we previously were not looking for.
1 parent a8332c0 commit 6be2464

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tensorboard/compat/proto/update.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ rsync --existing "$1"/tensorflow/core/protobuf/*.proto tensorboard/compat/proto/
2626
rsync --existing "$1"/tensorflow/core/profiler/*.proto tensorboard/compat/proto/
2727
rsync --existing "$1"/tensorflow/core/util/*.proto tensorboard/compat/proto/
2828
rsync --existing "$1"/tensorflow/python/framework/*.proto tensorboard/compat/proto/
29+
if [ -d " "$1"/tensorflow/tsl/protobuf" ] # This directory first appears in TF 2.11
30+
then
31+
rsync --existing "$1"/tensorflow/tsl/protobuf/*.proto tensorboard/compat/proto/
32+
fi
2933

3034
# Rewrite file paths and package names and disable LINT checks.
3135
find tensorboard/compat/proto/ -type f -name '*.proto' -exec perl -pi \
@@ -34,6 +38,7 @@ find tensorboard/compat/proto/ -type f -name '*.proto' -exec perl -pi \
3438
-e 's|tensorflow/core/profiler|tensorboard/compat/proto|g;' \
3539
-e 's|tensorflow/core/util|tensorboard/compat/proto|g;' \
3640
-e 's|tensorflow/python/framework|tensorboard/compat/proto|g;' \
41+
-e 's|tensorflow/tsl/protobuf|tensorboard/compat/proto|g;' \
3742
-e 's|package tensorflow.tfprof;|package tensorboard;|g;' \
3843
-e 's|package tensorflow;|package tensorboard;|g;' \
3944
-e 's|tensorflow\.DataType|tensorboard.DataType|g;' \
@@ -60,9 +65,9 @@ find tensorboard/compat/proto/ -type f -name '*.proto' -exec perl -pi \
6065
printf 'tb_proto_library(\n'
6166
printf ' name = "%s",\n' "${f%.proto}"
6267
printf ' srcs = ["%s"],\n' "$f"
63-
if grep -q '^import "tensorboard/' "$f"; then
68+
if grep -q '^import\( public\)* "tensorboard/' "$f"; then
6469
printf ' deps = [\n'
65-
grep '^import "tensorboard/' "$f" | sort |
70+
grep '^import\( public\)* "tensorboard/' "$f" | sort |
6671
sed -e 's#.*compat/proto/\([^.]*\).*# ":\1",#'
6772
printf ' ],\n'
6873
fi

0 commit comments

Comments
 (0)