aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2019-07-12 17:38:55 +0200
committerPaolo Bonzini <pbonzini@redhat.com>2019-07-19 00:17:29 +0200
commited348b7da81dd05aaa7ac398ae9acc4b15bc2733 (patch)
tree51d84a271055315bfa4530d9d3db1d6c943b5c5f
parent8239d71025ad59e44e7ac7b43849554990efe9f9 (diff)
downloadmeson-ed348b7da81dd05aaa7ac398ae9acc4b15bc2733.zip
meson-ed348b7da81dd05aaa7ac398ae9acc4b15bc2733.tar.gz
meson-ed348b7da81dd05aaa7ac398ae9acc4b15bc2733.tar.bz2
backends: discover java/mono wrapper at generation time
Move the magic to execute jar and .exe files from "meson --internal exe" to the backend, so that "ninja -v" shows more clearly what is happening. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--mesonbuild/backend/backends.py4
-rw-r--r--mesonbuild/scripts/meson_exe.py30
2 files changed, 14 insertions, 20 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py
index 8328c57..5316d45 100644
--- a/mesonbuild/backend/backends.py
+++ b/mesonbuild/backend/backends.py
@@ -355,6 +355,10 @@ class Backend:
'check the command and/or add it to PATH.'
raise MesonException(msg.format(exe_wrapper.name, tname))
else:
+ if exe_cmd[0].endswith('.jar'):
+ exe_cmd = ['java', '-jar'] + exe_cmd
+ elif exe_cmd[0].endswith('.exe') and not (mesonlib.is_windows() or mesonlib.is_cygwin()):
+ exe_cmd = ['mono'] + exe_cmd
exe_wrapper = None
force_serialize = force_serialize or extra_paths or workdir or \
diff --git a/mesonbuild/scripts/meson_exe.py b/mesonbuild/scripts/meson_exe.py
index e5bc9dc..c7efa7f 100644
--- a/mesonbuild/scripts/meson_exe.py
+++ b/mesonbuild/scripts/meson_exe.py
@@ -38,28 +38,18 @@ def is_cygwin():
platname = platform.system().lower()
return 'cygwin' in platname
-def run_with_mono(fname):
- if fname.endswith('.exe') and not (is_windows() or is_cygwin()):
- return True
- return False
-
def run_exe(exe):
- if exe.fname[0].endswith('.jar'):
- cmd = ['java', '-jar'] + exe.fname
- elif not exe.is_cross and run_with_mono(exe.fname[0]):
- cmd = ['mono'] + exe.fname
- else:
- if exe.is_cross and exe.needs_exe_wrapper:
- if exe.exe_runner is None:
- raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} '
- 'with no wrapper'.format(exe.name))
- elif not exe.exe_runner.found():
- raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found '
- 'wrapper {!r}'.format(exe.name, exe.exe_runner.get_path()))
- else:
- cmd = exe.exe_runner.get_command() + exe.fname
+ if exe.is_cross and exe.needs_exe_wrapper:
+ if exe.exe_runner is None:
+ raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} '
+ 'with no wrapper'.format(exe.name))
+ elif not exe.exe_runner.found():
+ raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found '
+ 'wrapper {!r}'.format(exe.name, exe.exe_runner.get_path()))
else:
- cmd = exe.fname
+ cmd = exe.exe_runner.get_command() + exe.fname
+ else:
+ cmd = exe.fname
child_env = os.environ.copy()
child_env.update(exe.env)
if exe.extra_paths: