mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-27 10:14:32 +00:00
fix build
This commit is contained in:
parent
624b502736
commit
66460f4dab
@ -284,6 +284,31 @@ bool ConfigParser::initDustroStruct() {
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigParser::initQmlInput() {
|
||||
|
||||
auto qmlDir = QuasarAppUtils::Params::getStrArg("qmlDir").
|
||||
split(DeployCore::getSeparator(0));
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("allQmlDependes")) {
|
||||
_config.deployQml = true;
|
||||
}
|
||||
|
||||
for (auto& str: qmlDir) {
|
||||
|
||||
if (QFileInfo::exists(str)) {
|
||||
_config.deployQml = true;
|
||||
|
||||
auto targetVal = str.split(DeployCore::getSeparator(1));
|
||||
_config.prefixes[targetVal.value(1, "")].addQmlInput(targetVal.value(0, ""));
|
||||
} else {
|
||||
QuasarAppUtils::Params::verboseLog("qml dir not exits!",
|
||||
QuasarAppUtils::VerboseLvl::Warning);
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigParser::parseQtDeployMode() {
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("deploySystem-with-libc")) {
|
||||
@ -334,16 +359,7 @@ bool ConfigParser::parseQtDeployMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
auto qmlDir = QuasarAppUtils::Params::getStrArg("qmlDir");
|
||||
|
||||
if (QFileInfo::exists(qmlDir) ||
|
||||
QuasarAppUtils::Params::isEndable("allQmlDependes")) {
|
||||
_config.deployQml = true;
|
||||
|
||||
} else {
|
||||
QuasarAppUtils::Params::verboseLog("qml dir not exits!",
|
||||
QuasarAppUtils::VerboseLvl::Warning);
|
||||
}
|
||||
initQmlInput();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -56,6 +56,8 @@ private:
|
||||
QString getPathFrmoQmakeLine(const QString& in) const;
|
||||
bool initQmakePrivate(const QString& qmake);
|
||||
bool initQmake();
|
||||
bool initQmlInput();
|
||||
|
||||
bool setQmake(const QString &value);
|
||||
bool setQtDir(const QString &value);
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
//#
|
||||
|
||||
#include "dependencymap.h"
|
||||
#include "deploycore.h"
|
||||
#include "quasarapp.h"
|
||||
|
||||
DependencyMap::DependencyMap() {
|
||||
@ -51,6 +52,7 @@ void DependencyMap::addSystemLib(const QString &lib) {
|
||||
|
||||
void DependencyMap::addNeadedLib(const QString &lib) {
|
||||
_neadedLibs.insert(lib);
|
||||
DeployCore::addQtModule(_qtModules, lib);
|
||||
}
|
||||
|
||||
void DependencyMap::removeModule(DeployCore::QtModule module) {
|
||||
|
@ -31,6 +31,14 @@ DistroStruct DeployConfig::getDistro(const QString &target) const {
|
||||
return prefixes.value(targets.value(target).getSufix());
|
||||
}
|
||||
|
||||
DistroStruct DeployConfig::getDistroFromPrefix(const QString &prefix) const {
|
||||
if (prefixes.contains(prefix)) {
|
||||
return prefixes[prefix];
|
||||
}
|
||||
|
||||
return prefixes.value("");
|
||||
}
|
||||
|
||||
bool QtDir::isQt(const QString& path) const {
|
||||
|
||||
return
|
||||
|
@ -108,6 +108,13 @@ public:
|
||||
*/
|
||||
DistroStruct getDistro(const QString& target) const;
|
||||
|
||||
/**
|
||||
* @brief getDistroFromPrefix
|
||||
* @param prefix
|
||||
* @return distro struct from prefix
|
||||
*/
|
||||
DistroStruct getDistroFromPrefix(const QString& prefix) const;
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
|
@ -172,7 +172,7 @@ QString DeployCore::help() {
|
||||
{ " -binDir [params] : A folder which includes deployable files (recursive search)." },
|
||||
{ " | WARNING: this flag supports 'so', 'dll' and 'exe' files only." },
|
||||
{ " | Use '-bin' flag if you want to deploy linux binary files" },
|
||||
{ " -qmlDir [params] : Qml data dir. For example -qmlDir ~/my/project/qml" },
|
||||
{ " -qmlDir [prefix;path,path]: Qml data dir. For example -qmlDir ~/my/project/qml" },
|
||||
{ " deploySystem : Deploys all libs" },
|
||||
{ " deploySystem-with-libc : Skip Deploys system core libs libs" },
|
||||
{ " -qmake [params] : Qmake path." },
|
||||
@ -203,12 +203,12 @@ QString DeployCore::help() {
|
||||
{ " noTranslations : Skips the translations files." },
|
||||
{ " | It doesn't work without qmake and inside a snap package" },
|
||||
{ " -noAutoCheckQmake : Disables automatic search of paths to qmake in executable files." },
|
||||
{ " -qmlOut [prefix;path,path] : Sets path to qml out directory" },
|
||||
{ " -libOut [prefix;path,path] : Sets path to libraries out directory" },
|
||||
{ " -trOut [prefix;path,path] : Sets path to translations out directory" },
|
||||
{ " -pluginOut [prefix;path,path]: Sets path to plugins out directory" },
|
||||
{ " -binOut [prefix;path,path] : Sets path to binary out directory" },
|
||||
{ " -recOut [prefix;path,path] : Sets path to recurses out directory" },
|
||||
{ " -qmlOut [path;prefix;target,path] : Sets path to qml out directory" },
|
||||
{ " -libOut [path;prefix;target,path] : Sets path to libraries out directory" },
|
||||
{ " -trOut [path;prefix;target,path] : Sets path to translations out directory" },
|
||||
{ " -pluginOut [path;prefix;target,path]: Sets path to plugins out directory" },
|
||||
{ " -binOut [path;prefix;target,path] : Sets path to binary out directory" },
|
||||
{ " -recOut [path;prefix;target,path] : Sets path to recurses out directory" },
|
||||
|
||||
{ " -qif [params] : Create the QIF installer for deployement programm" },
|
||||
{ " : By default params value is 'Default'" },
|
||||
@ -266,7 +266,7 @@ QStringList DeployCore::helpKeys() {
|
||||
};
|
||||
}
|
||||
|
||||
QStringList DeployCore::extractTranslation(const QStringList &libs) {
|
||||
QStringList DeployCore::extractTranslation(const QSet<QString> &libs) {
|
||||
QSet<QString> res;
|
||||
const size_t qtModulesCount = sizeof(qtModuleEntries) / sizeof(QtModuleEntry);
|
||||
|
||||
|
@ -146,7 +146,7 @@ public:
|
||||
static QString help();
|
||||
static QStringList helpKeys();
|
||||
|
||||
static QStringList extractTranslation(const QStringList& libs);
|
||||
static QStringList extractTranslation(const QSet<QString> &libs);
|
||||
static QString getAppVersion();
|
||||
static QString getQtVersion();
|
||||
static void printVersion();
|
||||
|
@ -15,3 +15,15 @@ void DistroModule::setTargets(const QSet<QString> &targets) {
|
||||
void DistroModule::addTarget(const QString &target) {
|
||||
_targets.insert(target);
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::qmlInput() const {
|
||||
return _qmlInput;
|
||||
}
|
||||
|
||||
void DistroModule::setQmlInput(const QSet<QString> &qmlInput) {
|
||||
_qmlInput = qmlInput;
|
||||
}
|
||||
|
||||
void DistroModule::addQmlInput(const QString &target) {
|
||||
_qmlInput.insert(target);
|
||||
}
|
||||
|
@ -12,9 +12,16 @@ public:
|
||||
QSet<QString> targets() const;
|
||||
void setTargets(const QSet<QString> &targets);
|
||||
void addTarget(const QString& target);
|
||||
|
||||
QSet<QString> qmlInput() const;
|
||||
void setQmlInput(const QSet<QString> &qmlInput);
|
||||
void addQmlInput(const QString& target);
|
||||
|
||||
|
||||
private:
|
||||
|
||||
QSet<QString> _targets;
|
||||
QSet<QString> _qmlInput;
|
||||
};
|
||||
|
||||
#endif // DISTROMODULE_H
|
||||
|
@ -36,39 +36,54 @@ bool Extracter::deployMSVC() {
|
||||
return _fileManager->copyFile(msvcInstaller, DeployCore::_config->getTargetDir());
|
||||
}
|
||||
|
||||
bool Extracter::extractWebEngine(const QString& prefix) {
|
||||
bool Extracter::isWebEngine(const QString &prefix) const {
|
||||
auto qtModules = _prefixDependencyes.value(prefix).qtModules();
|
||||
auto test = static_cast<quint64>(qtModules) & static_cast<quint64>(DeployCore::QtModule::QtWebEngineModule);
|
||||
if (test) {
|
||||
auto webEngeneBin = DeployCore::_config->qtDir.libexecs;
|
||||
if (DeployCore::_config->qtDir.qtPlatform & Platform::Unix) {
|
||||
webEngeneBin += "/QtWebEngineProcess";
|
||||
} else {
|
||||
webEngeneBin += "/QtWebEngineProcess.exe";
|
||||
}
|
||||
|
||||
auto destWebEngine = DeployCore::_config->getTargetDir() + prefix + DeployCore::_config->prefixes[prefix].getBinOutDir();
|
||||
auto resOut = DeployCore::_config->getTargetDir() + prefix + DeployCore::_config->prefixes[prefix].getResOutDir();
|
||||
auto res = DeployCore::_config->qtDir.resources;
|
||||
return static_cast<quint64>(qtModules) & static_cast<quint64>(DeployCore::QtModule::QtWebEngineModule);
|
||||
}
|
||||
|
||||
if (!_fileManager->copyFile(webEngeneBin, destWebEngine)) {
|
||||
return false;
|
||||
}
|
||||
bool Extracter::extractWebEngine() {
|
||||
|
||||
if (!_fileManager->copyFolder(res, resOut)) {
|
||||
return false;
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
|
||||
auto prefix = i.key();
|
||||
if (isWebEngine(prefix)) {
|
||||
auto webEngeneBin = DeployCore::_config->qtDir.libexecs;
|
||||
if (DeployCore::_config->qtDir.qtPlatform & Platform::Unix) {
|
||||
webEngeneBin += "/QtWebEngineProcess";
|
||||
} else {
|
||||
webEngeneBin += "/QtWebEngineProcess.exe";
|
||||
}
|
||||
|
||||
auto destWebEngine = DeployCore::_config->getTargetDir() + prefix + DeployCore::_config->prefixes[prefix].getBinOutDir();
|
||||
auto resOut = DeployCore::_config->getTargetDir() + prefix + DeployCore::_config->prefixes[prefix].getResOutDir();
|
||||
auto res = DeployCore::_config->qtDir.resources;
|
||||
|
||||
if (!_fileManager->copyFile(webEngeneBin, destWebEngine)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_fileManager->copyFolder(res, resOut)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Extracter::copyPlugin(const QString &plugin) {
|
||||
bool Extracter::copyPlugin(const QString &plugin, const QString& prefix) {
|
||||
|
||||
QStringList listItems;
|
||||
|
||||
auto pluginPath = DeployCore::_config->targetDir +
|
||||
DeployCore::_config->distroStruct.getPluginsOutDir() +
|
||||
auto cnf = DeployCore::_config;
|
||||
auto targetPath = cnf->getTargetDir() + prefix;
|
||||
auto distro = cnf->getDistroFromPrefix(prefix);
|
||||
|
||||
|
||||
auto pluginPath = targetPath + distro.getPluginsOutDir() +
|
||||
QFileInfo(plugin).fileName();
|
||||
|
||||
if (!_fileManager->copyFolder(plugin, pluginPath,
|
||||
@ -78,18 +93,22 @@ bool Extracter::copyPlugin(const QString &plugin) {
|
||||
|
||||
for (auto item : listItems) {
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(item);
|
||||
extract(item, &_prefixDependencyes[prefix]);
|
||||
} else {
|
||||
extract(item, "Qt");
|
||||
extract(item, &_prefixDependencyes[prefix], "Qt");
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Extracter::copyExtraPlugins() {
|
||||
void Extracter::copyExtraPlugins(const QString& prefix) {
|
||||
QFileInfo info;
|
||||
|
||||
auto cnf = DeployCore::_config;
|
||||
auto targetPath = cnf->getTargetDir() + prefix;
|
||||
auto distro = cnf->getDistroFromPrefix(prefix);
|
||||
|
||||
for (auto extraPlugin : DeployCore::_config->extraPlugins) {
|
||||
|
||||
if (!PathUtils::isPath(extraPlugin)) {
|
||||
@ -98,40 +117,38 @@ void Extracter::copyExtraPlugins() {
|
||||
|
||||
info.setFile(extraPlugin);
|
||||
if (info.isDir() && DeployCore::_config->qtDir.isQt(info.absoluteFilePath())) {
|
||||
copyPlugin(info.absoluteFilePath());
|
||||
copyPlugin(info.absoluteFilePath(), prefix);
|
||||
|
||||
} else if (info.exists()) {
|
||||
_fileManager->copyFile(info.absoluteFilePath(),
|
||||
DeployCore::_config->targetDir + DeployCore::_config->distroStruct.getPluginsOutDir());
|
||||
targetPath + distro.getPluginsOutDir());
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(info.absoluteFilePath());
|
||||
extract(info.absoluteFilePath(), &_prefixDependencyes[prefix]);
|
||||
} else {
|
||||
extract(info.absoluteFilePath(), "Qt");
|
||||
extract(info.absoluteFilePath(), &_prefixDependencyes[prefix], "Qt");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyPlugins(const QStringList &list) {
|
||||
void Extracter::copyPlugins(const QStringList &list, const QString& prefix) {
|
||||
for (auto plugin : list) {
|
||||
if (!copyPlugin(plugin)) {
|
||||
if (!copyPlugin(plugin, prefix)) {
|
||||
qWarning() << plugin << " not copied!";
|
||||
}
|
||||
}
|
||||
copyExtraPlugins();
|
||||
copyExtraPlugins(prefix);
|
||||
}
|
||||
|
||||
void Extracter::extractAllTargets() {
|
||||
for (auto i = DeployCore::_config->targets.cbegin(); i != DeployCore::_config->targets.cend(); ++i) {
|
||||
_targetDependencyes[i.key()] = {};
|
||||
extract(i.key());
|
||||
}
|
||||
}
|
||||
auto cfg = DeployCore::_config;
|
||||
for (auto i = cfg->prefixes.cbegin(); i != cfg->prefixes.cend(); ++i) {
|
||||
_prefixDependencyes[i.key()] = {};
|
||||
|
||||
void Extracter::initQtModules() {
|
||||
for (auto i: neadedLibs) {
|
||||
DeployCore::addQtModule(_qtModules, i);
|
||||
for (auto target : i.value().targets()) {
|
||||
extract(target, &_prefixDependencyes[i.key()]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -140,43 +157,73 @@ void Extracter::clear() {
|
||||
QuasarAppUtils::Params::isEndable("force-clear")) {
|
||||
qInfo() << "clear old data";
|
||||
|
||||
_fileManager->clear(DeployCore::_config->targetDir,
|
||||
_fileManager->clear(DeployCore::_config->getTargetDir(),
|
||||
QuasarAppUtils::Params::isEndable("force-clear"));
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::extractPlugins()
|
||||
{
|
||||
void Extracter::extractPlugins() {
|
||||
auto cnf = DeployCore::_config;
|
||||
PluginsParser pluginsParser;
|
||||
|
||||
QStringList plugins;
|
||||
pluginsParser.scan(DeployCore::_config->qtDir.plugins, plugins, _qtModules);
|
||||
copyPlugins(plugins);
|
||||
}
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + i.key();
|
||||
auto distro = cnf->getDistroFromPrefix(i.key());
|
||||
|
||||
void Extracter::copyFiles()
|
||||
{
|
||||
_fileManager->copyLibs(neadedLibs);
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("deploySystem")) {
|
||||
_fileManager->copyLibs(systemLibs);
|
||||
}
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(DeployCore::_config->targetDir)) {
|
||||
QuasarAppUtils::Params::verboseLog("strip failed!");
|
||||
QStringList plugins;
|
||||
pluginsParser.scan(cnf->qtDir.plugins, plugins, _prefixDependencyes[i.key()].qtModules());
|
||||
copyPlugins(plugins, i.key());
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyTr()
|
||||
{
|
||||
if (!QuasarAppUtils::Params::isEndable("noTranslations")) {
|
||||
if (!copyTranslations(DeployCore::extractTranslation(neadedLibs))) {
|
||||
QuasarAppUtils::Params::verboseLog("Failed to copy standard Qt translations",
|
||||
QuasarAppUtils::Warning);
|
||||
void Extracter::copyLibs(const QSet<QString> &files, const QString& prefix) {
|
||||
auto cnf = DeployCore::_config;
|
||||
auto targetPath = cnf->getTargetDir() + prefix;
|
||||
auto distro = cnf->getDistroFromPrefix(prefix);
|
||||
|
||||
for (auto file : files) {
|
||||
QFileInfo target(file);
|
||||
|
||||
if (!_fileManager->smartCopyFile(file, targetPath + distro.getLibOutDir())) {
|
||||
QuasarAppUtils::Params::verboseLog(file + " not copied");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyFiles() {
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
|
||||
copyLibs(_prefixDependencyes[i.key()].neadedLibs(), i.key());
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("deploySystem")) {
|
||||
copyLibs(_prefixDependencyes[i.key()].systemLibs(), i.key());
|
||||
}
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(cnf->getTargetDir())) {
|
||||
QuasarAppUtils::Params::verboseLog("strip failed!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyTr() {
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noTranslations")) {
|
||||
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
if (!copyTranslations(DeployCore::extractTranslation(_prefixDependencyes[i.key()].neadedLibs()),
|
||||
i.key())) {
|
||||
QuasarAppUtils::Params::verboseLog("Failed to copy standard Qt translations",
|
||||
QuasarAppUtils::Warning);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::deploy() {
|
||||
qInfo() << "target deploy started!!";
|
||||
|
||||
@ -189,8 +236,6 @@ void Extracter::deploy() {
|
||||
qCritical() << "qml not extacted!";
|
||||
}
|
||||
|
||||
initQtModules();
|
||||
|
||||
extractPlugins();
|
||||
|
||||
copyFiles();
|
||||
@ -211,9 +256,11 @@ void Extracter::deploy() {
|
||||
|
||||
}
|
||||
|
||||
bool Extracter::copyTranslations(QStringList list) {
|
||||
bool Extracter::copyTranslations(QStringList list, const QString& prefix) {
|
||||
|
||||
QDir dir(DeployCore::_config->qtDir.translations);
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
QDir dir(cnf->qtDir.translations);
|
||||
if (!dir.exists() || list.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
@ -225,14 +272,15 @@ bool Extracter::copyTranslations(QStringList list) {
|
||||
|
||||
auto listItems = dir.entryInfoList(filters, QDir::Files | QDir::NoDotAndDotDot);
|
||||
|
||||
auto targetPath = cnf->getTargetDir() + prefix;
|
||||
auto distro = cnf->getDistroFromPrefix(prefix);
|
||||
|
||||
for (auto &&i: listItems) {
|
||||
_fileManager->copyFile(i.absoluteFilePath(), DeployCore::_config->targetDir + DeployCore::_config->distroStruct.getTrOutDir());
|
||||
_fileManager->copyFile(i.absoluteFilePath(), targetPath + distro.getTrOutDir());
|
||||
}
|
||||
|
||||
auto webEngine = static_cast<quint64>(_qtModules) & static_cast<quint64>(DeployCore::QtModule::QtWebEngineModule);
|
||||
|
||||
if (webEngine) {
|
||||
auto trOut = DeployCore::_config->targetDir + DeployCore::_config->distroStruct.getTrOutDir();
|
||||
if (isWebEngine(prefix)) {
|
||||
auto trOut = targetPath + distro.getTrOutDir();
|
||||
auto tr = DeployCore::_config->qtDir.translations + "/qtwebengine_locales";
|
||||
_fileManager->copyFolder(tr, trOut + "/qtwebengine_locales");
|
||||
}
|
||||
@ -302,21 +350,29 @@ bool Extracter::extractQmlAll() {
|
||||
return false;
|
||||
}
|
||||
|
||||
QStringList listItems;
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
if (!_fileManager->copyFolder(DeployCore::_config->qtDir.qmls,
|
||||
DeployCore::_config->targetDir + DeployCore::_config->distroStruct.getQmlOutDir(),
|
||||
QStringList() << ".so.debug" << "d.dll" << ".pdb",
|
||||
&listItems)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto item : listItems) {
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(item);
|
||||
} else {
|
||||
extract(item, "Qt");
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + i.key();
|
||||
auto distro = cnf->getDistroFromPrefix(i.key());
|
||||
|
||||
QStringList listItems;
|
||||
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.qmls, targetPath + distro.getQmlOutDir(),
|
||||
QStringList() << ".so.debug" << "d.dll" << ".pdb",
|
||||
&listItems)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto item : listItems) {
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(item, &_prefixDependencyes[i.key()]);
|
||||
} else {
|
||||
extract(item, &_prefixDependencyes[i.key()], "Qt");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -325,6 +381,7 @@ bool Extracter::extractQmlAll() {
|
||||
bool Extracter::extractQmlFromSource(const QString& sourceDir) {
|
||||
|
||||
QFileInfo info(sourceDir);
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
if (!info.isDir()) {
|
||||
qCritical() << "extract qml fail! qml source dir not exits or is not dir " << sourceDir;
|
||||
@ -333,7 +390,7 @@ bool Extracter::extractQmlFromSource(const QString& sourceDir) {
|
||||
|
||||
QuasarAppUtils::Params::verboseLog("extractQmlFromSource " + info.absoluteFilePath());
|
||||
|
||||
if (!QFileInfo::exists(DeployCore::_config->qtDir.qmls)) {
|
||||
if (!QFileInfo::exists(cnf->qtDir.qmls)) {
|
||||
qWarning() << "qml dir wrong!";
|
||||
return false;
|
||||
}
|
||||
@ -343,25 +400,31 @@ bool Extracter::extractQmlFromSource(const QString& sourceDir) {
|
||||
QStringList filter;
|
||||
filter << ".so.debug" << "d.dll" << ".pdb";
|
||||
|
||||
QML ownQmlScaner(DeployCore::_config->qtDir.qmls);
|
||||
QML ownQmlScaner(cnf->qtDir.qmls);
|
||||
|
||||
if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
|
||||
QuasarAppUtils::Params::verboseLog("qml scaner run failed!");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!_fileManager->copyFolder(DeployCore::_config->qtDir.qmls,
|
||||
DeployCore::_config->targetDir + DeployCore::_config->distroStruct.getQmlOutDir(),
|
||||
filter , &listItems, &plugins)) {
|
||||
return false;
|
||||
}
|
||||
for (auto i = cnf->prefixes.cbegin(); i != cnf->prefixes.cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + i.key();
|
||||
auto distro = cnf->getDistroFromPrefix(i.key());
|
||||
|
||||
for (auto item : listItems) {
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(item);
|
||||
} else {
|
||||
extract(item, "Qt");
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.qmls,
|
||||
targetPath + distro.getQmlOutDir(),
|
||||
filter , &listItems, &plugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto item : listItems) {
|
||||
if (QuasarAppUtils::Params::isEndable("extractPlugins")) {
|
||||
extract(item, &_prefixDependencyes[i.key()]);
|
||||
} else {
|
||||
extract(item, &_prefixDependencyes[i.key()], "Qt");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -409,8 +472,6 @@ Extracter::Extracter(FileManager *fileManager, ConfigParser *cqt,
|
||||
_cqt(cqt)
|
||||
{
|
||||
|
||||
_qtModules = DeployCore::QtModule::NONE;
|
||||
|
||||
assert(_cqt);
|
||||
assert(_fileManager);
|
||||
assert(DeployCore::_config);
|
||||
|
@ -30,7 +30,7 @@ class DEPLOYSHARED_EXPORT Extracter {
|
||||
MetaFileManager *_metaFileManager;
|
||||
|
||||
void extract(const QString &file, DependencyMap* depMap, const QString& mask = "");
|
||||
bool copyTranslations(QStringList list);
|
||||
bool copyTranslations(QStringList list, const QString &prefix);
|
||||
|
||||
bool extractQml();
|
||||
|
||||
@ -45,22 +45,24 @@ class DEPLOYSHARED_EXPORT Extracter {
|
||||
void extractLib(const QString & file, DependencyMap *depMap, const QString& mask = "");
|
||||
|
||||
bool deployMSVC();
|
||||
bool extractWebEngine(const QString &prefis);
|
||||
bool extractWebEngine();
|
||||
|
||||
|
||||
bool copyPlugin(const QString &plugin);
|
||||
void copyPlugins(const QStringList &list);
|
||||
bool copyPlugin(const QString &plugin, const QString &prefix);
|
||||
void copyPlugins(const QStringList &list, const QString &prefix);
|
||||
|
||||
/**
|
||||
* @brief compress - this function join all target dependecies in to one struct
|
||||
*/
|
||||
void compress();
|
||||
void extractAllTargets();
|
||||
void initQtModules();
|
||||
void extractPlugins();
|
||||
void copyFiles();
|
||||
void copyTr();
|
||||
void copyExtraPlugins();
|
||||
void copyExtraPlugins(const QString &prefix);
|
||||
void copyLibs(const QSet<QString> &files, const QString &prefix);
|
||||
|
||||
bool isWebEngine(const QString& prefix) const;
|
||||
public:
|
||||
explicit Extracter(FileManager *fileManager, ConfigParser * cqt, DependenciesScanner *_scaner);
|
||||
void deploy();
|
||||
|
@ -333,18 +333,6 @@ void FileManager::clear(const QString& targetDir, bool force) {
|
||||
_deployedFiles.clear();
|
||||
}
|
||||
|
||||
//void FileManager::copyLibs(const QStringList &files) {
|
||||
// auto config = DeployCore::_config;
|
||||
|
||||
// for (auto file : files) {
|
||||
// QFileInfo target(file);
|
||||
|
||||
// if (!smartCopyFile(file, DeployCore::_config->targetDir + config->distroStruct.getLibOutDir())) {
|
||||
// QuasarAppUtils::Params::verboseLog(file + " not copied");
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
bool FileManager::copyFile(const QString &file, const QString &target,
|
||||
QStringList *masks) {
|
||||
|
||||
|
@ -538,9 +538,9 @@ void deploytest::testExtractPlugins() {
|
||||
QVERIFY(deploy.run() == 0);
|
||||
|
||||
QVERIFY(DeployCore::_config);
|
||||
QVERIFY(!DeployCore::_config->targetDir.isEmpty());
|
||||
QVERIFY(!DeployCore::_config->getTargetDir().isEmpty());
|
||||
|
||||
auto resultTree = utils.getTree(DeployCore::_config->targetDir);
|
||||
auto resultTree = utils.getTree(DeployCore::_config->getTargetDir());
|
||||
auto comapre = utils.compareTree(resultTree, comapareTree);
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
@ -771,18 +771,18 @@ void deploytest::testSetTargetDir() {
|
||||
|
||||
dep.setTargetDir();
|
||||
|
||||
QVERIFY(dep.config()->targetDir == QFileInfo("./" + DISTRO_DIR + "").absoluteFilePath());
|
||||
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "").absoluteFilePath());
|
||||
dep.setTargetDir("./ff");
|
||||
QVERIFY(dep.config()->targetDir == QFileInfo("./ff").absoluteFilePath());
|
||||
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./ff").absoluteFilePath());
|
||||
|
||||
QStringList argv = {"-targetDir", "./" + DISTRO_DIR + "2"};
|
||||
|
||||
QuasarAppUtils::Params::parseParams(argv);
|
||||
|
||||
dep.setTargetDir();
|
||||
QVERIFY(dep.config()->targetDir == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
|
||||
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
|
||||
dep.setTargetDir("./ff");
|
||||
QVERIFY(dep.config()->targetDir == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
|
||||
QVERIFY(dep.config()->getTargetDir() == QFileInfo("./" + DISTRO_DIR + "2").absoluteFilePath());
|
||||
|
||||
}
|
||||
|
||||
@ -836,9 +836,9 @@ void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings) {
|
||||
TestUtils utils;
|
||||
|
||||
QVERIFY(DeployCore::_config);
|
||||
QVERIFY(!DeployCore::_config->targetDir.isEmpty());
|
||||
QVERIFY(!DeployCore::_config->getTargetDir().isEmpty());
|
||||
|
||||
auto resultTree = utils.getTree(DeployCore::_config->targetDir);
|
||||
auto resultTree = utils.getTree(DeployCore::_config->getTargetDir());
|
||||
|
||||
auto comapre = utils.compareTree(resultTree, tree);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user