Updated amalgamator to avoid duplicating license blocks.

pull/13171/head
Joshua Haberman 4 years ago
parent dda5416569
commit 4f1e48ecc6
  1. 13
      tools/amalgamate.py

@ -47,7 +47,6 @@ class Amalgamator:
self.output_c.write(open("upb/port_def.inc").read()) self.output_c.write(open("upb/port_def.inc").read())
self.output_h.write("/* Amalgamated source file */\n") self.output_h.write("/* Amalgamated source file */\n")
self.output_h.write('#include <stdint.h>')
self.output_h.write(open("upb/port_def.inc").read()) self.output_h.write(open("upb/port_def.inc").read())
def add_include_path(self, path): def add_include_path(self, path):
@ -69,7 +68,17 @@ class Amalgamator:
if not file: if not file:
raise RuntimeError("Couldn't open file " + infile_name) raise RuntimeError("Couldn't open file " + infile_name)
for line in file: lines = file.readlines()
has_copyright = lines[1].startswith(" * Copyright")
if has_copyright:
while not lines[0].startswith(" */"):
lines.pop(0)
lines.pop(0)
lines.insert(0, "\n/** " + infile_name + " " + ("*" * 60) +"/");
for line in lines:
if not self._process_include(line, outfile): if not self._process_include(line, outfile):
outfile.write(line) outfile.write(line)

Loading…
Cancel
Save