androiddeployqt: Share information on why plugins are skipped
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@digia.com>
Fri, 8 Nov 2013 08:34:55 +0000 (09:34 +0100)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 13 Nov 2013 07:41:14 +0000 (08:41 +0100)
When we skip a plugin due to missing dependencies, we should
output which dependencies are missing so that people can easily
find out what to add to their .pro files.

Task-number: QTBUG-34586
Change-Id: I64e1687e4ad67165b0d8708e1e1fcedc10883515
Reviewed-by: Paul Olav Tvete <paul.tvete@digia.com>
src/androiddeployqt/main.cpp

index 8a5e851..9c34388 100644 (file)
@@ -1221,7 +1221,7 @@ bool readDependenciesFromElf(Options *options,
     return true;
 }
 
-bool goodToCopy(const Options *options, const QString &file);
+bool goodToCopy(const Options *options, const QString &file, QStringList *unmetDependencies);
 
 bool readDependencies(Options *options)
 {
@@ -1248,13 +1248,17 @@ bool readDependencies(Options *options)
         QSet<QString>::iterator start = remainingDependencies.begin();
         QString fileName = qtDir+*start;
         remainingDependencies.erase(start);
-        if (goodToCopy(options, fileName)) {
+
+        QStringList unmetDependencies;
+        if (goodToCopy(options, fileName, &unmetDependencies)) {
             bool ok = readDependenciesFromElf(options, fileName, &usedDependencies, &remainingDependencies);
             if (!ok)
                 return false;
+        } else if (options->verbose) {
+            fprintf(stdout, "Skipping %s due to unmet dependencies: %s\n",
+                    qPrintable(fileName),
+                    qPrintable(unmetDependencies.join(QLatin1Char(','))));
         }
-        else if (options->verbose)
-            fprintf(stdout, "Skipping %s due to unmet dependencies\n", qPrintable(fileName));
     }
     return true;
 }
@@ -1412,16 +1416,20 @@ bool fetchRemoteModifications(Options *options, const QString &directory)
     return true;
 }
 
-bool goodToCopy(const Options *options, const QString &file)
+bool goodToCopy(const Options *options, const QString &file, QStringList *unmetDependencies)
 {
     if (!file.endsWith(QLatin1String(".so")))
         return true;
 
-    foreach (const QString &lib, getQtLibsFromElf(*options, file))
-        if (!options->qtDependencies.contains(lib))
-            return false;
+    bool ret = true;
+    foreach (const QString &lib, getQtLibsFromElf(*options, file)) {
+        if (!options->qtDependencies.contains(lib)) {
+            ret = false;
+            unmetDependencies->append(lib);
+        }
+    }
 
-    return true;
+    return ret;
 }
 
 bool deployToLocalTmp(Options *options,
@@ -1432,9 +1440,12 @@ bool deployToLocalTmp(Options *options,
 
     QFileInfo fileInfo(options->qtInstallDirectory + QLatin1Char('/') + qtDependency);
 
-    if (!goodToCopy(options, fileInfo.absoluteFilePath())) {
+    QStringList unmetDependencies;
+    if (!goodToCopy(options, fileInfo.absoluteFilePath(), &unmetDependencies)) {
         if (options->verbose)
-            fprintf(stdout, "  -- Skipping %s. It has unmet dependencies.\n", qPrintable(fileInfo.absoluteFilePath()));
+            fprintf(stdout, "  -- Skipping %s. It has unmet dependencies: %s.\n",
+                    qPrintable(fileInfo.absoluteFilePath()),
+                    qPrintable(unmetDependencies.join(QLatin1Char(','))));
         return true;
     }
 
@@ -1533,9 +1544,13 @@ bool copyQtFiles(Options *options)
                 return false;
             }
 
-            if (!goodToCopy(options, sourceFileName)) {
-                if (options->verbose)
-                    fprintf(stdout, "  -- Skipping %s. It has unmet dependencies.\n", qPrintable(sourceFileName));
+            QStringList unmetDependencies;
+            if (!goodToCopy(options, sourceFileName, &unmetDependencies)) {
+                if (options->verbose) {
+                    fprintf(stdout, "  -- Skipping %s. It has unmet dependencies: %s.\n",
+                            qPrintable(sourceFileName),
+                            qPrintable(unmetDependencies.join(QLatin1Char(','))));
+                }
                 continue;
             }