diff options
author | Jussi Pakkanen <jpakkane@gmail.com> | 2016-11-08 17:44:18 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-08 17:44:18 -0500 |
commit | 7408862db800a171eda419d8947be55c107832f2 (patch) | |
tree | 089b5a2cc2f4594b20bdd310cc437a2ad6c8409f /mesonbuild | |
parent | a2262103fb749b570c4096b43ee107ad7143c04e (diff) | |
parent | 377fe510033043555ed1824362f6db9935547707 (diff) | |
download | meson-7408862db800a171eda419d8947be55c107832f2.zip meson-7408862db800a171eda419d8947be55c107832f2.tar.gz meson-7408862db800a171eda419d8947be55c107832f2.tar.bz2 |
Merge pull request #1005 from centricular/javac-no-java
javac: Don't fail if there's no JVM
Diffstat (limited to 'mesonbuild')
-rw-r--r-- | mesonbuild/compilers.py | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py index 94e8a54..454cdba 100644 --- a/mesonbuild/compilers.py +++ b/mesonbuild/compilers.py @@ -12,6 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +import shutil import contextlib import subprocess, os.path import tempfile @@ -1274,11 +1275,20 @@ class JavaCompiler(Compiler): pc.wait() if pc.returncode != 0: raise EnvironmentException('Java compiler %s can not compile programs.' % self.name_string()) - cmdlist = [self.javarunner, obj] - pe = subprocess.Popen(cmdlist, cwd=work_dir) - pe.wait() - if pe.returncode != 0: - raise EnvironmentException('Executables created by Java compiler %s are not runnable.' % self.name_string()) + runner = shutil.which(self.javarunner) + if runner: + cmdlist = [runner, obj] + pe = subprocess.Popen(cmdlist, cwd=work_dir) + pe.wait() + if pe.returncode != 0: + raise EnvironmentException('Executables created by Java compiler %s are not runnable.' % self.name_string()) + else: + m = "Java Virtual Machine wasn't found, but it's needed by Meson. " \ + "Please install a JRE.\nIf you have specific needs where this " \ + "requirement doesn't make sense, please open a bug at " \ + "https://github.com/mesonbuild/meson/issues/new and tell us " \ + "all about it." + raise EnvironmentException(m) def needs_static_linker(self): return False |