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

Documentation: ANDROID_EXTRA_PLUGINS needs additional information

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 5.9.0 Beta 1
    • Fix Version/s: 5.15.2, 5.15
    • Component/s: Documentation
    • Labels:
      None
    • Platform/s:
      Android
    • Commits:
      1ff82d1ebaa7b9151bab449fd29b76d59654037b (qt/qtbase/dev) f7857d7f867ae5be0f910f802daaf4cec69c8a58 (qt/qtbase/5.15)
    • Story Points:
      5
    • Sprint:
      Da Vinci sprint 10, Da Vinci sprint 11

      Description

      Qt documentation is actually:

      ANDROID_EXTRA_PLUGINS: This variable can be used to specify different resources that your project has to bundle but cannot be delivered through the assets system, such as qml plugins. When using this variable, androiddeployqt will make sure everything is packaged and deployed properly.

      But it doesn't explain we have to give a path of a directory hierarchy similar to the Qt plugin directory. For example to add an sqldriver, we have to provide this directory hierarchy : plugins/sqldrivers/libqXXX.so

      Also, it doesn't explain the filename mangling libplugins_sqldrivers_libqsqlite.so which is later copied to plugins/sqldrivers/libqsqlite.so

      Corresponding code is:

      bool copyAndroidExtraResources(const Options &options)
      {
          if (options.extraPlugins.isEmpty())
              return true;
      
          if (options.verbose)
              fprintf(stdout, "Copying %d external resources to package.\n", options.extraPlugins.size());
      
          for (const QString &extraResource : options.extraPlugins) {
              QFileInfo extraResourceInfo(extraResource);
              if (!extraResourceInfo.exists() || !extraResourceInfo.isDir()) {
                  fprintf(stderr, "External resource %s does not exist or not a correct directory!\n", qPrintable(extraResource));
                  return false;
              }
      
              QDir resourceDir(extraResource);
              QString assetsDir = options.outputDirectory + QStringLiteral("/assets/") + resourceDir.dirName() + QLatin1Char('/');
              QString libsDir = options.outputDirectory + QStringLiteral("/libs/") + options.architecture + QLatin1Char('/');
      
              const QStringList files = allFilesInside(resourceDir, resourceDir);
              for (const QString &resourceFile : files) {
                  QString originFile(resourceDir.filePath(resourceFile));
                  QString destinationFile;
                  if (!resourceFile.endsWith(QLatin1String(".so"))) {
                      destinationFile = assetsDir + resourceFile;
                  } else {
                      destinationFile = libsDir + QStringLiteral("/lib") + QString(resourceDir.dirName() + QLatin1Char('/') + resourceFile).replace(QLatin1Char('/'), QLatin1Char('_'));
                  }
      
                  if (!copyFileIfNewer(originFile, destinationFile, options.verbose))
                      return false;
              }
          }
      
          return true;
      }
      

        Attachments

          Issue Links

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

            Activity

              People

              Assignee:
              treinio Topi Reiniƶ
              Reporter:
              fabricesalvaire fabrice salvaire
              PM Owner:
              Santtu Ahonen Santtu Ahonen
              RnD Owner:
              Rami Potinkara Rami Potinkara
              Votes:
              3 Vote for this issue
              Watchers:
              10 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:

                  Gerrit Reviews

                  There are no open Gerrit changes