Print a warning on unknown keyword arguments on build targets.

pull/15/head
Jussi Pakkanen 10 years ago
parent fcbe689561
commit 81a7c41799
  1. 33
      build.py

@ -15,6 +15,7 @@
import coredata import coredata
import environment import environment
import dependencies import dependencies
import mlog
import copy, os import copy, os
class InvalidArguments(coredata.MesonException): class InvalidArguments(coredata.MesonException):
@ -117,6 +118,31 @@ class ExtractedObjects():
self.srclist = srclist self.srclist = srclist
class BuildTarget(): 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): def __init__(self, name, subdir, is_cross, sources, objects, environment, kwargs):
self.name = name self.name = name
self.subdir = subdir self.subdir = subdir
@ -136,6 +162,13 @@ class BuildTarget():
self.process_sourcelist(sources) self.process_sourcelist(sources)
self.process_objectlist(objects) self.process_objectlist(objects)
self.process_kwargs(kwargs, environment) 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: if len(self.sources) == 0 and len(self.generated) == 0:
raise InvalidArguments('Build target %s has no sources.' % name) raise InvalidArguments('Build target %s has no sources.' % name)
self.validate_sources() self.validate_sources()

Loading…
Cancel
Save