androiddeployqt: Don't bundle QML files in project
authorEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Tue, 6 Jan 2015 08:43:19 +0000 (09:43 +0100)
committerEskil Abrahamsen Blomfeldt <eskil.abrahamsen-blomfeldt@theqtcompany.com>
Tue, 6 Jan 2015 10:32:25 +0000 (11:32 +0100)
Sometimes qmlimportscanner will generate dependencies on files
local to the QML root path. This happens specifically when
you have an

    import "../"

in one of your files. Since the files in the input project are
already installed in some way, we don't need to include them under
assets, so we skip these files.

[ChangeLog][Android] Fixed bug where androiddeployqt would
automatically bundle some QML files in your input project
along with their dependencies.

Change-Id: I186df8213024100e5e9ee862eadb3ca568fa6dea
Task-number: QTBUG-43573
Reviewed-by: Christian Stromme <christian.stromme@theqtcompany.com>
src/androiddeployqt/main.cpp

index 925f2c5..483f75d 100644 (file)
@@ -1656,11 +1656,16 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
 
     QString rootPath = options->rootPath;
     if (rootPath.isEmpty())
-        rootPath = QFileInfo(options->inputFileName).path();
+        rootPath = QFileInfo(options->inputFileName).absolutePath();
+    else
+        rootPath = QFileInfo(rootPath).absoluteFilePath();
+
+    if (!rootPath.endsWith(QLatin1Char('/')))
+        rootPath += QLatin1Char('/');
 
     QStringList importPaths;
     importPaths += shellQuote(options->qtInstallDirectory + QLatin1String("/qml"));
-    importPaths += QFileInfo(rootPath).absoluteFilePath();
+    importPaths += rootPath;
     foreach (QString qmlImportPath, options->qmlImportPaths)
         importPaths += shellQuote(qmlImportPath);
 
@@ -1713,6 +1718,16 @@ bool scanImports(Options *options, QSet<QString> *usedDependencies)
                 continue;
             }
 
+            QString absolutePath = info.absolutePath();
+            if (!absolutePath.endsWith(QLatin1Char('/')))
+                absolutePath += QLatin1Char('/');
+
+            if (absolutePath.startsWith(rootPath)) {
+                if (options->verbose)
+                    fprintf(stdout, "    -- Skipping because file is in QML root path.\n");
+                continue;
+            }
+
             QString importPathOfThisImport;
             foreach (QString importPath, importPaths) {
 #if defined(Q_OS_WIN32)