diff options
-rw-r--r-- | docs/markdown/Gnome-module.md | 1 | ||||
-rw-r--r-- | docs/markdown/snippets/gir_fatal_warnings.md | 5 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 13 |
3 files changed, 17 insertions, 2 deletions
diff --git a/docs/markdown/Gnome-module.md b/docs/markdown/Gnome-module.md index 0d1f269..ced8a40 100644 --- a/docs/markdown/Gnome-module.md +++ b/docs/markdown/Gnome-module.md @@ -97,6 +97,7 @@ There are several keyword arguments. Many of these map directly to the * `link_with`: list of libraries to link with * `symbol_prefix`: the symbol prefix for the gir object, e.g. `gtk`, (*Since 0.43.0*) an ordered list of multiple prefixes is allowed +* `fatal_warnings`: *Since 0.55.0* turn scanner warnings into fatal errors. Returns an array of two elements which are: `[gir_target, typelib_target]` diff --git a/docs/markdown/snippets/gir_fatal_warnings.md b/docs/markdown/snippets/gir_fatal_warnings.md new file mode 100644 index 0000000..951e98e --- /dev/null +++ b/docs/markdown/snippets/gir_fatal_warnings.md @@ -0,0 +1,5 @@ +## Fatal warnings in `gnome.generate_gir()` + +`gnome.generate_gir()` now has `fatal_warnings` keyword argument to abort when +a warning is produced. This is useful for example in CI environment where it's +important to catch potential issues. diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index ea1b325..d541eee 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -721,11 +721,12 @@ class GnomeModule(ExtensionModule): if f.startswith(('-L', '-l', '--extra-library')): yield f - @FeatureNewKwargs('build target', '0.40.0', ['build_by_default']) + @FeatureNewKwargs('generate_gir', '0.55.0', ['fatal_warnings']) + @FeatureNewKwargs('generate_gir', '0.40.0', ['build_by_default']) @permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix', 'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories', 'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args', - 'packages', 'header', 'build_by_default'}) + 'packages', 'header', 'build_by_default', 'fatal_warnings'}) def generate_gir(self, state, args, kwargs): if not args: raise MesonException('generate_gir takes at least one argument') @@ -798,6 +799,14 @@ class GnomeModule(ExtensionModule): scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_source_dir(), self.interpreter.subproject_dir, state.subproject)] scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_build_dir(), self.interpreter.subproject_dir, state.subproject)] + if '--warn-error' in scan_command: + mlog.deprecation('Passing --warn-error is deprecated in favor of "fatal_warnings" keyword argument') + fatal_warnings = kwargs.get('fatal_warnings', False) + if not isinstance(fatal_warnings, bool): + raise MesonException('fatal_warnings keyword argument must be string.') + if fatal_warnings: + scan_command.append('--warn-error') + scan_target = self._make_gir_target(state, girfile, scan_command, depends, kwargs) typelib_output = '%s-%s.typelib' % (ns, nsversion) |