This commit is contained in:
aozhiwei 2022-03-07 14:41:57 +08:00
parent c382fabe3a
commit 725d70ebab

View File

@ -30,6 +30,24 @@ def printp_stderr(p):
except Exception as e:
print('build_pb stderr error:' + e)
def rebuild_impb():
pb_files = ['im_proto', 'im_msgid']
cpp_out = '../../third_party/framework/cpp/'
for proto_name in pb_files:
pb_file = proto_name
pb_dir = '../../third_party/framework/cpp/'
if not os.path.isfile(pb_dir + proto_name + '.pb.cc'):
cmd = 'protoc --proto_path=../../third_party/framework/cpp --cpp_out=%s ../../third_party/framework/cpp/%s.proto ' % (cpp_out, pb_file)
print(cmd)
os.system(cmd)
continue
s1 = os.stat(pb_dir + proto_name + '.pb.cc')
s2 = os.stat(pb_dir + proto_name + '.proto')
if s1.st_size <= 0 or s1.st_mtime < s2.st_mtime:
cmd = 'protoc --proto_path=../../third_party/framework/cpp --cpp_out=%s ../../third_party/framework/cpp/%s.proto ' % (cpp_out, pb_file)
print(cmd )
os.system(cmd)
def need_rebuild(pb_files):
for proto_name in pb_files:
if not os.path.isfile(proto_name + '.pb.cc'):
@ -115,6 +133,7 @@ parser.add_option(
if not options.nohooks:
repair_githooks()
rebuild_impb()
if need_rebuild(options.pb_files.split(',')):
rebuild(options.cpp_out, options.python_out, options.java_out, options.pb_files.split(','))
else: