Merge pull request #19 from QuasarApp/ExtraPlugins

extra plugins #17
This commit is contained in:
Andrei Yankovich 2018-09-20 16:40:10 +03:00 committed by GitHub
commit 1db3644b8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 41 additions and 10 deletions

View File

@ -179,6 +179,16 @@ void Deploy::setExtraPath(const QStringList &value) {
}
}
void Deploy::setExtraPlugins(const QStringList &value) {
for(auto i: value) {
if (QFile::exists(i)) {
extraPlugins.append(i);
} else {
qWarning() << i << " does not exist! and skiped";
}
}
}
bool Deploy::isQtLib(const QString &lib) const {
QFileInfo info(lib);
return info.absolutePath().contains(qtDir);
@ -287,7 +297,8 @@ void Deploy::extract(const QString &file, bool isExtractPlugins) {
continue;
}
if (QuasarAppUtils::isEndable("deploy-not-qt") &&
if ((QuasarAppUtils::isEndable("deploy-not-qt") ||
onlyCLibs) &&
!noQTLibs.contains(line)) {
noQTLibs << line;
extract(line, isExtractPlugins);
@ -378,6 +389,20 @@ void Deploy::copyPlugins(const QStringList &list) {
qWarning () << plugin << " not copied!";
}
}
QFileInfo info;
for (auto extraPlugin : extraPlugins) {
info.setFile(extraPlugin);
if (info.isDir()) {
QDir from(info.absoluteDir());
QDir to(targetDir + QDir::separator() + "plugins");
copyFolder(from, to, ".so.debug");
} else {
copyFile(info.absoluteFilePath(), targetDir + QDir::separator() + "plugins");
extract(info.absoluteFilePath());
}
}
}
bool Deploy::copyFolder( QDir &from, QDir &to, const QString& filter,

View File

@ -29,7 +29,7 @@ private:
QStringList neededPlugins;
QStringList ignoreList;
QStringList extraPath;
QStringList extraPlugins;
bool isQtLib(const QString& lib) const;
@ -75,6 +75,7 @@ public:
bool initDirs();
void setOnlyCLibs(bool value);
void setExtraPath(const QStringList &value);
void setExtraPlugins(const QStringList &value);
};
#endif // DEPLOY_H

View File

@ -34,11 +34,13 @@ void help() {
qInfo() << " | (not recommended, as it takes up a lot of memory)";
qInfo() << " -libDir [list,params] : set additional path for extralib of app.";
qInfo() << " | for example -libDir ~/myLib,~/newLibs";
qInfo() << " -extraPlugin[list,params]: set additional path for extraPlugin of app";
qInfo() << "";
qInfo() << "Example: CDQ -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear";
qInfo() << "Example (only C libs): CDQ -bin myApp clear";
}
bool parseQt(Deploy& deploy) {
@ -55,9 +57,15 @@ bool parseQt(Deploy& deploy) {
return false;
}
auto list = QuasarAppUtils::getStrArg("libDir").split(",");
if (QuasarAppUtils::isEndable("clear")) {
qInfo() << "clear old data";
deploy.clear();
}
deploy.setExtraPath(list);
auto listLibDir = QuasarAppUtils::getStrArg("libDir").split(",");
auto listExtraPlugin = QuasarAppUtils::getStrArg("extraPlugin").split(",");
deploy.setExtraPath(listLibDir);
deploy.setExtraPlugins(listExtraPlugin);
if (!deploy.initDirs()) {
qCritical() << "error init targeet dir";
@ -77,11 +85,6 @@ bool parseQt(Deploy& deploy) {
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);

View File

@ -35,6 +35,7 @@ Key differences of this program:
| | (not recommended, as it takes up a lot of memory) |
| -libDir [list,params] | set additional path for extralib of app |
| | for example -libDir ~/myLib,~/newLibs |
| -extraPlugin [list,params] | set additional path for extraPlugin of app |
@ -89,6 +90,7 @@ Console QtDeployer является консольной реализацией
| | (не рекомендуется, так как занимает много памяти) |
| -libDir [list,params] | установит дополнительные пути к библиотекам |
| | пример -libDir ~/myLib,~/newLibs |
| -extraPlugin [list,params] | установить дополнительный путь для extraPlugin приложения |
#### Пример: CQtDeployer -bin myApp -qmlDir ~/Qt/5.11.1/gcc_64/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear