-
Notifications
You must be signed in to change notification settings - Fork 13
Expand file tree
/
Copy pathupdateprotos.sh
More file actions
executable file
·33 lines (33 loc) · 927 Bytes
/
updateprotos.sh
File metadata and controls
executable file
·33 lines (33 loc) · 927 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
PROJ_BASE=$PWD
TF=/tmp/tf
PTF=/tmp/ptf
OUTP=/tmp/pbout
VERSION=`cat PROTO_VERSION`
rm -rf $TF
rm -rf $PTF
rm -rf $OUTP
mkdir $OUTP
if [[ $OSTYPE =~ darwin* ]]; then
brew install protobuf
brew upgrade protobuf
brew link --overwrite protobuf
else
sudo apt-get install protobuf-compiler
fi
git clone "https://github.com/tensorflow/tensorflow.git" $TF
pushd $TF
git checkout tags/v$VERSION
popd
git clone "https://github.com/apple/swift-protobuf.git" $PTF
pushd ./
cd $PTF
swift build -c release
popd
find $TF -type f -iname "*.proto" -print0 | while IFS= read -r -d $'\0' LINE; do
protoc --plugin=$PTF/.build/release/protoc-gen-swift --swift_opt=Visibility=Public --swift_out=$OUTP --proto_path=$TF $LINE
done
find $OUTP -type f -iname "*.pb.swift" -print0 | while IFS= read -r -d $'\0' LINE; do
FILE=$(basename $LINE)
DEST=$(sed 's#.pb.swift#.swift#g' <<< $FILE)
cp $LINE Sources/PerfectTensorFlow/pb.$DEST
done