From 757853855f181b034e777a26c39be7555481a14f Mon Sep 17 00:00:00 2001 From: "a.yankovich" Date: Mon, 17 Sep 2018 11:17:04 +0300 Subject: [PATCH] ref extract only C libs #14 --- CQtDeployer/deploy.cpp | 15 +++++++++++---- CQtDeployer/deploy.h | 2 ++ CQtDeployer/main.cpp | 34 +++++++++++++++++++--------------- 3 files changed, 32 insertions(+), 19 deletions(-) diff --git a/CQtDeployer/deploy.cpp b/CQtDeployer/deploy.cpp index a860c51..671dd16 100644 --- a/CQtDeployer/deploy.cpp +++ b/CQtDeployer/deploy.cpp @@ -139,15 +139,18 @@ void Deploy::deploy() { } extract(target); - copyPlugins(neededPlugins); - if (deployQml && !extractQml()) { + if (!onlyCLibs) + copyPlugins(neededPlugins); + + if (!onlyCLibs && deployQml && !extractQml()) { qCritical() << "qml not extacted!"; } - copyFiles(QtLibs, targetDir + QDir::separator() + "lib"); + if (!onlyCLibs) + copyFiles(QtLibs, targetDir + QDir::separator() + "lib"); - if (QuasarAppUtils::isEndable("deploy-not-qt")) { + if (onlyCLibs || QuasarAppUtils::isEndable("deploy-not-qt")) { copyFiles(noQTLibs, targetDir + QDir::separator() + "lib"); } @@ -174,6 +177,10 @@ void Deploy::setQtDir(const QString &value) { qtDir = value; } +void Deploy::setOnlyCLibs(bool value) { + onlyCLibs = value; +} + bool Deploy::isQtLib(const QString &lib) const { QFileInfo info(lib); return info.absolutePath().contains(qtDir); diff --git a/CQtDeployer/deploy.h b/CQtDeployer/deploy.h index 7986784..eec674b 100644 --- a/CQtDeployer/deploy.h +++ b/CQtDeployer/deploy.h @@ -15,6 +15,7 @@ class Deploy { private: bool deployQml = false; + bool onlyCLibs = false; QString qmlScaner = ""; QString qmake = ""; QString qtDir = ""; @@ -70,6 +71,7 @@ public: void clear(); bool initDirs(); + void setOnlyCLibs(bool value); }; #endif // DEPLOY_H diff --git a/CQtDeployer/main.cpp b/CQtDeployer/main.cpp index 5acb32e..3b27958 100644 --- a/CQtDeployer/main.cpp +++ b/CQtDeployer/main.cpp @@ -42,19 +42,10 @@ void help() { } bool parseQt(Deploy& deploy) { - auto qmake = QuasarAppUtils::getStrArg("qmake"); - QString basePath = ""; - QFileInfo info(qmake); - if (!info.isFile() || (info.baseName() != "qmake")) { - return false; - } - basePath = info.absolutePath(); - deploy.setQmake(qmake); - auto scaner = basePath + QDir::separator() + "qmlimportscanner"; auto bin = QuasarAppUtils::getStrArg("bin"); - info.setFile(bin); + QFileInfo info(bin); if (!info.isFile()) { return false; } @@ -64,16 +55,29 @@ bool parseQt(Deploy& deploy) { return false; } - if (QuasarAppUtils::isEndable("clear")) { - qInfo() << "clear old data"; - deploy.clear(); - } - if (!deploy.initDirs()) { qCritical() << "error init targeet dir"; return false; } + auto qmake = QuasarAppUtils::getStrArg("qmake"); + QString basePath = ""; + info.setFile(qmake); + if (!info.isFile() || (info.baseName() != "qmake")) { + qInfo() << "deploy only C libs because qmake is not found"; + deploy.setOnlyCLibs(true); + return true; + } + + basePath = info.absolutePath(); + deploy.setQmake(qmake); + auto scaner = basePath + QDir::separator() + "qmlimportscanner"; + + if (QuasarAppUtils::isEndable("clear")) { + qInfo() << "clear old data"; + deploy.clear(); + } + auto qmlDir = QuasarAppUtils::getStrArg("qmlDir"); QDir dir(basePath);