Help automoc to find metadata JSON files referenced in the code
ClosedPublic

Authored by kossebau on Feb 21 2018, 6:31 PM.

Details

Summary

automoc by itself can only detect metadata files referenced by direct
usage of the Q_PLUGIN_METADATA macro. It does not do any C++ preprocessor
evaluation. Instead it needs to be helped with regexp-based filter rules
for detecting any names of files used as additional moc input.
See docs for AUTOMOC_DEPEND_FILTERS for further details.

In the near future all the boilerplate code should be replaced with a yet to
be designed ECM macro. For now explicit code is used to collect use cases
for the macro and still to fix the issue already.

Test Plan

Changing a JSON file (or for those generated from .desktop files
changing that one) and running make results in the related *.moc file
being regenerated and the related object file being recompiled.
qtplugininfo shows that the created plugin binary has up-to-date JSON
content.

Diff Detail

Repository
R244 KCoreAddons
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
kossebau created this revision.Feb 21 2018, 6:31 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptFeb 21 2018, 6:31 PM
kossebau requested review of this revision.Feb 21 2018, 6:31 PM

See related discussion on CMake issue tracker: https://gitlab.kitware.com/cmake/cmake/issues/17750

Similar patches will be also done to the other Framework modules which need such extra handling. Will see to upload them as well tonight.

Given KF 5.44 tagging is in two weeks, I do not want to rush the creation of the related desired ECM macro, but instead design it now and then add it only for 5.45, so we developers have some more time to test it before the API becomes stable. Still brushing over it, but should arrive as review request once the explicit code here has been reviewed and collected feedback.

The ARG2 in the var name is already a hint to what is coming, as there are also variants with ARG3 when the JSON file argument is the 3rd arg in the related macro call.

apol accepted this revision.Feb 22 2018, 1:54 AM

Makes sense to me. Or as much as such a regex can...

This revision is now accepted and ready to land.Feb 22 2018, 1:54 AM
This revision was automatically updated to reflect the committed changes.