Skip to content

Commit

Permalink
Resuscitate import-protobuf-protos
Browse files Browse the repository at this point in the history
Make it able to find the version again from recent protobuf repos.
  • Loading branch information
tomas-abrahamsson committed Dec 12, 2023
1 parent edda100 commit 349bbc5
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions helpers/import-protobuf-protos
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,26 @@ cd "$repotop"
echo

protobuf_shortsha=$(cd "$local_protobuf_repo" && git log -1 --format="%h")
protobuf_version=$(cat "$local_protobuf_repo"/CHANGES.txt | \
awk '/.* version .*/ { \
if [ -f "$local_protobuf_repo"/CMakeLists.txt ]
then
protobuf_version=$(grep set.protobuf_VERSION_STRING \
"$local_protobuf_repo"/CMakeLists.txt | \
cut -d'"' -f2)
elif [ -f "$local_protobuf_repo"/CHANGES.txt ]
then
protobuf_version=$(cat "$local_protobuf_repo"/CHANGES.txt | \
awk '/.* version .*/ { \
for (i=1;i<NF;i++) \
if ($i == "version") { \
print $(i+1); \
exit(0); \
} \
}')
else
printf 'Unable to automatically determine the version of protobuf,\n'
printf 'please specify the version of protobuf: '
read protobuf_version
fi

echo "Local protobuf repo info:"
echo " version: " "$protobuf_version"
Expand All @@ -51,6 +63,7 @@ import_proto () {

cat > "$dest" <<EOF
// This file is imported from protobuf $protobuf_version ($protobuf_shortsha)
//
EOF
cat "$f" >> "$dest"
Expand Down

0 comments on commit 349bbc5

Please sign in to comment.