mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-29 19:24:33 +00:00
git added import scaner
This commit is contained in:
parent
b22d5df18d
commit
b1cacbfe2d
@ -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");
|
||||||
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
24
README.md
24
README.md
@ -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
|
||||||
[](https://snapcraft.io/cqtdeployer)
|
[](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
|
||||||
[](https://snapcraft.io/cqtdeployer)
|
[](https://snapcraft.io/cqtdeployer)
|
||||||
|
|
||||||
#### Внимание!!!
|
|
||||||
это приложение может работать не стабильно в изолированном контейнере, Для решения этих проблемм используйте становку через консоль в рижеми Classic
|
|
||||||
```bash
|
|
||||||
snap install cqtdeployer --classic
|
|
||||||
```
|
|
||||||
|
|
||||||
|
|
||||||
## Установить
|
## Установить
|
||||||
Вы можете загрузить последнюю версию приложения [здесь](https://github.com/QuasarApp/Console-QtDeployer/releases).
|
Вы можете загрузить последнюю версию приложения [здесь](https://github.com/QuasarApp/Console-QtDeployer/releases).
|
||||||
|
@ -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"),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user