diff options
author | Charles Brunet <charles.brunet@optelgroup.com> | 2023-08-10 14:35:18 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-08-18 00:36:49 -0400 |
commit | 7cbe37ebd94e9df984328fd9722cc2fc9f61651b (patch) | |
tree | beb5045353c7fc7da5fd7db01e95db3af2073f1c | |
parent | 88747b4f8d4bb35c82c8855ecbd6a29ea419b6fd (diff) | |
download | meson-7cbe37ebd94e9df984328fd9722cc2fc9f61651b.zip meson-7cbe37ebd94e9df984328fd9722cc2fc9f61651b.tar.gz meson-7cbe37ebd94e9df984328fd9722cc2fc9f61651b.tar.bz2 |
Add more descriptive description to CustomTarget
Allow modules using CustomTarget to modify the command description used by ninja backend. This result in more precise logs when building a project.
-rw-r--r-- | docs/markdown/snippets/custom_target_description.md | 6 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 4 | ||||
-rw-r--r-- | mesonbuild/build.py | 2 | ||||
-rw-r--r-- | mesonbuild/modules/external_project.py | 1 | ||||
-rw-r--r-- | mesonbuild/modules/fs.py | 1 | ||||
-rw-r--r-- | mesonbuild/modules/gnome.py | 10 | ||||
-rw-r--r-- | mesonbuild/modules/i18n.py | 3 | ||||
-rw-r--r-- | mesonbuild/modules/qt.py | 3 | ||||
-rw-r--r-- | mesonbuild/modules/rust.py | 1 | ||||
-rw-r--r-- | mesonbuild/modules/windows.py | 1 |
10 files changed, 30 insertions, 2 deletions
diff --git a/docs/markdown/snippets/custom_target_description.md b/docs/markdown/snippets/custom_target_description.md new file mode 100644 index 0000000..fd8820e --- /dev/null +++ b/docs/markdown/snippets/custom_target_description.md @@ -0,0 +1,6 @@ +## More meaningful description of many generative tasks + +When a module uses a `CustomTarget` to process files, it now has the possibility +to customize the message displayed by ninja. + +Many modules were updated to take advantage of this new feature. diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 72c8265..1d563a2 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -1147,7 +1147,7 @@ class NinjaBackend(backends.Backend): deps.append(os.path.join(self.get_target_dir(i), output)) return deps - def generate_custom_target(self, target): + def generate_custom_target(self, target: build.CustomTarget): self.custom_target_generator_inputs(target) (srcs, ofilenames, cmd) = self.eval_custom_target_command(target) deps = self.unwrap_dep_list(target) @@ -1185,7 +1185,7 @@ class NinjaBackend(backends.Backend): elem.add_item('pool', 'console') full_name = Path(target.subdir, target.name).as_posix() elem.add_item('COMMAND', cmd) - elem.add_item('description', f'Generating {full_name} with a custom command{cmd_type}') + elem.add_item('description', target.description.format(full_name) + cmd_type) self.add_build(elem) self.processed_targets.add(target.get_id()) diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 5b9d152..1463e51 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -2535,6 +2535,7 @@ class CustomTarget(Target, CommandBase): install_tag: T.Optional[T.List[T.Optional[str]]] = None, absolute_paths: bool = False, backend: T.Optional['Backend'] = None, + description: str = 'Generating {} with a custom command', ): # TODO expose keyword arg to make MachineChoice.HOST configurable super().__init__(name, subdir, subproject, False, MachineChoice.HOST, environment, @@ -2559,6 +2560,7 @@ class CustomTarget(Target, CommandBase): self.install_mode = install_mode self.install_tag = _process_install_tag(install_tag, len(self.outputs)) self.name = name if name else self.outputs[0] + self.description = description # Whether to use absolute paths for all files on the commandline self.absolute_paths = absolute_paths diff --git a/mesonbuild/modules/external_project.py b/mesonbuild/modules/external_project.py index f7a72bc..e7b7c43 100644 --- a/mesonbuild/modules/external_project.py +++ b/mesonbuild/modules/external_project.py @@ -247,6 +247,7 @@ class ExternalProject(NewExtensionModule): depfile=f'{self.name}.d', console=True, extra_depends=extra_depends, + description='Generating external project {}', ) idir = build.InstallDir(self.subdir.as_posix(), diff --git a/mesonbuild/modules/fs.py b/mesonbuild/modules/fs.py index 53174d2..c145486 100644 --- a/mesonbuild/modules/fs.py +++ b/mesonbuild/modules/fs.py @@ -308,6 +308,7 @@ class FSModule(ExtensionModule): install_mode=kwargs['install_mode'], install_tag=[kwargs['install_tag']], backend=state.backend, + description='Copying file {}', ) return ModuleReturnValue(ct, [ct]) diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index 18862e7..6bd0436 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -1242,6 +1242,7 @@ class GnomeModule(ExtensionModule): ['gschemas.compiled'], build_by_default=kwargs['build_by_default'], depend_files=kwargs['depend_files'], + description='Compiling gschemas {}', ) self._devenv_prepend('GSETTINGS_SCHEMA_DIR', os.path.join(state.environment.get_build_dir(), state.subdir)) return ModuleReturnValue(target_g, [target_g]) @@ -1355,6 +1356,7 @@ class GnomeModule(ExtensionModule): [po_file], [gmo_file], install_tag=['doc'], + description='Generating yelp doc {}', ) targets.append(gmotarget) @@ -1370,6 +1372,7 @@ class GnomeModule(ExtensionModule): install=True, install_dir=[l_install_dir], install_tag=['doc'], + description='Generating yelp doc {}', ) targets.append(mergetarget) @@ -1513,6 +1516,7 @@ class GnomeModule(ExtensionModule): [f'{modulename}-decl.txt'], build_always_stale=True, extra_depends=new_depends, + description='Generating gtkdoc {}', ) alias_target = build.AliasTarget(targetname, [custom_target], state.subdir, state.subproject, state.environment) if kwargs['check']: @@ -1656,6 +1660,7 @@ class GnomeModule(ExtensionModule): xml_files, [output], build_by_default=build_by_default, + description='Generating gdbus source {}', ) targets.append(cfile_custom_target) @@ -1680,6 +1685,7 @@ class GnomeModule(ExtensionModule): install=install_header, install_dir=[install_dir], install_tag=['devel'], + description='Generating gdbus header {}', ) targets.append(hfile_custom_target) @@ -1708,6 +1714,7 @@ class GnomeModule(ExtensionModule): outputs, build_by_default=build_by_default, extra_depends=depends, + description='Generating gdbus docbook {}', ) targets.append(docbook_custom_target) @@ -1930,6 +1937,7 @@ class GnomeModule(ExtensionModule): extra_depends=depends, # https://github.com/mesonbuild/meson/issues/973 absolute_paths=True, + description='Generating GObject enum file {}', ) @typed_pos_args('gnome.genmarshal', str) @@ -1996,6 +2004,7 @@ class GnomeModule(ExtensionModule): install_tag=['devel'], capture=capture, depend_files=kwargs['depend_files'], + description='Generating glib marshaller header {}', ) c_cmd = cmd + ['--body', '@INPUT@'] @@ -2015,6 +2024,7 @@ class GnomeModule(ExtensionModule): capture=capture, depend_files=kwargs['depend_files'], extra_depends=extra_deps, + description='Generating glib marshaller source {}', ) rv = [body, header] diff --git a/mesonbuild/modules/i18n.py b/mesonbuild/modules/i18n.py index 11dd9ef..c82e580 100644 --- a/mesonbuild/modules/i18n.py +++ b/mesonbuild/modules/i18n.py @@ -212,6 +212,7 @@ class I18nModule(ExtensionModule): install=kwargs['install'], install_dir=[kwargs['install_dir']] if kwargs['install_dir'] is not None else None, install_tag=install_tag, + description='Merging translations for {}', ) return ModuleReturnValue(ct, [ct]) @@ -304,6 +305,7 @@ class I18nModule(ExtensionModule): # Bonus: the build tree has something usable as an uninstalled bindtextdomain() target dir. install_dir=[path.join(install_dir, l, 'LC_MESSAGES')], install_tag=['i18n'], + description='Building translation {}', ) targets.append(gmotarget) gmotargets.append(gmotarget) @@ -390,6 +392,7 @@ class I18nModule(ExtensionModule): install=kwargs['install'], install_dir=[kwargs['install_dir']] if kwargs['install_dir'] is not None else None, install_tag=install_tag, + description='Merging translations for {}', ) return ModuleReturnValue(ct, [ct]) diff --git a/mesonbuild/modules/qt.py b/mesonbuild/modules/qt.py index 8555888..20ff111 100644 --- a/mesonbuild/modules/qt.py +++ b/mesonbuild/modules/qt.py @@ -348,6 +348,7 @@ class QtBaseModule(ExtensionModule): [f'{name}.cpp'], depend_files=qrc_deps, depfile=f'{name}.d', + description='Compiling Qt resources {}', ) targets.append(res_target) else: @@ -368,6 +369,7 @@ class QtBaseModule(ExtensionModule): [f'{name}.cpp'], depend_files=qrc_deps, depfile=f'{name}.d', + description='Compiling Qt resources {}', ) targets.append(res_target) @@ -600,6 +602,7 @@ class QtBaseModule(ExtensionModule): install_dir=[kwargs['install_dir']], install_tag=['i18n'], build_by_default=kwargs['build_by_default'], + description='Compiling Qt translations {}', ) translations.append(lrelease_target) if qresource: diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py index 4f5494a..0bda2c2 100644 --- a/mesonbuild/modules/rust.py +++ b/mesonbuild/modules/rust.py @@ -263,6 +263,7 @@ class RustModule(ExtensionModule): extra_depends=depends, depend_files=depend_files, backend=state.backend, + description='Generating bindings for Rust {}', ) return ModuleReturnValue([target], [target]) diff --git a/mesonbuild/modules/windows.py b/mesonbuild/modules/windows.py index f9c7c57..b7cdeb3 100644 --- a/mesonbuild/modules/windows.py +++ b/mesonbuild/modules/windows.py @@ -206,6 +206,7 @@ class WindowsModule(ExtensionModule): depfile=depfile, depend_files=wrc_depend_files, extra_depends=wrc_depends, + description='Compiling Windows resource {}', )) return ModuleReturnValue(res_targets, [res_targets]) |