diff --git a/Deploy/Deploy.pro b/Deploy/Deploy.pro index 7233342..ae3c8f8 100644 --- a/Deploy/Deploy.pro +++ b/Deploy/Deploy.pro @@ -63,6 +63,7 @@ SOURCES += \ extracter.cpp \ filemanager.cpp \ Distributions/idistribution.cpp \ + generalfiles_type.cpp \ ignorerule.cpp \ metafilemanager.cpp \ packagecontrol.cpp \ @@ -101,6 +102,7 @@ HEADERS += \ extracter.h \ filemanager.h \ Distributions/idistribution.h \ + generalfiles_type.h \ ignorerule.h \ metafilemanager.h \ packagecontrol.h \ diff --git a/Deploy/configparser.cpp b/Deploy/configparser.cpp index a0a9796..17aa839 100644 --- a/Deploy/configparser.cpp +++ b/Deploy/configparser.cpp @@ -1458,7 +1458,7 @@ bool ConfigParser::smartMoveTargets() { for (auto i = _config.targets().cbegin(); i != _config.targets().cend(); ++i) { if (!i.value().isValid()) { - QuasarAppUtils::Params::log(QString("Interna error ocurred in %0. Target not inited.").arg(__FUNCTION__), + QuasarAppUtils::Params::log(QString("Internal error ocurred in %0. Target not inited.").arg(__FUNCTION__), QuasarAppUtils::Error); QuasarAppUtils::Params::log(QString("If you see this message please create a new issue" " about this problem on the official github page" diff --git a/Deploy/dependenciesscanner.cpp b/Deploy/dependenciesscanner.cpp index 7f1d83a..5b37bd7 100644 --- a/Deploy/dependenciesscanner.cpp +++ b/Deploy/dependenciesscanner.cpp @@ -90,10 +90,13 @@ bool DependenciesScanner::fillLibInfo(LibInfo &info, const QString &file) const case PrivateScaner::PE: { return _peScaner.getLibInfo(file, info); } - case PrivateScaner::ELF: - return _elfScaner.getLibInfo(file, info); - default: return false; + case PrivateScaner::ELF: { + return _elfScaner.getLibInfo(file, info); + } + + default: + return _filesScaner.getLibInfo(file, info); } } diff --git a/Deploy/dependenciesscanner.h b/Deploy/dependenciesscanner.h index d6c76d0..6dfb57a 100644 --- a/Deploy/dependenciesscanner.h +++ b/Deploy/dependenciesscanner.h @@ -14,6 +14,7 @@ #include "pe_type.h" #include "elf_type.h" #include "libinfo.h" +#include "generalfiles_type.h" enum class PrivateScaner: unsigned char { @@ -32,6 +33,7 @@ private: PE _peScaner; ELF _elfScaner; + GeneralFiles _filesScaner; PrivateScaner getScaner(const QString& lib) const; diff --git a/Deploy/deploy.cpp b/Deploy/deploy.cpp index a4f29c5..5d75556 100644 --- a/Deploy/deploy.cpp +++ b/Deploy/deploy.cpp @@ -91,7 +91,9 @@ bool Deploy::deploy() { switch (DeployCore::getMode() ) { case RunMode::Deploy: - _extracter->deploy(); + if (!_extracter->deploy()) + return false; + break; default: break; diff --git a/Deploy/elf_type.cpp b/Deploy/elf_type.cpp index b4f866e..8454b61 100644 --- a/Deploy/elf_type.cpp +++ b/Deploy/elf_type.cpp @@ -18,7 +18,7 @@ ELF::ELF() QByteArrayList ELF::getDynamicString(ElfReader& reader) const { auto headers = reader.readHeaders(); - for (const auto §ionHeader : headers.sectionHeaders) { + for (const auto §ionHeader : qAsConst(headers.sectionHeaders)) { if (sectionHeader.name == ".dynstr") { auto arr = reader.readSection(sectionHeader.name).split(0); return arr; diff --git a/Deploy/extracter.cpp b/Deploy/extracter.cpp index 38c77d4..7d33e4e 100644 --- a/Deploy/extracter.cpp +++ b/Deploy/extracter.cpp @@ -262,10 +262,13 @@ void Extracter::copyTr() { } } -void Extracter::deploy() { +bool Extracter::deploy() { QuasarAppUtils::Params::log("target deploy started!!", QuasarAppUtils::Info); - _cqt->smartMoveTargets(); + if (!_cqt->smartMoveTargets()) { + return false; + } + _scaner->setEnvironment(DeployCore::_config->envirement.environmentList()); extractAllTargets(); extractExtraDataTargets(); @@ -283,6 +286,7 @@ void Extracter::deploy() { if (!extractWebEngine()) { QuasarAppUtils::Params::log("deploy webEngine failed", QuasarAppUtils::Error); + return false; } if (!deployMSVC()) { @@ -293,6 +297,8 @@ void Extracter::deploy() { QuasarAppUtils::Params::log("deploy done!", QuasarAppUtils::Info); + return true; + } bool Extracter::copyTranslations(const QStringList &list, const QString& package) { diff --git a/Deploy/extracter.h b/Deploy/extracter.h index b99bf2f..97717d8 100644 --- a/Deploy/extracter.h +++ b/Deploy/extracter.h @@ -24,7 +24,7 @@ class DEPLOYSHARED_EXPORT Extracter { public: explicit Extracter(FileManager *fileManager, PluginsParser* pluginsParser, ConfigParser * cqt, DependenciesScanner *_scaner); - void deploy(); + bool deploy(); void clear(); private: diff --git a/Deploy/generalfiles_type.cpp b/Deploy/generalfiles_type.cpp new file mode 100644 index 0000000..49f044a --- /dev/null +++ b/Deploy/generalfiles_type.cpp @@ -0,0 +1,24 @@ +//# +//# Copyright (C) 2021-2021 QuasarApp. +//# Distributed under the lgplv3 software license, see the accompanying +//# Everyone is permitted to copy and distribute verbatim copies +//# of this license document, but changing it is not allowed. +//# + +#include "generalfiles_type.h" + +GeneralFiles::GeneralFiles() +{ + +} + +bool GeneralFiles::getLibInfo(const QString &lib, LibInfo &info) const { + + QFileInfo fileInfo(lib); + + info.setPlatform(GeneralFile); + info.setName(fileInfo.fileName()); + info.setPath(fileInfo.absolutePath()); + + return true; +} diff --git a/Deploy/generalfiles_type.h b/Deploy/generalfiles_type.h new file mode 100644 index 0000000..de21469 --- /dev/null +++ b/Deploy/generalfiles_type.h @@ -0,0 +1,26 @@ +//# +//# Copyright (C) 2021-2021 QuasarApp. +//# Distributed under the lgplv3 software license, see the accompanying +//# Everyone is permitted to copy and distribute verbatim copies +//# of this license document, but changing it is not allowed. +//# + +#ifndef GENERALFILES_TYPE_H +#define GENERALFILES_TYPE_H + +#include "igetlibinfo.h" + +/** + * @brief The GeneralFiles class intendet for extract information of general files. + * This is defautl extracte for unknown files types. + */ +class GeneralFiles: public IGetLibInfo +{ +public: + GeneralFiles(); + + // IGetLibInfo interface + bool getLibInfo(const QString &lib, LibInfo &info) const override; +}; + +#endif // GENERALFILES_TYPE_H diff --git a/UnitTests/tst_deploytest.cpp b/UnitTests/tst_deploytest.cpp index d127db6..f21d047 100644 --- a/UnitTests/tst_deploytest.cpp +++ b/UnitTests/tst_deploytest.cpp @@ -175,6 +175,7 @@ private slots: void testRunScripts(); void testGetDefaultTemplate(); + void testDeployGeneralFiles(); void customTest(); }; @@ -1147,6 +1148,25 @@ void deploytest::testGetDefaultTemplate() { } +void deploytest::testDeployGeneralFiles() { + TestUtils utils; + + QString bin = TestBinDir + "/../../CMakeLists.txt"; + + auto comapareTree = utils.createTree( + { + "./" + DISTRO_DIR + "/bin/CMakeLists.txt", + "./" + DISTRO_DIR + "/bin/qt.conf", + + }); + + runTestParams( + {"-bin", bin, + "-binOut", "bin", + "force-clear" + }, &comapareTree); +} + void deploytest::customTest() { // runTestParams({"-confFile", "path", // "qifFromSystem"});