-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.sh
executable file
·55 lines (49 loc) · 2.04 KB
/
build.sh
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
44
45
46
47
48
49
50
51
52
53
54
55
# Compile for blue-sdk-go.
echo "Compiling proto files..." && buf generate
# Compile services for blue-sdk-python; with grpc.
echo "Compiling Python GRPC services..."
mkdir -p generated/py/alphausblue
python3 -m grpc_tools.protoc -I . --python_out=./generated/py/alphausblue --grpc_python_out=./generated/py/alphausblue \
./org/v1/*.proto \
./kvstore/v1/*.proto \
./iam/v1/*.proto \
./admin/v1/*.proto \
./cost/v1/*.proto \
./billing/v1/*.proto \
./operations/v1/*.proto \
./cover/v1/*.proto \
./pricing/v1/*.proto \
./preferences/v1/*.proto
# Compile ./api/* for blue-sdk-python; without grpc.
echo "Compiling Python SDK data..."
python3 -m grpc_tools.protoc -I . --python_out=./generated/py/alphausblue \
$(for v in $(find ./api -type d); do echo -n "$v/*.proto "; done)
echo "Replacing implicit relative imports with absolute imports..."
for package in $(find generated/py/alphausblue -mindepth 1 -maxdepth 1 -type d -printf "%f "); do
echo "Found package ${package}. Beginning replacement"
find generated/py/alphausblue/. -name '*.py' -exec sed -i -e "s/from ${package}/from alphausblue.${package}/g" {} \;
done
echo "Creating Python package files..."
find generated/py/alphausblue/. -type d -exec touch {}/__init__.py \;
echo "Generating OpenAPI docs..."
protoc -I . --openapiv2_out ./openapiv2 --openapiv2_opt logtostderr=true --openapiv2_opt allow_merge=true \
./org/v1/*.proto \
./iam/v1/*.proto \
./admin/v1/*.proto \
./cost/v1/*.proto \
./billing/v1/*.proto \
./operations/v1/*.proto \
./cover/v1/*.proto \
./pricing/v1/*.proto \
./preferences/v1/*.proto
echo "Generating html docs..."
protoc --doc_out=./generated/ --doc_opt=html,index.html \
./org/v1/*.proto \
./iam/v1/*.proto \
./admin/v1/*.proto \
./cost/v1/*.proto \
./billing/v1/*.proto \
./operations/v1/*.proto \
./cover/v1/*.proto \
./pricing/v1/*.proto \
./preferences/v1/*.proto