-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
74 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
### Project | ||
|
||
- Removed Sonatype | ||
- Added python build scripts | ||
|
||
## v0.1.2 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
setlocal EnableDelayedExpansion | ||
|
||
rem Remove the 'stubs' directory if it exists, and create a new one | ||
if exist stubs ( | ||
rd /s /q stubs | ||
) | ||
mkdir stubs | ||
|
||
rem Base directory to start the search | ||
set baseDir=src\main\proto | ||
|
||
rem Find all .proto files in the specified directory and subdirectories | ||
set "protoFiles=" | ||
for /r %baseDir% %%f in (*.proto) do ( | ||
rem Get the relative path from the base directory | ||
set "relativePath=%%f" | ||
set "relativePath=!relativePath:%CD%\=!" | ||
set "protoFiles=!protoFiles! !relativePath!" | ||
) | ||
|
||
rem Run the grpc_tools.protoc command | ||
python -m grpc_tools.protoc ^ | ||
--python_out=stubs ^ | ||
--grpc_python_out=stubs ^ | ||
--proto_path=%baseDir% ^ | ||
--mypy_out=stubs ^ | ||
--experimental_allow_proto3_optional ^ | ||
!protoFiles! | ||
|
||
rem Invoke protol to fix broken imports | ||
protol ^ | ||
--create-package ^ | ||
--in-place ^ | ||
--python-out stubs ^ | ||
protoc --proto-path=%baseDir% !protoFiles! --experimental_allow_proto3_optional | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
#!/bin/bash | ||
|
||
echo Checkout pip requirements | ||
python -m venv venv | ||
venv/bin/pip install -r requirements.txt | ||
|
||
echo Search for proto files | ||
mapfile -d '' proto_src_files < <(find src/main/proto -name '*.proto' -print0) | ||
|
||
echo Remove old api files | ||
rm -rf api | ||
mkdir api | ||
|
||
echo Compile proto files | ||
venv/bin/python -m grpc_tools.protoc \ | ||
--python_out=api \ | ||
--grpc_python_out=api \ | ||
--proto_path=src/main/proto \ | ||
--plugin=protoc-gen-mypy=venv/bin/protoc-gen-mypy \ | ||
--mypy_out=api \ | ||
--experimental_allow_proto3_optional \ | ||
"${proto_src_files[@]}" | ||
|
||
# invoke proletariat to fix broken imports | ||
|
||
echo Fix paths | ||
venv/bin/protol \ | ||
--create-package \ | ||
--in-place \ | ||
--python-out api \ | ||
protoc --proto-path=src/main/proto "${proto_src_files[@]}" --experimental_allow_proto3_optional |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
protoletariat==3.2.19 | ||
mypy-protobuf==3.4.0 | ||
grpclib==0.4.6 | ||
grpcio-tools==1.59.3 | ||
protobuf==4.23.2 |