File size: 1,380 Bytes
3932407
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/env bash
# Some gRPC files in this repository are generated and based upon other
# sources. When these sources change, the generated files must be generated
# (and committed) again. It is the task of the contributing user to do this
# properly.
#
# This tests makes sure the generated gRPC files are consistent with its
# sources. If this fails, you probably have to generate the gRPC files again.
#
# Read more here: https://github.com/qdrant/qdrant/blob/master/docs/DEVELOPMENT.md#grpc

set -ex

# Ensure current path is project root
cd "$(dirname "$0")/../"

# Keep current version of file to check
cp ./lib/api/src/grpc/{,.diff.}qdrant.rs
cp ./docs/grpc/{,.diff.}docs.md

# Regenerate gRPC files
touch ./lib/api/src/grpc/proto/.build-trigger.proto
cargo build --package api

# Regenerate gRPC docs
./tools/generate_grpc_docs.sh

# Ensure generated files are the same as files in this repository
if diff -Zwa ./lib/api/src/grpc/{,.diff.}qdrant.rs \
&& diff -Zwa ./docs/grpc/{,.diff.}docs.md
then
    set +x
    echo "No diff found."
else
    set +x
    echo "ERROR: Generated gRPC file is not consistent with files in this repository, see diff above."
    echo "ERROR: See: https://github.com/qdrant/qdrant/blob/master/docs/DEVELOPMENT.md#grpc"
    exit 1
fi

# Cleanup
rm -f ./lib/api/src/grpc/{.diff.qdrant.rs,proto/.build-trigger.proto} ./docs/grpc/.diff.docs.md