From 4b711fec48c395ab4e486dd1a789309d4d488e9d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Morten=20Johan=20S=C3=B8rvig?= <morten.sorvig@digia.com>
Date: Wed, 23 Apr 2014 16:06:46 +0200
Subject: [PATCH] Ignore local and non-filesystem qml imports.
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Make macdeplpoyqt deploy qml imports from Qml2ImportsPath
only. js and local imports should be deployed as a
part of the application build. Remote (network) imports
should be loaded at run-time.

Task-number: QTBUG-38533
Change-Id: I322f588912bcbb65fbc45676faaa3de76d625bef
Reviewed-by: Morten Johan Sørvig <morten.sorvig@digia.com>
---
 src/macdeployqt/shared/shared.cpp | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 722f1be3a..bf93898b6 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -716,6 +716,24 @@ void deployQmlImports(const QString &appBundlePath, QStringList &qmlDirs)
         QJsonObject import = importValue.toObject();
         QString name = import["name"].toString();
         QString path = import["path"].toString();
+        QString type = import["type"].toString();
+
+        LogNormal() << "Deploying QML import" << name;
+
+        // Skip imports with missing info - path will be empty if the import is not found.
+        if (name.isEmpty() || path.isEmpty()) {
+            LogNormal() << "  Skip import: name or path is empty";
+            LogNormal() << "";
+            continue;
+        }
+
+        // Deploy module imports only, skip directory (local/remote) and js imports. These
+        // should be deployed as a part of the application build.
+        if (type != QStringLiteral("module")) {
+            LogNormal() << "  Skip non-module import";
+            LogNormal() << "";
+            continue;
+        }
 
         // Create the destination path from the name
         // and version (grabbed from the source path)
-- 
GitLab