Check that non-existing source files cause errors.
This commit is contained in:
parent
d02e4ce1c9
commit
619b37bff9
|
@ -1178,11 +1178,20 @@ class Interpreter():
|
||||||
sources += kw_src
|
sources += kw_src
|
||||||
if name in self.build.targets:
|
if name in self.build.targets:
|
||||||
raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name)
|
raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name)
|
||||||
|
self.check_sources_exist(os.path.join(self.environment.source_dir, self.subdir), sources)
|
||||||
l = targetclass(name, self.subdir, sources, self.environment, kwargs)
|
l = targetclass(name, self.subdir, sources, self.environment, kwargs)
|
||||||
self.build.targets[name] = l
|
self.build.targets[name] = l
|
||||||
mlog.log('Creating build target "', mlog.bold(name), '" with %d files.' % len(sources), sep='')
|
mlog.log('Creating build target "', mlog.bold(name), '" with %d files.' % len(sources), sep='')
|
||||||
return l
|
return l
|
||||||
|
|
||||||
|
def check_sources_exist(self, subdir, sources):
|
||||||
|
for s in sources:
|
||||||
|
if not isinstance(s, str):
|
||||||
|
continue # This means a generated source and they always exist.
|
||||||
|
fname = os.path.join(subdir, s)
|
||||||
|
if not os.path.isfile(fname):
|
||||||
|
raise InterpreterException('Tried to add non-existing source %s.' % s)
|
||||||
|
|
||||||
def function_call(self, node):
|
def function_call(self, node):
|
||||||
func_name = node.get_function_name()
|
func_name = node.get_function_name()
|
||||||
(posargs, kwargs) = self.reduce_arguments(node.arguments)
|
(posargs, kwargs) = self.reduce_arguments(node.arguments)
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
project('missing file', 'c')
|
||||||
|
|
||||||
|
executable('prog', 'missing.c')
|
Loading…
Reference in New Issue