Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107110

QML linting is not functional for a project with huge number of QML files

    XMLWordPrintable

Details

    • Windows

    Description

      QML linting target is not functional at least on Windows with Visual Studio 16 2019 generator for a project with a huge number of QML files (over 600 in my case)

      An executable target is used as backing target for a QML module, i.e.:

      ...
      qt_add_executable(my_project WIN32)
      ...
      qt_add_qml_module(my_project 
          URI MyProject
          VERSION 1.0
          QML_FILES Resources/QML/component1.qml Resources/QML/component2.qml ... Resources/QML/component600.qml # <--- more than 600 QML files
          NO_RESOURCE_TARGET_PATH
      )
      

      As result additional target my_project_qmllint is generated with custom build rule that looks like this:

      setlocal
      cd D:\my_project
      if %errorlevel% neq 0 goto :cmEnd
      D:
      if %errorlevel% neq 0 goto :cmEnd
      e:\Qt\6.3.2\msvc2019_64\bin\qmllint.exe -I D:/my_project_build --resource D:/my_project_build/.rcc/qmake_MyProject.qrc --resource D:/my_project_build/.rcc/qmake_MyProject_copy.qrc --resource D:/my_project_build/.rcc/my_project_raw_qml_0.qrc D:/my_project/Resources/QML/component1.qml D:/my_project/Resources/QML/component2.qml ... D:/my_project/Resources/QML/component600.qml 
      if %errorlevel% neq 0 goto :cmEnd
      :cmEnd
      endlocal &amp; call :cmErrorLevel %errorlevel% &amp; goto :cmDone
      :cmErrorLevel
      exit /b %1
      :cmDone
      if %errorlevel% neq 0 goto :VCEnd
      

      The problem is that this command can't be executed at all because of Maximum Command Line Length Limitation (see https://learn.microsoft.com/en-us/troubleshoot/windows-client/shell-experience/command-line-string-limitation, https://stackoverflow.com/questions/3205027/maximum-length-of-command-line-string). In my case, the total length of the command significantly exceeds this limit (it's more than 46k characters).

      I see the next possible solutions:
      1. generate and use a file with a list of qml sources as an input for qmllint tool (don't know for what the "--resource" option is used here and why it doesn't read qml sources directly from listed qrc files)
      2. apply custom build rule on each qml source file individually, e.g. as qmlcachegen does.
      3. something else...

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              qtqmlteam Qt Qml Team User
              studiosus Vladimir Belyavsky
              Votes:
              6 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes