Tweak generate_build_files.py output to pass gn's formatter

Chromium's presubmits check for files to be correctly formatted. While
this is automatically generated, the tooling doesn't know this. Just
output in the format it expects, which is that length 0 and length one
lists are formatted differently.

Change-Id: I3c5bec884db302f780c5c53429dfe26cb4731d58
Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/65828
Reviewed-by: Bob Beck <bbe@google.com>
Auto-Submit: David Benjamin <davidben@google.com>
Reviewed-by: Adam Langley <agl@google.com>
Commit-Queue: David Benjamin <davidben@google.com>
This commit is contained in:
David Benjamin
2024-01-26 19:02:14 +00:00
committed by Boringssl LUCI CQ
parent 8378dad8af
commit 625f68bf35
+9 -4
View File
@@ -339,10 +339,15 @@ class GN(object):
out.write('\n')
self.firstSection = False
out.write('%s = [\n' % name)
for f in sorted(files):
out.write(' "%s",\n' % f)
out.write(']\n')
if len(files) == 0:
out.write('%s = []\n' % name)
elif len(files) == 1:
out.write('%s = [ "%s" ]\n' % (name, files[0]))
else:
out.write('%s = [\n' % name)
for f in sorted(files):
out.write(' "%s",\n' % f)
out.write(']\n')
def WriteFiles(self, files):
with open('BUILD.generated.gni', 'w+') as out: