mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-27 18:24:33 +00:00
fix crashes
This commit is contained in:
parent
752ec24c3d
commit
81e0a25261
@ -33,27 +33,27 @@
|
||||
|
||||
static QString defaultPackage = "";
|
||||
|
||||
template<typename Container, typename Setter>
|
||||
template<typename Container, typename Adder>
|
||||
bool parsePackagesPrivate(Container& mainContainer,
|
||||
const QStringList &inputParamsList,
|
||||
Setter setter) {
|
||||
Adder adder) {
|
||||
|
||||
for (const auto& str: inputParamsList) {
|
||||
auto pair = str.split(DeployCore::getSeparator(1));
|
||||
auto first = pair.value(0, "");
|
||||
auto second = pair.value(1, "");
|
||||
if (pair.size() == 1)
|
||||
(mainContainer[defaultPackage].*setter)(first);
|
||||
auto paramsList = str.split(DeployCore::getSeparator(1));
|
||||
auto first = paramsList.value(0, "");
|
||||
auto second = paramsList.value(1, "");
|
||||
if (paramsList.size() == 1)
|
||||
(mainContainer[defaultPackage].*adder)(first);
|
||||
else {
|
||||
first = PathUtils::fullStripPath(first);
|
||||
if (!mainContainer.contains(first)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
(mainContainer[first].*setter)(second);
|
||||
|
||||
for (int i = 1; i < paramsList.size(); ++i) {
|
||||
(mainContainer[first].*adder)(paramsList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -859,10 +859,6 @@ void ConfigParser::initIgnoreEnvList() {
|
||||
|
||||
}
|
||||
|
||||
void ConfigParser::initPluginsList() {
|
||||
_pluginsParser->initDeployPluginsList();
|
||||
}
|
||||
|
||||
QString ConfigParser::getPathFrmoQmakeLine(const QString &in) const {
|
||||
auto list = in.split(':');
|
||||
if (list.size() > 1) {
|
||||
@ -1132,17 +1128,23 @@ bool ConfigParser::initPlugins() {
|
||||
};
|
||||
|
||||
|
||||
if (listExtraPlugin.size() && !parsePackagesPrivate(_config.packagesEdit(), listExtraPlugin, &DistroModule::addExtraPlugins)) {
|
||||
if (listExtraPlugin.size() && !parsePackagesPrivate(_config.packagesEdit(),
|
||||
listExtraPlugin,
|
||||
&DistroModule::addExtraPlugins)) {
|
||||
erroLog("extra plugins");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (listEnablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(), listEnablePlugins, &DistroModule::addEnabled)) {
|
||||
if (listEnablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(),
|
||||
listEnablePlugins,
|
||||
&DistroModule::addEnabledPlugins)) {
|
||||
erroLog("enable plugins");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (listDisablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(), listDisablePlugins, &DistroModule::addDisabled)) {
|
||||
if (listDisablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(),
|
||||
listDisablePlugins,
|
||||
&DistroModule::addDisabledPlugins)) {
|
||||
erroLog("disable plugins");
|
||||
return false;
|
||||
}
|
||||
|
@ -67,8 +67,6 @@ private:
|
||||
void initIgnoreList();
|
||||
void initIgnoreEnvList();
|
||||
|
||||
void initPluginsList();
|
||||
|
||||
QString getPathFrmoQmakeLine(const QString& in) const;
|
||||
bool initQmakePrivate(const QString& qmake);
|
||||
bool initQmake();
|
||||
|
@ -62,7 +62,7 @@ Platform DeployConfig::getPlatform(const QString& package) const {
|
||||
if (_packages.contains(package)) {
|
||||
auto disto = getDistroFromPackage(package);
|
||||
|
||||
for( auto it = disto.targets().begin(); it != disto.targets().end(); ++it) {
|
||||
for( auto it = disto.targets().cbegin(); it != disto.targets().cend(); ++it) {
|
||||
result = result | _targets.value(*it).getPlatform();
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ Platform DeployConfig::getPlatform(const QString& package) const {
|
||||
}
|
||||
|
||||
|
||||
for( auto it = _targets.begin(); it != _targets.end(); ++it) {
|
||||
for( auto it = _targets.cbegin(); it != _targets.cend(); ++it) {
|
||||
result = result | it.value().getPlatform();
|
||||
}
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include "deploycore.h"
|
||||
#include "quasarapp.h"
|
||||
#include "pathutils.h"
|
||||
#include "pluginsparser.h"
|
||||
|
||||
#include <QDebug>
|
||||
#include <QDir>
|
||||
@ -233,9 +234,12 @@ void DeployCore::help() {
|
||||
{"-releaseDate [package;val,val]", "Sets release date for package"},
|
||||
{"-icon [package;val,val]", "Sets path to icon for package"},
|
||||
{"-publisher [package;val,val]", "Sets publisher for package"},
|
||||
{"-extraPlugin [package;val,val]", "Sets an additional path to extraPlugin of an app"},
|
||||
{"-enablePlugins [package;val,val]", "Enable an additional plugin for app"},
|
||||
{"-disablePlugins [package;val,val]", "Disable an additional plugin for app"},
|
||||
{"-extraPlugin [package;val1;val2,SingeleVal]", "Sets an additional path to extraPlugin of an app"},
|
||||
{"-enablePlugins [package;val1;val2,SingeleVal", "Enable an additional plugin for distribution."
|
||||
" By default disabled next plugins: " + PluginsParser::defaultForbidenPlugins().join(',')},
|
||||
{"-disablePlugins [package;val1;val2,SingeleVal]", "Disable an additional plugin for distribution. "
|
||||
"You can disable any plugin of your Qt build, just see the yourQtFolder/plugins forlder for available plugins."
|
||||
" Example if you want disable qxcb plugin: -disablePlugins qxcb. Note that the name of the plugin is indicated without its extension"},
|
||||
|
||||
}
|
||||
},
|
||||
|
@ -88,31 +88,31 @@ void DistroModule::setPublisher(const QString &publisher)
|
||||
_publisher = publisher;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::enabled() const
|
||||
QSet<QString> DistroModule::enabledPlugins() const
|
||||
{
|
||||
return _enabled;
|
||||
}
|
||||
|
||||
void DistroModule::setEnabled(const QSet<QString> &enabled)
|
||||
void DistroModule::setEnabledPlugins(const QSet<QString> &enabled)
|
||||
{
|
||||
_enabled = enabled;
|
||||
}
|
||||
|
||||
void DistroModule::addEnabled(const QString &enabled) {
|
||||
void DistroModule::addEnabledPlugins(const QString &enabled) {
|
||||
_enabled += enabled;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::disabled() const
|
||||
QSet<QString> DistroModule::disabledPlugins() const
|
||||
{
|
||||
return _disabled;
|
||||
}
|
||||
|
||||
void DistroModule::setDisabled(const QSet<QString> &disabled)
|
||||
void DistroModule::setDisabledPlugins(const QSet<QString> &disabled)
|
||||
{
|
||||
_disabled = disabled;
|
||||
}
|
||||
|
||||
void DistroModule::addDisabled(const QString &disabled) {
|
||||
void DistroModule::addDisabledPlugins(const QString &disabled) {
|
||||
_disabled += disabled;
|
||||
}
|
||||
|
||||
|
@ -36,13 +36,13 @@ public:
|
||||
QString publisher() const;
|
||||
void setPublisher(const QString &publisher);
|
||||
|
||||
QSet<QString> enabled() const;
|
||||
void setEnabled(const QSet<QString> &enabled);
|
||||
void addEnabled(const QString &enabled);
|
||||
QSet<QString> enabledPlugins() const;
|
||||
void setEnabledPlugins(const QSet<QString> &enabled);
|
||||
void addEnabledPlugins(const QString &enabled);
|
||||
|
||||
QSet<QString> disabled() const;
|
||||
void setDisabled(const QSet<QString> &disabled);
|
||||
void addDisabled(const QString &disabled);
|
||||
QSet<QString> disabledPlugins() const;
|
||||
void setDisabledPlugins(const QSet<QString> &disabled);
|
||||
void addDisabledPlugins(const QString &disabled);
|
||||
|
||||
QSet<QString> extraPlugins() const;
|
||||
void setExtraPlugins(const QSet<QString> &extraPlugins);
|
||||
|
@ -98,6 +98,9 @@ void Extracter::clear() {
|
||||
}
|
||||
|
||||
void Extracter::copyExtraPlugins(const QString& package) {
|
||||
|
||||
_pluginsParser->initDeployPluginsList();
|
||||
|
||||
QFileInfo info;
|
||||
|
||||
auto cnf = DeployCore::_config;
|
||||
|
@ -422,6 +422,24 @@ bool FileManager::copyFile(const QString &file, const QString &target,
|
||||
return fileActionPrivate(file, target, masks, false, targetIsFile);
|
||||
}
|
||||
|
||||
QString FileManager::changeDistanation(const QString& absalutePath,
|
||||
QString basePath,
|
||||
int depch) {
|
||||
|
||||
auto prefixes = absalutePath.split(QRegExp("[\\/]"), QString::SkipEmptyParts);
|
||||
depch = std::min(depch, prefixes.size());
|
||||
while (depch) {
|
||||
auto index = prefixes.size() - depch;
|
||||
if (index >= 0) {
|
||||
basePath += "/" + prefixes[index];
|
||||
}
|
||||
|
||||
depch--;
|
||||
}
|
||||
|
||||
return basePath;
|
||||
}
|
||||
|
||||
bool FileManager::copyFiles(const QStringList &source,
|
||||
const QString &to, int saveStructSize,
|
||||
const QStringList &filter,
|
||||
@ -461,14 +479,7 @@ bool FileManager::copyFiles(const QStringList &source,
|
||||
continue;
|
||||
}
|
||||
|
||||
auto prefixes = info.absolutePath().split(QRegExp("[\\/]"));
|
||||
auto distanation = to;
|
||||
while (saveStructSize--) {
|
||||
auto index = prefixes.size() - saveStructSize;
|
||||
if (index >= 0) {
|
||||
distanation += "/" + prefixes[index];
|
||||
}
|
||||
}
|
||||
auto distanation = changeDistanation(info.absolutePath(), to, saveStructSize);
|
||||
|
||||
if (!copyFile(info.absoluteFilePath(), distanation , mask)) {
|
||||
QuasarAppUtils::Params::log(
|
||||
|
@ -23,7 +23,15 @@ private:
|
||||
bool initDir(const QString &path);
|
||||
QSet<QString> _deployedFiles;
|
||||
|
||||
|
||||
/**
|
||||
* @brief changeDistanation - this function create new distanation path.
|
||||
* (merge base path and pathFrom with depth)
|
||||
* @param absalutePath
|
||||
* @param basePath
|
||||
* @param depch
|
||||
* @return the new path
|
||||
*/
|
||||
QString changeDistanation(const QString &absalutePath, QString basePath, int depch);
|
||||
public:
|
||||
FileManager();
|
||||
|
||||
|
@ -140,13 +140,20 @@ bool PluginsParser::initDeployPluginsList() {
|
||||
const DeployConfig* cnf = DeployCore::_config;
|
||||
for (auto package = cnf->packages().cbegin(); package != cnf->packages().cend(); ++package) {
|
||||
|
||||
auto distro = cnf->getDistroFromPackage(package.key());
|
||||
|
||||
QList<QString> desabledFromPlatform;
|
||||
scanPlatforms(package.key(), desabledFromPlatform);
|
||||
|
||||
auto enablePlugins = QuasarAppUtils::Params::getStrArg("enablePlugins");
|
||||
auto disablePlugins = QuasarAppUtils::Params::getStrArg("disablePlugins");
|
||||
#if QT_VERSION < QT_VERSION_CHECK(5, 14, 0)
|
||||
auto enablePlugins = distro.enabledPlugins().toList();
|
||||
auto disablePlugins = distro.disabledPlugins().toList();
|
||||
#else
|
||||
auto enablePlugins = QStringList(distro.enabledPlugins().cbegin(), distro.enabledPlugins().cend());
|
||||
auto disablePlugins = QStringList(distro.disabledPlugins().cbegin(), distro.disabledPlugins().cend());
|
||||
#endif
|
||||
|
||||
auto forbidenPlugins = defaultForbidenPlugins() + disablePlugins.split(',') + desabledFromPlatform;
|
||||
auto forbidenPlugins = defaultForbidenPlugins() + disablePlugins + desabledFromPlatform;
|
||||
|
||||
for (const auto plugin: forbidenPlugins) {
|
||||
if (!enablePlugins.contains(plugin)) {
|
||||
@ -216,7 +223,7 @@ bool PluginsParser::isDisavledPlugin(const QString &plugin, const QString &packa
|
||||
return _disabledPlugins[package].contains(plugin);
|
||||
}
|
||||
|
||||
QStringList PluginsParser::defaultForbidenPlugins() const {
|
||||
QStringList PluginsParser::defaultForbidenPlugins() {
|
||||
return {
|
||||
"qtvirtualkeyboardplugin",
|
||||
"virtualkeyboard",
|
||||
|
@ -40,6 +40,12 @@ public:
|
||||
|
||||
bool initDeployPluginsList();
|
||||
|
||||
/**
|
||||
* @brief defaultForbidenPlugins - this method return list of forbiden plugins
|
||||
* forbidenPlugin - it is a plugin that depends on several Qt modules and significantly increases the size of the distribution.
|
||||
* @return
|
||||
*/
|
||||
static QStringList defaultForbidenPlugins();
|
||||
private:
|
||||
DependenciesScanner *_libScaner = nullptr;
|
||||
QHash<QString, QSet<QString>> _disabledPlugins;
|
||||
@ -56,12 +62,7 @@ private:
|
||||
void scanPluginGroup(const QString &pluginFolder, QStringList &result, const QString &package) const;
|
||||
bool isDisavledPlugin(const QString &plugin, const QString &package) const;
|
||||
|
||||
/**
|
||||
* @brief defaultForbidenPlugins - this method return list of forbiden plugins
|
||||
* forbidenPlugin - it is a plugin that depends on several Qt modules and significantly increases the size of the distribution.
|
||||
* @return
|
||||
*/
|
||||
QStringList defaultForbidenPlugins() const;
|
||||
|
||||
};
|
||||
|
||||
#endif // QTMODULES_H
|
||||
|
Loading…
x
Reference in New Issue
Block a user