Print a warning on unknown keyword arguments on build targets.
This commit is contained in:
parent
fcbe689561
commit
81a7c41799
33
build.py
33
build.py
|
@ -15,6 +15,7 @@
|
|||
import coredata
|
||||
import environment
|
||||
import dependencies
|
||||
import mlog
|
||||
import copy, os
|
||||
|
||||
class InvalidArguments(coredata.MesonException):
|
||||
|
@ -117,6 +118,31 @@ class ExtractedObjects():
|
|||
self.srclist = srclist
|
||||
|
||||
class BuildTarget():
|
||||
# All keyword arguments that we know how to handle.
|
||||
known_kwargs = {'ui_files': True,
|
||||
'moc_headers' : True,
|
||||
'qresources' : True,
|
||||
'moc_sources' : True,
|
||||
'install' : True,
|
||||
'c_pch' : True,
|
||||
'cpp_pch' : True,
|
||||
'c_args' : True,
|
||||
'cpp_args' : True,
|
||||
'cs_args' : True,
|
||||
'link_args' : True,
|
||||
'link_depends': True,
|
||||
'include_directories': True,
|
||||
'dependencies' : True,
|
||||
'install_dir' : True,
|
||||
'main_class' : True,
|
||||
'gui_app' : True,
|
||||
'extra_files' : True,
|
||||
'install_rpath' : True,
|
||||
'resources' : True,
|
||||
'sources' : True,
|
||||
'objects' : True,
|
||||
}
|
||||
|
||||
def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
|
||||
self.name = name
|
||||
self.subdir = subdir
|
||||
|
@ -136,6 +162,13 @@ class BuildTarget():
|
|||
self.process_sourcelist(sources)
|
||||
self.process_objectlist(objects)
|
||||
self.process_kwargs(kwargs, environment)
|
||||
unknowns = []
|
||||
for k in kwargs:
|
||||
if not k in BuildTarget.known_kwargs:
|
||||
unknowns.append(k)
|
||||
if len(unknowns) > 0:
|
||||
mlog.log(mlog.bold('Warning:'), 'Unknown keyword argument(s) in target %s: %s.' %
|
||||
(self.name, ', '.join(unknowns)))
|
||||
if len(self.sources) == 0 and len(self.generated) == 0:
|
||||
raise InvalidArguments('Build target %s has no sources.' % name)
|
||||
self.validate_sources()
|
||||
|
|
Loading…
Reference in New Issue