git added import scaner

This commit is contained in:
Andrei Yankovich 2019-03-28 19:23:22 +03:00
parent b22d5df18d
commit b1cacbfe2d
8 changed files with 70 additions and 29 deletions

View File

@ -14,7 +14,7 @@
#include <QList> #include <QList>
int main(int argc, char *argv[]) { int main(int argc, const char *argv[]) {
QCoreApplication::setOrganizationName("QuasarApp"); QCoreApplication::setOrganizationName("QuasarApp");
QCoreApplication::setOrganizationDomain("https://github.com/QuasarApp"); QCoreApplication::setOrganizationDomain("https://github.com/QuasarApp");

View File

@ -108,6 +108,13 @@ QStringList DependenciesScanner::scan(const QString &path) {
for (auto i : info.dependncies) { for (auto i : info.dependncies) {
auto libs = getLibsFromEnvirement(i); auto libs = getLibsFromEnvirement(i);
if (!libs.size()) {
QuasarAppUtils::Params::verboseLog("lib for dependese " + i + " not findet!!",
QuasarAppUtils::Warning);
continue;
}
result.push_back(libs.first().fullPath()); result.push_back(libs.first().fullPath());
} }

View File

@ -24,12 +24,12 @@ bool Deploy::getDeployQml() const { return deployQml; }
void Deploy::setDeployQml(bool value) { deployQml = value; } void Deploy::setDeployQml(bool value) { deployQml = value; }
QString Deploy::getQmlScaner() const { return qmlScaner; } QString Deploy::getQmlScaner() const { return externQmlScaner; }
void Deploy::setQmlScaner(const QString &value) { void Deploy::setQmlScaner(const QString &value) {
qmlScaner = QDir::fromNativeSeparators(value); externQmlScaner = QDir::fromNativeSeparators(value);
QuasarAppUtils::Params::verboseLog("qmlScaner = " + qmlScaner); QuasarAppUtils::Params::verboseLog("qmlScaner = " + externQmlScaner);
deployQml = QFileInfo(qmlScaner).isFile(); deployQml = QFileInfo(externQmlScaner).isFile();
} }
QString Deploy::getQmake() const { return qmake; } QString Deploy::getQmake() const { return qmake; }
@ -42,6 +42,7 @@ void Deploy::setQmake(const QString &value) {
if (!dir.cdUp() || !dir.cd("qml")) { if (!dir.cdUp() || !dir.cd("qml")) {
QuasarAppUtils::Params::verboseLog("get qml fail!"); QuasarAppUtils::Params::verboseLog("get qml fail!");
return;
} }
qmlDir = dir.absolutePath(); qmlDir = dir.absolutePath();
@ -50,6 +51,7 @@ void Deploy::setQmake(const QString &value) {
dir = (info.absoluteDir()); dir = (info.absoluteDir());
if (!dir.cdUp() || !dir.cd("translations")) { if (!dir.cdUp() || !dir.cd("translations")) {
QuasarAppUtils::Params::verboseLog("get translations fail!"); QuasarAppUtils::Params::verboseLog("get translations fail!");
return;
} }
translationDir = dir.absolutePath(); translationDir = dir.absolutePath();
@ -749,7 +751,7 @@ QStringList Deploy::extractImportsFromDir(const QString &filepath) {
env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", DeployUtils::qtDir + "/plugins/platforms"); env.insert("QT_QPA_PLATFORM_PLUGIN_PATH", DeployUtils::qtDir + "/plugins/platforms");
p.setProcessEnvironment(env); p.setProcessEnvironment(env);
p.setProgram(qmlScaner); p.setProgram(externQmlScaner);
p.setArguments(QStringList() p.setArguments(QStringList()
<< "-rootPath" << filepath << "-importPath" << qmlDir); << "-rootPath" << filepath << "-importPath" << qmlDir);
p.start(); p.start();
@ -831,16 +833,31 @@ bool Deploy::extractQmlFromSource(const QString& sourceDir) {
return false; return false;
} }
QStringList plugins = extractImportsFromDir(info.absoluteFilePath()); QStringList plugins;
QStringList listItems; QStringList listItems;
QStringList filter;
for (auto &&i: plugins) {
QuasarAppUtils::Params::verboseLog(i); if (QuasarAppUtils::Params::isEndable("qmlExtern")) {
qInfo() << "use extern qml scaner!";
plugins = extractImportsFromDir(info.absoluteFilePath());
filter << ".so.debug" << "d.dll";
} else {
qInfo() << "use own qml scaner!";
QML ownQmlScaner(qmlDir);
if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
QuasarAppUtils::Params::verboseLog("qml scaner run failed!");
return false;
}
} }
if (!copyFolder(qmlDir, targetDir + "/qml", if (!copyFolder(qmlDir, targetDir + "/qml",
QStringList() << ".so.debug" << "d.dll", filter , &listItems, &plugins)) {
&listItems, &plugins)) {
return false; return false;
} }

View File

@ -13,6 +13,7 @@
#include <QStringList> #include <QStringList>
#include <dependenciesscanner.h> #include <dependenciesscanner.h>
#include "deploy_global.h" #include "deploy_global.h"
#include "qml.h"
class DEPLOYSHARED_EXPORT Deploy { class DEPLOYSHARED_EXPORT Deploy {
private: private:
@ -22,7 +23,8 @@ class DEPLOYSHARED_EXPORT Deploy {
QStringList deployedFiles; QStringList deployedFiles;
QSettings settings; QSettings settings;
QString qmlScaner = ""; QString externQmlScaner = "";
QString qmake = ""; QString qmake = "";
/** /**
* @brief targets * @brief targets

View File

@ -162,6 +162,8 @@ void DeployUtils::help() {
qInfo() << " -targetDir [params] : set target Dir for binaryes (default is path of first target)"; qInfo() << " -targetDir [params] : set target Dir for binaryes (default is path of first target)";
qInfo() << " noStrip : skip strip step"; qInfo() << " noStrip : skip strip step";
qInfo() << " noTranslations : skip translations files"; qInfo() << " noTranslations : skip translations files";
qInfo() << " qmlExtern : use qml external scanner (qmlimportscaner)";
qInfo() << " | not work without qmake and in snap package";
qInfo() << " verbose : show debug log"; qInfo() << " verbose : show debug log";

@ -1 +1 @@
Subproject commit 02d3e668851fc24149edd4db8f26946d66a88c8e Subproject commit f16b511e6c9a415ee457dc931d8b2566c263294a

View File

@ -38,7 +38,9 @@ Key differences of this program:
| -targetDir [params] | set target Dir for binaryes (default is path of first target) | | -targetDir [params] | set target Dir for binaryes (default is path of first target) |
| noStrip | skip strip step | | noStrip | skip strip step |
| noTranslations | skip translations files | | noTranslations | skip translations files |
| verbose | show debug log | | qmlExtern | use qml external scanner (qmlimportscaner) |
| | not work without qmake and in snap package |
| -verbose [0-3] | show debug log |
@ -59,12 +61,6 @@ You can download the latest version of the application [here](https://github.com
### Snap ### Snap
[![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/cqtdeployer) [![Get it from the Snap Store](https://snapcraft.io/static/images/badges/en/snap-store-black.svg)](https://snapcraft.io/cqtdeployer)
#### Attention!!!
This application may not work stably in an isolated container. To solve these problems, use the console installation in the Classic box.
```bash
snap install cqtdeployer --classic
```
## Donate ## Donate
If you want to help the project, then you can donate a small amount to our bitcoin wallet. If you want to help the project, then you can donate a small amount to our bitcoin wallet.
@ -106,9 +102,11 @@ Console QtDeployer является консольной реализацией
| -extraPlugin [list,params] | Установить дополнительный путь для extraPlugin приложения | | -extraPlugin [list,params] | Установить дополнительный путь для extraPlugin приложения |
| -recursiveDepth [params] | Установит глубену поиска библиотек (по умолчанию 0) | | -recursiveDepth [params] | Установит глубену поиска библиотек (по умолчанию 0) |
| -targetDir [params] | Установит целевой коталог (по умолчанию это путь к первому развертываемому файлу)| | -targetDir [params] | Установит целевой коталог (по умолчанию это путь к первому развертываемому файлу)|
| noStrip | пропустить шаг strip | | noStrip | Пропустить шаг strip |
| noTranslations | пропустить файлы переводов | | noTranslations | Пропустить файлы переводов |
| verbose | Показ дебаг лога | | qmlExtern | Использовать внешний сканер qml (qmlimportscaner) |
| | не работает без qmake и в snap |
| -verbose [0-3] | Показ дебаг лога |
#### Пример: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear #### Пример: cqtdeployer -bin myApp -qmlDir ~/MyAppProject/qml -qmake ~/Qt/5.11.1/gcc_64/bin/qmake clear
@ -124,12 +122,6 @@ Console QtDeployer является консольной реализацией
### Snap ### Snap
[![Загрузите из Snap Store](https://snapcraft.io/static/images/badges/ru/snap-store-black.svg)](https://snapcraft.io/cqtdeployer) [![Загрузите из Snap Store](https://snapcraft.io/static/images/badges/ru/snap-store-black.svg)](https://snapcraft.io/cqtdeployer)
#### Внимание!!!
это приложение может работать не стабильно в изолированном контейнере, Для решения этих проблемм используйте становку через консоль в рижеми Classic
```bash
snap install cqtdeployer --classic
```
## Установить ## Установить
Вы можете загрузить последнюю версию приложения [здесь](https://github.com/QuasarApp/Console-QtDeployer/releases). Вы можете загрузить последнюю версию приложения [здесь](https://github.com/QuasarApp/Console-QtDeployer/releases).

View File

@ -47,6 +47,7 @@ private slots:
void testExtractLib(); void testExtractLib();
void testQmlExtract(); void testQmlExtract();
void mainTestOnlyC();
}; };
deploytest::deploytest(){} deploytest::deploytest(){}
@ -336,6 +337,26 @@ void deploytest::testQmlExtract() {
} }
} }
void deploytest::mainTestOnlyC()
{
#ifdef WITH_ALL_TESTS
int argc = 3;
const char * argv[] = {"./", "-bin", "./../../../tests/build/TestOnlyC"};
QVERIFY(QuasarAppUtils::Params::parseParams(argc, argv));
Deploy deploy;
QVERIFY(DeployUtils::parseQt(&deploy));
deploy.deploy();
QDir info("./Distro");
QVERIFY(info.removeRecursively());
#endif
}
void deploytest::testTranslations() { void deploytest::testTranslations() {
QStringList trList = { QStringList trList = {
("./test/QtDir/translations/qtbase_ru.qm"), ("./test/QtDir/translations/qtbase_ru.qm"),