proto generation updates (#4653)

This commit is contained in:
Jesse Hills authored and GitHub committed 2023-06-12 17:00:34 +12:00
1 parent 0a407c5425
commit f7c0ec6595
3 files changed
+37

No files matched your search

+18
View File
@@ -36,6 +36,24 @@
] ]
} }
] ]
},
{
"label": "Generate proto files",
"type": "shell",
"command": "${command:python.interpreterPath}",
"args": [
"./script/api_protobuf/api_protobuf.py"
],
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"reveal": "never",
"close": true,
"panel": "new"
},
"problemMatcher": []
} }
] ]
} }
+2
View File
@@ -11,3 +11,5 @@ pytest-mock==3.10.0
pytest-asyncio==0.21.0 pytest-asyncio==0.21.0
asyncmock==0.4.2 asyncmock==0.4.2
hypothesis==5.49.0 hypothesis==5.49.0
clang-format==13.0.1 ; platform_machine != 'armv7l'
+17
View File
@@ -18,6 +18,7 @@ will be generated, they still need to be formatted
""" """
import re import re
import os
from pathlib import Path from pathlib import Path
from textwrap import dedent from textwrap import dedent
from subprocess import call from subprocess import call
@@ -944,3 +945,19 @@ with open(root / "api_pb2_service.cpp", "w") as f:
f.write(cpp) f.write(cpp)
prot.unlink() prot.unlink()
try:
import clang_format
def exec_clang_format(path):
clang_format_path = os.path.join(
os.path.dirname(clang_format.__file__), "data", "bin", "clang-format"
)
call([clang_format_path, "-i", path])
exec_clang_format(root / "api_pb2_service.h")
exec_clang_format(root / "api_pb2_service.cpp")
exec_clang_format(root / "api_pb2.h")
exec_clang_format(root / "api_pb2.cpp")
except ImportError:
pass