mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-01-13 15:56:23 +01:00
codegen: List basenames of input files in generated preamble
This makes it a bit easier for debugging which files were generated from which introspection XML. Signed-off-by: Philip Withnall <withnall@endlessm.com> https://bugzilla.gnome.org/show_bug.cgi?id=650875
This commit is contained in:
parent
807648663d
commit
1217b1bc4f
@ -29,7 +29,7 @@ from . import dbustypes
|
||||
from .utils import print_error
|
||||
|
||||
LICENSE_STR = '''/*
|
||||
* Generated by gdbus-codegen {!s}. DO NOT EDIT.
|
||||
* Generated by gdbus-codegen {!s} from {!s}. DO NOT EDIT.
|
||||
*
|
||||
* The license of this code is the same as for the D-Bus interface description
|
||||
* it was derived from.
|
||||
@ -53,19 +53,22 @@ def generate_namespace(namespace):
|
||||
|
||||
class HeaderCodeGenerator:
|
||||
def __init__(self, ifaces, namespace, generate_objmanager,
|
||||
generate_autocleanup, header_name, use_pragma, outfile):
|
||||
generate_autocleanup, header_name, input_files_basenames,
|
||||
use_pragma, outfile):
|
||||
self.ifaces = ifaces
|
||||
self.namespace, self.ns_upper, self.ns_lower = generate_namespace(namespace)
|
||||
self.generate_objmanager = generate_objmanager
|
||||
self.generate_autocleanup = generate_autocleanup
|
||||
self.header_guard = header_name.upper().replace('.', '_').replace('-', '_').replace('/', '_').replace(':', '_')
|
||||
self.input_files_basenames = input_files_basenames
|
||||
self.use_pragma = use_pragma
|
||||
self.outfile = outfile
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
def generate_header_preamble(self):
|
||||
self.outfile.write(LICENSE_STR.format(config.VERSION))
|
||||
basenames = ', '.join(self.input_files_basenames)
|
||||
self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
|
||||
self.outfile.write('\n')
|
||||
|
||||
if self.use_pragma:
|
||||
@ -612,18 +615,20 @@ class HeaderCodeGenerator:
|
||||
|
||||
class CodeGenerator:
|
||||
def __init__(self, ifaces, namespace, generate_objmanager, header_name,
|
||||
docbook_gen, outfile):
|
||||
input_files_basenames, docbook_gen, outfile):
|
||||
self.ifaces = ifaces
|
||||
self.namespace, self.ns_upper, self.ns_lower = generate_namespace(namespace)
|
||||
self.generate_objmanager = generate_objmanager
|
||||
self.header_name = header_name
|
||||
self.input_files_basenames = input_files_basenames
|
||||
self.docbook_gen = docbook_gen
|
||||
self.outfile = outfile
|
||||
|
||||
# ----------------------------------------------------------------------------------------------------
|
||||
|
||||
def generate_body_preamble(self):
|
||||
self.outfile.write(LICENSE_STR.format(config.VERSION))
|
||||
basenames = ', '.join(self.input_files_basenames)
|
||||
self.outfile.write(LICENSE_STR.format(config.VERSION, basenames))
|
||||
self.outfile.write('\n')
|
||||
self.outfile.write('#ifdef HAVE_CONFIG_H\n'
|
||||
'# include "config.h"\n'
|
||||
|
@ -212,11 +212,13 @@ def codegen_main():
|
||||
header_name = os.path.splitext(c_file)[0] + '.h'
|
||||
|
||||
all_ifaces = []
|
||||
input_files_basenames = []
|
||||
for fname in args.files + args.xml_files:
|
||||
with open(fname, 'rb') as f:
|
||||
xml_data = f.read()
|
||||
parsed_ifaces = parser.parse_dbus_xml(xml_data)
|
||||
all_ifaces.extend(parsed_ifaces)
|
||||
input_files_basenames.append(os.path.basename(fname))
|
||||
|
||||
if args.annotate != None:
|
||||
apply_annotations(all_ifaces, args.annotate)
|
||||
@ -236,6 +238,7 @@ def codegen_main():
|
||||
args.c_generate_object_manager,
|
||||
args.c_generate_autocleanup,
|
||||
header_name,
|
||||
input_files_basenames,
|
||||
args.pragma_once,
|
||||
outfile)
|
||||
gen.generate()
|
||||
@ -246,6 +249,7 @@ def codegen_main():
|
||||
args.c_namespace,
|
||||
args.c_generate_object_manager,
|
||||
header_name,
|
||||
input_files_basenames,
|
||||
docbook_gen,
|
||||
outfile)
|
||||
gen.generate()
|
||||
|
Loading…
Reference in New Issue
Block a user