aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2017-03-23 11:35:30 +0530
committerJussi Pakkanen <jpakkane@gmail.com>2017-03-23 16:38:03 -0400
commit53795d89df48ca722b018ff8720669deb6209be4 (patch)
treeb9ba2d48921b1d1b468d6800627776c80fbe044c
parentdf1480fe11e5d4f20b7305abc2129d3c6494d1b5 (diff)
downloadmeson-53795d89df48ca722b018ff8720669deb6209be4.zip
meson-53795d89df48ca722b018ff8720669deb6209be4.tar.gz
meson-53795d89df48ca722b018ff8720669deb6209be4.tar.bz2
vs: Always use a wrapper for custom target commands
Besides fixing output capture, it also fixes a strange bug in MSBuild where if the command list is too long, it will remove random characters from the command list before passing it to the command. Closes https://github.com/mesonbuild/meson/issues/1417
-rw-r--r--mesonbuild/backend/vs2010backend.py11
-rw-r--r--test cases/common/117 custom target capture/meson.build4
2 files changed, 10 insertions, 5 deletions
diff --git a/mesonbuild/backend/vs2010backend.py b/mesonbuild/backend/vs2010backend.py
index e1f7325..82c6463 100644
--- a/mesonbuild/backend/vs2010backend.py
+++ b/mesonbuild/backend/vs2010backend.py
@@ -403,7 +403,16 @@ class Vs2010Backend(backends.Backend):
# from the target dir, not the build root.
target.absolute_paths = True
(srcs, ofilenames, cmd) = self.eval_custom_target_command(target, True)
- ET.SubElement(customstep, 'Command').text = ' '.join(self.quote_arguments(cmd))
+ # Always use a wrapper because MSBuild eats random characters when
+ # there are many arguments.
+ tdir_abs = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
+ exe_data = self.serialise_executable(target.command[0], cmd[1:],
+ # All targets run from the target dir
+ tdir_abs,
+ capture=ofilenames[0] if target.capture else None)
+ wrapper_cmd = [sys.executable, self.environment.get_build_command(),
+ '--internal', 'exe', exe_data]
+ ET.SubElement(customstep, 'Command').text = ' '.join(self.quote_arguments(wrapper_cmd))
ET.SubElement(customstep, 'Outputs').text = ';'.join(ofilenames)
ET.SubElement(customstep, 'Inputs').text = ';'.join(srcs)
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.targets')
diff --git a/test cases/common/117 custom target capture/meson.build b/test cases/common/117 custom target capture/meson.build
index 16b6ac9..58a69ca 100644
--- a/test cases/common/117 custom target capture/meson.build
+++ b/test cases/common/117 custom target capture/meson.build
@@ -2,10 +2,6 @@ project('custom target', 'c')
python3 = import('python3').find_python()
-if meson.backend().startswith('vs')
- error('MESON_SKIP_TEST: capturing of custom target output is broken with the VS backends')
-endif
-
# Note that this will not add a dependency to the compiler executable.
# Code will not be rebuilt if it changes.
comp = '@0@/@1@'.format(meson.current_source_dir(), 'my_compiler.py')