Uploaded image for project: 'XWiki Commons'
  1. XWiki Commons
  2. XCOMMONS-3862

Add a build check verifying that the provided macros are declared in xwiki.extension.components

    XMLWordPrintable

Details

    • Improvement
    • Resolution: Fixed
    • Major
    • 18.10.0-rc-1
    • 17.10.0
    • Extension
    • None
    • Unknown

    Description

      The Extension Manager indexes the components an extension declares in the xwiki.extension.components Maven property. This is what lets the editor suggest installing the extension providing an unknown macro. Declaring a macro there is easy to forget: no module of commons, rendering or platform declares its macros today, and nothing reports it.

      Proposal

      Fail the build when the macros declared in xwiki.extension.components do not match the macros the module provides:

      • Java macros (jar modules): a new Spoon check, MacroDeclarationProcessor, finds the non-abstract @Component classes implementing org.xwiki.rendering.macro.Macro and takes their hints from @Component(hints), @Named or default.
      • Wiki macros (XAR modules): xar:verify collects the ids of the XWiki.WikiMacroClass objects.

      Both report:

      • a provided macro which is not declared, with the line to add (e.g. org.xwiki.rendering.macro.Macro/toc)
      • a declared macro which is not provided anymore
      • a macro declared with a generic role (e.g. org.xwiki.rendering.macro.Macro<?>/toc), which the extension index does not find
      • a component whose type hierarchy cannot be resolved, since it is then impossible to know whether it is a macro

      The xwiki.extension.components.check.skip Maven property disables both checks, e.g. for test modules whose macros are never installed through the Extension Manager.

      Attachments

        Issue Links

          Activity

            People

              mleduc Manuel Leduc
              mleduc Manuel Leduc
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: