agent/protocols: Stop generate agent proto files in the shellscript

Because the job has been done by build.rs.

Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
Tim Zhang 2020-10-22 14:27:42 +08:00 committed by Julio Montes
parent ca8f1399ca
commit 359f76d209

View File

@ -64,25 +64,6 @@ $GOPATH/src/github.com/kata-containers/kata-containers/src/agent/protocols/proto
[ $? -eq 0 ] || die "Failed to generate golang file from $1"
}
generate_rust_sources() {
local cmd="protoc --rust_out=./protocols/src/ \
--ttrpc_out=./protocols/src/,plugins=ttrpc:./protocols/src/ \
--plugin=protoc-gen-ttrpc=`which ttrpc_rust_plugin` \
-I $GOPATH/src/github.com/kata-containers/agent/vendor/github.com/gogo/protobuf:$GOPATH/src/github.com/kata-containers/agent/vendor:$GOPATH/src/github.com/gogo/protobuf:$GOPATH/src/github.com/gogo/googleapis:$GOPATH/src:$GOPATH/src/github.com/kata-containers/kata-containers/src/agent/protocols/protos \
$GOPATH/src/github.com/kata-containers/kata-containers/src/agent/protocols/protos/$1"
echo $cmd
$cmd
[ $? -eq 0 ] || die "Failed to generate rust file from $1"
if [ "$1" = "oci.proto" ]; then
# Need change Box<Self> to ::std::boxed::Box<Self> because there is another struct Box
sed 's/fn into_any(self: Box<Self>) -> ::std::boxed::Box<::std::any::Any> {/fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<::std::any::Any> {/g' ./protocols/src/oci.rs > ./protocols/src/new_oci.rs
sed 's/fn into_any(self: Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {/fn into_any(self: ::std::boxed::Box<Self>) -> ::std::boxed::Box<dyn (::std::any::Any)> {/g' ./protocols/src/oci.rs > ./protocols/src/new_oci.rs
mv ./protocols/src/new_oci.rs ./protocols/src/oci.rs
fi;
}
if [ "$(basename $(pwd))" != "agent" ]; then
die "Please go to directory of protocols before execute this shell"
fi
@ -118,10 +99,6 @@ if [ "$target" = "all" ]; then
echo -e "\n [golang] compiling ${f} ..."
generate_go_sources $f
echo -e " [golang] ${f} compiled\n"
echo -e "\n [rust] compiling ${f} ..."
generate_rust_sources $f
echo -e " [rust] ${f} compiled\n"
done
else
# compile individual proto file
@ -130,10 +107,6 @@ else
echo -e "\n [golang] compiling ${target} ..."
generate_go_sources $target
echo -e " [golang] ${target} compiled\n"
echo -e "\n [rust] compiling ${target} ..."
generate_rust_sources $target
echo -e " [rust] ${target} compiled\n"
fi
done
fi;