naiveproxy/third_party/protobuf/gen_extra_chromium_files
2018-12-09 21:59:24 -05:00

23 lines
699 B
Python
Executable File

#!/usr/bin/env python
import os
src_dir = os.path.abspath(os.path.join(os.path.dirname(__file__),'..','..'))
def r(c):
print c
os.system(c)
os.chdir(src_dir)
r('gn gen out/Debug')
r('ninja -C out/Debug js_embed')
os.chdir('third_party/protobuf/src/google/protobuf/compiler/js')
js_embed = os.path.join(src_dir,'out/Debug/js_embed')
r('{} ./well_known_types/any.js ./well_known_types/struct.js \
./well_known_types/timestamp.js > well_known_types_embed.cc'.format(js_embed))
os.chdir(src_dir)
r('ninja -C out/Debug protoc')
os.chdir('third_party/protobuf/src')
protoc = os.path.join(src_dir,'out/Debug/protoc')
r('{} --python_out=../python google/protobuf/descriptor.proto'.format(protoc))