Maintain header order in merge_csv am: 84c1cdf31f
am: 95d8ad47f0
Original change: https://android-review.googlesource.com/c/platform/build/soong/+/1731412 Change-Id: Ib52bb2a863cc4ee5718a3a3abc6c97f524510fd3
This commit is contained in:
commit
e89bca33be
2 changed files with 4 additions and 4 deletions
|
@ -219,7 +219,6 @@ func buildRuleToGenerateIndex(ctx android.ModuleContext, desc string, classesJar
|
|||
BuiltTool("merge_csv").
|
||||
Flag("--zip_input").
|
||||
Flag("--key_field signature").
|
||||
FlagWithArg("--header=", "signature,file,startline,startcol,endline,endcol,properties").
|
||||
FlagWithOutput("--output=", indexCSV).
|
||||
Inputs(classesJars)
|
||||
rule.Build(desc, desc)
|
||||
|
|
|
@ -55,14 +55,15 @@ else:
|
|||
if entry.endswith('.uau'):
|
||||
csv_readers.append(dict_reader(io.TextIOWrapper(zip.open(entry, 'r'))))
|
||||
|
||||
headers = set()
|
||||
if args.header:
|
||||
fieldnames = args.header.split(',')
|
||||
else:
|
||||
headers = {}
|
||||
# Build union of all columns from source files:
|
||||
for reader in csv_readers:
|
||||
headers = headers.union(reader.fieldnames)
|
||||
fieldnames = sorted(headers)
|
||||
for fieldname in reader.fieldnames:
|
||||
headers[fieldname] = ""
|
||||
fieldnames = list(headers.keys())
|
||||
|
||||
# By default chain the csv readers together so that the resulting output is
|
||||
# the concatenation of the rows from each of them:
|
||||
|
|
Loading…
Reference in a new issue