aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mesonbuild/backend/ninjabackend.py6
-rw-r--r--mesonbuild/compilers.py23
-rw-r--r--mesonbuild/interpreter.py14
-rw-r--r--mesonbuild/modules/gnome.py2
-rwxr-xr-xmesonbuild/scripts/gtkdochelper.py10
-rw-r--r--test cases/common/112 has arg/meson.build9
-rw-r--r--test cases/java/4 inner class/com/mesonbuild/Simple.java15
-rw-r--r--test cases/java/4 inner class/meson.build5
8 files changed, 72 insertions, 12 deletions
diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py
index b002656..d8dc333 100644
--- a/mesonbuild/backend/ninjabackend.py
+++ b/mesonbuild/backend/ninjabackend.py
@@ -803,8 +803,10 @@ int dummy;
if e != '':
commands.append(main_class)
commands.append(self.get_target_filename(target))
- for cls in class_list:
- commands += ['-C', self.get_target_private_dir(target), cls]
+ # Java compilation can produce an arbitrary number of output
+ # class files for a single source file. Thus tell jar to just
+ # grab everything in the final package.
+ commands += ['-C', self.get_target_private_dir(target), '.']
elem = NinjaBuildElement(self.all_outputs, outname_rel, jar_rule, [])
elem.add_dep(class_dep_list)
elem.add_item('ARGS', commands)
diff --git a/mesonbuild/compilers.py b/mesonbuild/compilers.py
index 5c1dcb1..88ea3e2 100644
--- a/mesonbuild/compilers.py
+++ b/mesonbuild/compilers.py
@@ -425,8 +425,13 @@ class Compiler():
def get_library_dirs(self):
return []
- def has_argument(self, arg):
- raise EnvironmentException('Language {} does not support has_arg.'.format(self.language))
+ def has_argument(self, arg, env):
+ return self.has_multi_arguments([arg], env)
+
+ def has_multi_arguments(self, args, env):
+ raise EnvironmentException(
+ 'Language {} does not support has_multi_arguments.'.format(
+ self.language))
def get_cross_extra_flags(self, environment, *, compile, link):
extra_flags = []
@@ -1129,8 +1134,8 @@ void bar() {
def thread_link_flags(self):
return ['-pthread']
- def has_argument(self, arg, env):
- return self.compiles('int i;\n', env, extra_args=arg)
+ def has_multi_arguments(self, args, env):
+ return self.compiles('int i;\n', env, extra_args=args)
class CPPCompiler(CCompiler):
def __init__(self, exelist, version, is_cross, exe_wrap):
@@ -1966,7 +1971,7 @@ class VisualStudioCCompiler(CCompiler):
# Visual Studio is special. It ignores arguments it does not
# understand and you can't tell it to error out on those.
# http://stackoverflow.com/questions/15259720/how-can-i-make-the-microsoft-c-compiler-treat-unknown-flags-as-errors-rather-t
- def has_argument(self, arg, env):
+ def has_multi_arguments(self, args, env):
warning_text = '9002'
code = 'int i;\n'
(fd, srcname) = tempfile.mkstemp(suffix='.'+self.default_suffix)
@@ -1976,7 +1981,7 @@ class VisualStudioCCompiler(CCompiler):
# Read c_args/cpp_args/etc from the cross-info file (if needed)
extra_args = self.get_cross_extra_flags(env, compile=True, link=False)
extra_args += self.get_compile_only_args()
- commands = self.exelist + [arg] + extra_args + [srcname]
+ commands = self.exelist + args + extra_args + [srcname]
mlog.debug('Running VS compile:')
mlog.debug('Command line: ', ' '.join(commands))
mlog.debug('Code:\n', code)
@@ -2269,8 +2274,10 @@ class ClangCompiler():
raise MesonException('Unreachable code when converting clang type to gcc type.')
return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module)
- def has_argument(self, arg, env):
- return super().has_argument(['-Werror=unknown-warning-option', arg], env)
+ def has_multi_arguments(self, args, env):
+ return super().has_multi_arguments(
+ ['-Werror=unknown-warning-option'] + args,
+ env)
def has_function(self, funcname, prefix, env, extra_args=None, dependencies=None):
if extra_args is None:
diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py
index cff98b1..d65ce6f 100644
--- a/mesonbuild/interpreter.py
+++ b/mesonbuild/interpreter.py
@@ -621,6 +621,7 @@ class CompilerHolder(InterpreterObject):
'cmd_array' : self.cmd_array_method,
'find_library': self.find_library_method,
'has_argument' : self.has_argument_method,
+ 'has_multi_arguments' : self.has_multi_arguments_method,
'first_supported_argument' : self.first_supported_argument_method,
'unittest_args' : self.unittest_args_method,
'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method,
@@ -926,6 +927,19 @@ class CompilerHolder(InterpreterObject):
mlog.log('Compiler for {} supports argument {}:'.format(self.compiler.language, args[0]), h)
return result
+ def has_multi_arguments_method(self, args, kwargs):
+ args = mesonlib.stringlistify(args)
+ result = self.compiler.has_multi_arguments(args, self.environment)
+ if result:
+ h = mlog.green('YES')
+ else:
+ h = mlog.red('NO')
+ mlog.log(
+ 'Compiler for {} supports arguments {}:'.format(
+ self.compiler.language, ' '.join(args)),
+ h)
+ return result
+
def first_supported_argument_method(self, args, kwargs):
for i in mesonlib.stringlistify(args):
if self.compiler.has_argument(i, self.environment):
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index caf162f..1912fc1 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -677,7 +677,7 @@ can not be used with the current version of glib-compiled-resources, due to
header_dirs.append(os.path.join(state.environment.get_source_dir(),
src_dir.get_curdir(), inc_dir))
else:
- header_dirs.append(os.path.normpath(os.path.join(state.subdir, src_dir)))
+ header_dirs.append(src_dir)
args = ['--sourcedir=' + state.environment.get_source_dir(),
'--builddir=' + state.environment.get_build_dir(),
diff --git a/mesonbuild/scripts/gtkdochelper.py b/mesonbuild/scripts/gtkdochelper.py
index 0cfd644..f4b4f34 100755
--- a/mesonbuild/scripts/gtkdochelper.py
+++ b/mesonbuild/scripts/gtkdochelper.py
@@ -62,7 +62,15 @@ def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
expand_content_files, mode):
print("Building documentation for %s" % module)
- src_dir_args = ['--source-dir=' + os.path.join(source_root, src_dir) for src_dir in src_subdirs]
+ src_dir_args = []
+ for src_dir in src_subdirs:
+ if not os.path.isabs(src_dir):
+ dirs = [os.path.join(source_root, src_dir),
+ os.path.join(build_root, src_dir)]
+ else:
+ dirs = [src_dir]
+ src_dir_args += ['--source-dir=' + d for d in dirs]
+
doc_src = os.path.join(source_root, doc_subdir)
abs_out = os.path.join(build_root, doc_subdir)
htmldir = os.path.join(abs_out, 'html')
diff --git a/test cases/common/112 has arg/meson.build b/test cases/common/112 has arg/meson.build
index 6404107..15d8cc8 100644
--- a/test cases/common/112 has arg/meson.build
+++ b/test cases/common/112 has arg/meson.build
@@ -33,3 +33,12 @@ l2 = cpp.first_supported_argument(isnt_arg, isnt_arg, isnt_arg)
assert(l1.length() == 1, 'First supported returned wrong result.')
assert(l1.get(0) == is_arg, 'First supported returned wrong argument.')
assert(l2.length() == 0, 'First supported did not return empty array.')
+
+if cc.get_id() == 'gcc'
+ pre_arg = '-Wformat'
+ anti_pre_arg = '-Wno-format'
+ arg = '-Werror=format-security'
+ assert(not cc.has_multi_arguments([anti_pre_arg, arg]), 'Arg that should be broken is not.')
+ assert(cc.has_multi_arguments(pre_arg), 'Arg that should have worked does not work.')
+ assert(cc.has_multi_arguments([pre_arg, arg]), 'Arg that should have worked does not work.')
+endif
diff --git a/test cases/java/4 inner class/com/mesonbuild/Simple.java b/test cases/java/4 inner class/com/mesonbuild/Simple.java
new file mode 100644
index 0000000..fd0e0bf
--- /dev/null
+++ b/test cases/java/4 inner class/com/mesonbuild/Simple.java
@@ -0,0 +1,15 @@
+package com.mesonbuild;
+
+class Simple {
+ class Inner {
+ public String getString() {
+ return "Inner class is working.\n";
+ }
+ }
+
+ public static void main(String [] args) {
+ Simple s = new Simple();
+ Simple.Inner ic = s.new Inner();
+ System.out.println(ic.getString());
+ }
+}
diff --git a/test cases/java/4 inner class/meson.build b/test cases/java/4 inner class/meson.build
new file mode 100644
index 0000000..bed5c0f
--- /dev/null
+++ b/test cases/java/4 inner class/meson.build
@@ -0,0 +1,5 @@
+project('simplejava', 'java')
+
+javaprog = jar('myprog', 'com/mesonbuild/Simple.java',
+ main_class : 'com.mesonbuild.Simple')
+test('mytest', javaprog)