aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/backend/ninjabackend.py
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2018-07-09 04:02:02 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2018-07-09 05:39:40 +0530
commite8dae2b966498207867cb07d58f4404b76c087ce (patch)
tree5ee7e334660dd3409e9af474861ba43147d0b309 /mesonbuild/backend/ninjabackend.py
parent416a00308f5b0f228af3c93eb597eca8529fdbb0 (diff)
downloadmeson-e8dae2b966498207867cb07d58f4404b76c087ce.zip
meson-e8dae2b966498207867cb07d58f4404b76c087ce.tar.gz
meson-e8dae2b966498207867cb07d58f4404b76c087ce.tar.bz2
cross: Be more permissive about not-found exe_wrapper
We used to immediately try to use whatever exe_wrapper was defined in the cross file, but some people generate the cross file once and use it for several projects, most of which do not even need an exe wrapper to build. Now we're a bit more resilient. We quietly fall back to using non-exe-wrapper paths for compiler checks and skip the sanity check. However, if some code needs the exe wrapper, f.ex., if you run a built executable using custom_target() or run_target(), we will error out during setup. Tests will, of course, continue to error out when you run them if the exe wrapper was not found. We don't want people's tests to silently "pass" (aka skip) because of a bad CI setup. Closes https://github.com/mesonbuild/meson/issues/3562 This commit also adds a test for the behaviour of exe_wrapper in these cases, and refactors the unit tests a bit for it.
Diffstat (limited to 'mesonbuild/backend/ninjabackend.py')
-rw-r--r--mesonbuild/backend/ninjabackend.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index f62bc67..eed40bc 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -541,7 +541,7 @@ int dummy;
if extra_paths:
serialize = True
if serialize:
- exe_data = self.serialize_executable(target.command[0], cmd[1:],
+ exe_data = self.serialize_executable(target.name, target.command[0], cmd[1:],
# All targets are built from the build dir
self.environment.get_build_dir(),
extra_paths=extra_paths,
@@ -598,6 +598,11 @@ int dummy;
if self.environment.is_cross_build():
exe_wrap = self.environment.get_exe_wrapper()
if exe_wrap:
+ if not exe_wrap.found():
+ msg = 'The exe_wrapper {!r} defined in the cross file is ' \
+ 'needed by run target {!r}, but was not found. ' \
+ 'Please check the command and/or add it to PATH.'
+ raise MesonException(msg.format(exe_wrap.name, target.name))
cmd += exe_wrap.get_command()
cmd.append(abs_exe)
elif isinstance(texe, dependencies.ExternalProgram):
@@ -1932,6 +1937,7 @@ rule FORTRAN_DEP_HACK%s
cmdlist = exe_arr + self.replace_extra_args(args, genlist)
if generator.capture:
exe_data = self.serialize_executable(
+ 'generator ' + cmdlist[0],
cmdlist[0],
cmdlist[1:],
self.environment.get_build_dir(),