aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorElliott Sales de Andrade <quantum.analyst@gmail.com>2017-04-30 04:44:47 -0400
committerElliott Sales de Andrade <quantum.analyst@gmail.com>2017-05-05 17:23:36 -0400
commitbbcf0c0550f5faf93c97b75b505f4c0f0757e802 (patch)
treebb7746d957fc76dc8083f42d126b4a71399a0aaf
parentabd02b3eae13e151143f64164c65571da4ff2d42 (diff)
downloadmeson-bbcf0c0550f5faf93c97b75b505f4c0f0757e802.zip
meson-bbcf0c0550f5faf93c97b75b505f4c0f0757e802.tar.gz
meson-bbcf0c0550f5faf93c97b75b505f4c0f0757e802.tar.bz2
Serialize CustomTargets with newlines in command.
-rw-r--r--mesonbuild/backend/ninjabackend.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index af93856..dad752b 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -38,8 +38,11 @@ else:
rmfile_prefix = 'rm -f {} &&'
def ninja_quote(text):
- for char in ('$', ' ', ':', '\n'):
+ for char in ('$', ' ', ':'):
text = text.replace(char, '$' + char)
+ if '\n' in text:
+ raise MesonException('Ninja does not support newlines in rules. '
+ 'Please report this error with a test case to the Meson bug tracker.')
return text
@@ -482,12 +485,16 @@ int dummy;
# If the target requires capturing stdout, then use the serialized
# executable wrapper to capture that output and save it to a file.
#
+ # If the command line requires a newline, also use the wrapper, as
+ # ninja does not support them in its build rule syntax.
+ #
# Windows doesn't have -rpath, so for EXEs that need DLLs built within
# the project, we need to set PATH so the DLLs are found. We use
# a serialized executable wrapper for that and check if the
# CustomTarget command needs extra paths first.
- if target.capture or ((mesonlib.is_windows() or mesonlib.is_cygwin()) and
- self.determine_windows_extra_paths(target.command[0])):
+ if (target.capture or any('\n' in c for c in cmd) or
+ ((mesonlib.is_windows() or mesonlib.is_cygwin()) and
+ self.determine_windows_extra_paths(target.command[0]))):
exe_data = self.serialize_executable(target.command[0], cmd[1:],
# All targets are built from the build dir
self.environment.get_build_dir(),