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

QtQuick 2 projects : macdeployqt tries to deploy qml imports that should be ignored

    XMLWordPrintable

Details

    Description

      When running macdeployqt on MyProject.app, with option -qmldir="../MyProject/qml", there are imports that should be ignored :

      1. Local imports :
      If I organize my qml files in subdirectories (see below), I import these subdirectories with :

      import "SubDir1" (in main.qml)
      import "../SubDir1" (from qml files in SubDir2)

      These imports should be ignored, because we don't want to copy the qml files from subdirectories in MyProject.app/Contents/Resources/qml/
      With Qt 5.2.1, they are all copied (copy: "/root/MyProject/qml/SubDir1" "MyProject.app/Contents/Resources/qml/SubDir1")
      With Qt 5.3.0 Beta the copy fails because it uses a weird relative path (copy: "../MyProject/qml/main.qml/SubDir1" "MyProject.app/Contents/Resources/qml/SubDir1")
      It is a problem to copy the subdirectories here, because they already are in the resource system (thanks to qml.qrc), and because the user could access them.

      2. Modules registered from C++ with qmlRegister() :
      If in main.cpp I do something like :

      qmlRegisterUncreatableType<MyType>("CppClasses", 1, 0, "MyType", "");

      And I import that from main.qml with :

      import CppClasses 1.0

      This import should be ignored, because no .qml file or anything is associated with it.
      With both Qt 5.2.1 and 5.3.0 Beta, qmlimportscanner returns this JSon object :

      {
      "name": "CppClasses",
      "type": "module",
      "version": "1.0"
      }

      As there is no "path" field, macdeployqt does this :

      copy: "" "MyProject.app/Contents/Resources/qml/CppClasses"

      Which results in a folder containing an empty "MyProject.app" file, and error messages like :

      ERROR: file copy failed from "/main.o"
      ERROR: to "MyProject.app/Contents/Resources/qml/CppClasses/main.o"

      Project organization :

      root
          |- MyProject
              |- src (.cpp/.h files)
                  |- main.cpp
              |- qml (.qml files)
                  |- main.qml
                  |- qml.qrc (lists all .qml files)
                  |- SubDir1
                  |- SubDir2
          |- build-MyProject
              |- MyProject.app
      

      Attachments

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

        Activity

          People

            sorvig Morten Sørvig
            kniebou Nicolas Kniebihler
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes