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

Authored by kossebau on Feb 20 2018, 6:21 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.

Test Plan

Changing a JSON file 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
R32 KDevelop
Branch
useCMAKE_AUTOMOC_DEPEND_FILTERS
Lint
No Linters Available
Unit
No Unit Test Coverage
kossebau created this revision.Feb 20 2018, 6:21 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptFeb 20 2018, 6:21 PM
kossebau requested review of this revision.Feb 20 2018, 6:21 PM
kossebau added a comment.EditedFeb 20 2018, 6:24 PM

Based on reply https://gitlab.kitware.com/cmake/cmake/issues/17750#note_377396 on the given filed CMake issue.
While there are three questions added by me for now on the issue, by what I tested this patch seems to {do the] right thing. I just asked to get confirmation, as the documentation left me unsure.

kossebau edited the summary of this revision. (Show Details)Feb 20 2018, 6:26 PM
kossebau edited the test plan for this revision. (Show Details)
apol added a comment.Feb 21 2018, 12:26 AM

+1
The solution is scary. Maybe add some comment on what kind of things are needed?

In D10693#210567, @apol wrote:

+1
The solution is scary. Maybe add some comment on what kind of things are needed?

I started to write some comment. but then felt I duplicate the cmake docs about CMAKE_AUTOMOC_DEPEND_FILTERS.
To your yet innocent eyes, what would you think a future reader might want to know with that code directly?

apol added a comment.Feb 21 2018, 1:22 AM

I started to write some comment. but then felt I duplicate the cmake docs about CMAKE_AUTOMOC_DEPEND_FILTERS.
To your yet innocent eyes, what would you think a future reader might want to know with that code directly?

https://cmake.org/cmake/help/v3.10/variable/CMAKE_AUTOMOC_DEPEND_FILTERS.html

Why's there a regular expression? what's trying to catch?

In D10693#210602, @apol wrote:

I started to write some comment. but then felt I duplicate the cmake docs about CMAKE_AUTOMOC_DEPEND_FILTERS.
To your yet innocent eyes, what would you think a future reader might want to know with that code directly?

https://cmake.org/cmake/help/v3.10/variable/CMAKE_AUTOMOC_DEPEND_FILTERS.html

Why's there a regular expression? what's trying to catch?

Ah, I was looking at https://cmake.org/cmake/help/v3.10/prop_tgt/AUTOMOC_DEPEND_FILTERS.html#prop_tgt:AUTOMOC_DEPEND_FILTERS which has way more details. Okay, will extract answers to your questions and add as comments.

kossebau updated this revision to Diff 27712.Feb 21 2018, 5:34 PM
  • extend regexp rules to allow linebreaks
  • more details in the comment
apol accepted this revision.Feb 22 2018, 2:39 AM
This revision is now accepted and ready to land.Feb 22 2018, 2:39 AM
This revision was automatically updated to reflect the committed changes.