conv_linker_config proto works with empty input

PRODUCT_VENDOR_LINKER_CONFIG_FRAGMENTS lists json files for vendor
linker config. It's annoying to handle the case of empty list.

`proto` subcommand now works for empty input. This is useful to generate
the empty linker config.

Bug: 244531518
Test: conv_linker_config proto --source --output output.pb
Change-Id: Iec6de67a979814a818730c393d9a4a7ca5d2eebe
This commit is contained in:
Jooyung Han
2023-03-04 08:28:40 +09:00
parent aa3408a506
commit b531beecd5

View File

@@ -28,6 +28,7 @@ from google.protobuf.text_format import MessageToString
def Proto(args): def Proto(args):
pb = linker_config_pb2.LinkerConfig() pb = linker_config_pb2.LinkerConfig()
if args.source:
for input in args.source.split(':'): for input in args.source.split(':'):
json_content = '' json_content = ''
with open(input) as f: with open(input) as f:
@@ -104,7 +105,7 @@ def GetArgParser():
parser_proto.add_argument( parser_proto.add_argument(
'-s', '-s',
'--source', '--source',
required=True, nargs='?',
type=str, type=str,
help='Colon-separated list of linker configuration files in JSON.') help='Colon-separated list of linker configuration files in JSON.')
parser_proto.add_argument( parser_proto.add_argument(