mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-28 02:34:34 +00:00
Merge branch 'v1.4' into qif
This commit is contained in:
commit
ff386a7e24
@ -68,11 +68,10 @@ bool ConfigParser::parseParams() {
|
||||
}
|
||||
|
||||
auto path = QuasarAppUtils::Params::getStrArg("confFile");
|
||||
bool createFile = !(path.isEmpty() || QFile::exists(path));
|
||||
if (path.isEmpty()) {
|
||||
path = QFileInfo("./").absoluteFilePath();
|
||||
bool createFile = !QFile::exists(path);
|
||||
if (QFile::exists(path)) {
|
||||
loadFromFile(path);
|
||||
}
|
||||
loadFromFile(path);
|
||||
|
||||
switch (DeployCore::getMode()) {
|
||||
case RunMode::Info: {
|
||||
@ -215,17 +214,11 @@ void ConfigParser::readKey(const QString& key, const QJsonObject& obj,
|
||||
} else if (!obj[key].isUndefined()) {
|
||||
QString val = obj[key].toString();
|
||||
if (!val.isEmpty()) {
|
||||
|
||||
if (PathUtils::isPath(val)) {
|
||||
|
||||
if (PathUtils::isAbsalutPath(val)) {
|
||||
val = QFileInfo(val).absoluteFilePath();
|
||||
} else {
|
||||
val = QFileInfo(confFileDir + '/' + val).absoluteFilePath();
|
||||
}
|
||||
if (PathUtils::isReleativePath(val)) {
|
||||
QuasarAppUtils::Params::setArg(key, QFileInfo(confFileDir + '/' + val).absoluteFilePath());
|
||||
} else {
|
||||
QuasarAppUtils::Params::setArg(key, val);
|
||||
}
|
||||
|
||||
QuasarAppUtils::Params::setArg(key, val);
|
||||
} else {
|
||||
auto value = obj[key].toBool(true);
|
||||
QuasarAppUtils::Params::setEnable(key, value);
|
||||
@ -752,6 +745,8 @@ void ConfigParser::initIgnoreList()
|
||||
_config.ignoreList.addRule(addRuleWin("WINMM.DLL"));
|
||||
_config.ignoreList.addRule(addRuleWin("IMM32.DLL"));
|
||||
_config.ignoreList.addRule(addRuleWin("KernelBase.DLL"));
|
||||
_config.ignoreList.addRule(addRuleWin("dwmapi.DLL"));
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
@ -12,8 +12,11 @@
|
||||
#include <QList>
|
||||
#include <QDir>
|
||||
#include <QDebug>
|
||||
#include "pathutils.h"
|
||||
|
||||
DependenciesScanner::DependenciesScanner() {}
|
||||
DependenciesScanner::DependenciesScanner() {
|
||||
|
||||
}
|
||||
|
||||
void DependenciesScanner::clearScaned() {
|
||||
_scanedLibs.clear();
|
||||
@ -127,18 +130,41 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res) {
|
||||
recursiveDep(*dep, listDep);
|
||||
|
||||
dep->allDep = listDep;
|
||||
lib.setWinApi(lib.getWinApi() | dep->getWinApi());
|
||||
_scanedLibs.insert(dep->fullPath(), *dep);
|
||||
|
||||
res.unite(listDep);
|
||||
} else {
|
||||
lib.setWinApi(lib.getWinApi() | scanedLib.getWinApi());
|
||||
res.unite(scanedLib.allDep);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void DependenciesScanner::addToWinAPI(const QString &lib, QHash<WinAPI, QSet<QString>>& res) {
|
||||
#ifdef Q_OS_WIN
|
||||
if (QuasarAppUtils::Params::isEndable("deploySystem")) {
|
||||
WinAPI api = _peScaner.getAPIModule(lib);
|
||||
if (api != WinAPI::NoWinAPI) {
|
||||
res[api] += lib;
|
||||
}
|
||||
}
|
||||
#else
|
||||
Q_UNUSED(lib)
|
||||
Q_UNUSED(res)
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
void DependenciesScanner::setEnvironment(const QStringList &env) {
|
||||
QDir dir;
|
||||
QHash<WinAPI, QSet<QString>> winAPI;
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
winAPI[WinAPI::Crt] += "UCRTBASE.DLL";
|
||||
#endif
|
||||
|
||||
for (auto i : env) {
|
||||
|
||||
dir.setPath(i);
|
||||
@ -146,16 +172,19 @@ void DependenciesScanner::setEnvironment(const QStringList &env) {
|
||||
continue;
|
||||
}
|
||||
|
||||
auto list = dir.entryInfoList(QStringList() << "*.dll" << ".DLL"
|
||||
auto list = dir.entryInfoList(QStringList() << "*.dll" << "*.DLL"
|
||||
<< "*.SO*" << "*.so*",
|
||||
QDir::Files| QDir::NoDotAndDotDot);
|
||||
QDir::Files | QDir::NoDotAndDotDot | QDir::Hidden);
|
||||
|
||||
for (auto i : list) {
|
||||
addToWinAPI(i.fileName().toUpper(), winAPI);
|
||||
_EnvLibs.insertMulti(i.fileName().toUpper(), i.absoluteFilePath());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
_peScaner.setWinAPI(winAPI);
|
||||
}
|
||||
|
||||
QSet<LibInfo> DependenciesScanner::scan(const QString &path) {
|
||||
|
@ -40,6 +40,8 @@ private:
|
||||
|
||||
void recursiveDep(LibInfo& lib, QSet<LibInfo> &res);
|
||||
|
||||
void addToWinAPI(const QString& lib, QHash<WinAPI, QSet<QString> > &res);
|
||||
|
||||
public:
|
||||
explicit DependenciesScanner();
|
||||
|
||||
|
@ -222,7 +222,7 @@ QString DeployCore::help() {
|
||||
{ " : Examples:" },
|
||||
{ " : cqtdeployer qif - for use default templates of qt installer framework." },
|
||||
{ " : cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." },
|
||||
|
||||
{ " -customScript [scriptCode]: Insert extra code inTo All run script."},
|
||||
{ " v / version : Shows compiled version" },
|
||||
{ " verbose [1-3] : Shows debug log" },
|
||||
|
||||
@ -275,7 +275,8 @@ QStringList DeployCore::helpKeys() {
|
||||
"deployVersion",
|
||||
"releaseDate",
|
||||
"icon",
|
||||
"publisher"
|
||||
"publisher",
|
||||
"customScript"
|
||||
};
|
||||
}
|
||||
|
||||
@ -465,3 +466,7 @@ char DeployCore::getEnvSeparator() {
|
||||
return ';';
|
||||
#endif
|
||||
}
|
||||
|
||||
uint qHash(WinAPI i) {
|
||||
return static_cast<uint>(i);
|
||||
}
|
||||
|
@ -50,6 +50,19 @@ enum LibPriority : int {
|
||||
NotFile = 0xF,
|
||||
};
|
||||
|
||||
enum class WinAPI : quint8 {
|
||||
NoWinAPI = 0x00,
|
||||
Other = 0x01,
|
||||
Core = 0x02,
|
||||
Devices = 0x04,
|
||||
Eventing = 0x08,
|
||||
Crt = 0x10,
|
||||
Security = 0x20,
|
||||
Base = 0x40
|
||||
};
|
||||
|
||||
uint qHash (WinAPI i);
|
||||
|
||||
enum class RunMode: int {
|
||||
Info,
|
||||
Deploy,
|
||||
|
@ -5,6 +5,8 @@
|
||||
* of this license document, but changing it is not allowed.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
#include "filemanager.h"
|
||||
#include <QDir>
|
||||
#include <quasarapp.h>
|
||||
@ -14,6 +16,10 @@
|
||||
#include <fstream>
|
||||
#include "pathutils.h"
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
#include "windows.h"
|
||||
#endif
|
||||
|
||||
FileManager::FileManager() {
|
||||
}
|
||||
|
||||
@ -64,7 +70,20 @@ bool FileManager::addToDeployed(const QString& path) {
|
||||
QuasarAppUtils::Params::verboseLog("permishens set fail", QuasarAppUtils::Warning);
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef Q_OS_WIN
|
||||
|
||||
if (info.isFile()) {
|
||||
auto stdString = QDir::toNativeSeparators(info.absoluteFilePath()).toStdString();
|
||||
|
||||
DWORD attribute = GetFileAttributesA(stdString.c_str());
|
||||
if (!SetFileAttributesA(stdString.c_str(), attribute & static_cast<DWORD>(~FILE_ATTRIBUTE_HIDDEN))) {
|
||||
QuasarAppUtils::Params::verboseLog("attribute set fail", QuasarAppUtils::Warning);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -60,6 +60,10 @@ void LibInfo::addDependncies(const QString &value) {
|
||||
dependncies.insert(value);
|
||||
}
|
||||
|
||||
void LibInfo::addDependncies(const QSet<QString> &value) {
|
||||
dependncies += value;
|
||||
}
|
||||
|
||||
void LibInfo::removeDependncies(const QString &value) {
|
||||
dependncies.remove(value);
|
||||
}
|
||||
@ -90,6 +94,14 @@ void LibInfo::setQtPath(const QString &value)
|
||||
qtPath = value;
|
||||
}
|
||||
|
||||
WinAPI LibInfo::getWinApi() const {
|
||||
return _winApi;
|
||||
}
|
||||
|
||||
void LibInfo::setWinApi(WinAPI winApi) {
|
||||
_winApi = winApi;
|
||||
}
|
||||
|
||||
QString LibInfo::fullPath() const {
|
||||
return path + "/" + name;
|
||||
}
|
||||
|
@ -20,6 +20,7 @@ private:
|
||||
QSet<QString> dependncies;
|
||||
QString qtPath;
|
||||
LibPriority priority = NotFile;
|
||||
WinAPI _winApi = WinAPI::NoWinAPI;
|
||||
|
||||
public:
|
||||
|
||||
@ -46,12 +47,15 @@ public:
|
||||
QSet<QString> getDependncies() const;
|
||||
void setDependncies(const QSet<QString> &value);
|
||||
void addDependncies(const QString &value);
|
||||
void addDependncies(const QSet<QString> &value);
|
||||
void removeDependncies(const QString &value);
|
||||
|
||||
LibPriority getPriority() const;
|
||||
void setPriority(const LibPriority &value);
|
||||
QString getQtPath() const;
|
||||
void setQtPath(const QString &value);
|
||||
WinAPI getWinApi() const;
|
||||
void setWinApi(WinAPI winApi);
|
||||
};
|
||||
|
||||
uint qHash(const LibInfo& info);
|
||||
|
@ -33,9 +33,12 @@ bool MetaFileManager::createRunScriptWindows(const QString &target) {
|
||||
"@echo off \n"
|
||||
"SET BASE_DIR=%~dp0\n"
|
||||
"SET PATH=%BASE_DIR%" + distro.getLibOutDir() + ";%PATH%\n"
|
||||
"%2\n"
|
||||
"start \"\" \"%BASE_DIR%" + distro.getBinOutDir() + "%0\" %1 \n";
|
||||
|
||||
content = content.arg(QFileInfo(target).fileName()).arg("%*");
|
||||
content = content.arg(generateCustoScriptBlok(true));
|
||||
|
||||
content = QDir::toNativeSeparators(content);
|
||||
|
||||
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".bat";
|
||||
@ -80,6 +83,7 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
|
||||
"QT_QPA_PLATFORM_PLUGIN_PATH=\"$BASE_DIR\"" + distro.getPluginsOutDir() +
|
||||
"/platforms:QT_QPA_PLATFORM_PLUGIN_PATH\n"
|
||||
"%2"
|
||||
"%3\n"
|
||||
"\"$BASE_DIR\"" + distro.getBinOutDir() + "%1 \"$@\"";
|
||||
|
||||
content = content.arg(QFileInfo(target).fileName());
|
||||
@ -93,6 +97,8 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
|
||||
content = content.arg("");
|
||||
}
|
||||
|
||||
content = content.arg(generateCustoScriptBlok(false));
|
||||
|
||||
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + QFileInfo(target).baseName()+ ".sh";
|
||||
|
||||
QFile F(fname);
|
||||
@ -113,6 +119,28 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
|
||||
QFileDevice::ReadOwner);
|
||||
}
|
||||
|
||||
QString MetaFileManager::generateCustoScriptBlok(bool bat) const {
|
||||
QString res = "";
|
||||
|
||||
QString commentMarker = "# ";
|
||||
if (bat) {
|
||||
commentMarker = ":: ";
|
||||
}
|
||||
|
||||
auto cstSh = QuasarAppUtils::Params::getStrArg("customScript", "");
|
||||
if (cstSh.size()) {
|
||||
res = "\n" +
|
||||
commentMarker + "Begin Custom Script (generated by customScript flag)\n"
|
||||
"%0\n" +
|
||||
commentMarker + "End Custom Script\n"
|
||||
"\n";
|
||||
|
||||
res = res.arg(cstSh);
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
MetaFileManager::MetaFileManager(FileManager *manager):
|
||||
_fileManager(manager)
|
||||
{
|
||||
@ -189,6 +217,4 @@ void MetaFileManager::createRunMetaFiles() {
|
||||
QuasarAppUtils::Params::verboseLog("create qt.conf failr", QuasarAppUtils::Warning);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ class MetaFileManager
|
||||
private:
|
||||
bool createRunScriptWindows(const QString &target);
|
||||
bool createRunScriptLinux(const QString &target);
|
||||
|
||||
QString generateCustoScriptBlok(bool bat) const;
|
||||
|
||||
bool createRunScript(const QString &target);
|
||||
bool createQConf(const QString &target);
|
||||
|
@ -7,6 +7,7 @@
|
||||
|
||||
#include "pathutils.h"
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
PathUtils::PathUtils()
|
||||
@ -66,7 +67,20 @@ QString PathUtils::getRelativeLink(QString from, QString to) {
|
||||
|
||||
// TODO ignore labels may be mistaken for a path, which will lead to improper eating
|
||||
bool PathUtils::isPath(const QString &path) {
|
||||
return path.contains('/') || path.contains('\\') || path == ".";
|
||||
QFileInfo info(path);
|
||||
return info.exists();
|
||||
// return path.contains('/') || path.contains('\\') || path == ".";
|
||||
}
|
||||
|
||||
bool PathUtils::isReleativePath(const QString &path) {
|
||||
QString temp = QDir::fromNativeSeparators(path);
|
||||
if (temp.size() == 1) {
|
||||
return path[0] == '.';
|
||||
} else if (temp.size() > 1) {
|
||||
return path[0] == '.' && path[1] == '/';
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
QChar PathUtils::getDrive(QString path) {
|
||||
|
@ -63,6 +63,13 @@ public:
|
||||
*/
|
||||
static bool isPath(const QString &path);
|
||||
|
||||
/**
|
||||
* @brief isPath
|
||||
* @param path
|
||||
* @return return true if imput value is Releative path
|
||||
*/
|
||||
static bool isReleativePath(const QString &path);
|
||||
|
||||
/**
|
||||
* @brief getDrive
|
||||
* @param path
|
||||
|
@ -12,6 +12,7 @@
|
||||
#include <QSet>
|
||||
#include <QVector>
|
||||
#include <parser-library/parse.h>
|
||||
#include <quasarapp.h>
|
||||
|
||||
#include <bits/stl_set.h>
|
||||
|
||||
@ -25,8 +26,13 @@ struct importent {
|
||||
std::string moduleName;
|
||||
};
|
||||
|
||||
struct exportent {
|
||||
VA addr;
|
||||
std::string symbolName;
|
||||
std::string moduleName;
|
||||
};
|
||||
|
||||
class reloc;
|
||||
class exportent;
|
||||
class symbol;
|
||||
|
||||
struct parsed_pe_internal {
|
||||
@ -42,6 +48,7 @@ struct parsed_pe_internal {
|
||||
|
||||
bool PE::getDep(peparse::parsed_pe_internal * internal, LibInfo &res) const {
|
||||
auto imports = internal->imports;
|
||||
auto exports = internal->exports;
|
||||
|
||||
std::set<std::string> filter;
|
||||
|
||||
@ -52,9 +59,61 @@ bool PE::getDep(peparse::parsed_pe_internal * internal, LibInfo &res) const {
|
||||
}
|
||||
}
|
||||
|
||||
for ( auto &i : exports) {
|
||||
if (!filter.count(i.moduleName)) {
|
||||
filter.insert(i.moduleName);
|
||||
res.addDependncies(QString::fromStdString(i.moduleName));
|
||||
}
|
||||
}
|
||||
|
||||
if (res.getWinApi() != WinAPI::NoWinAPI) {
|
||||
res.addDependncies(_winAPI.value(res.getWinApi()));
|
||||
}
|
||||
|
||||
return res.getDependncies().size() || !imports.size();
|
||||
}
|
||||
|
||||
QHash<WinAPI, QSet<QString> > PE::getWinAPI() const {
|
||||
return _winAPI;
|
||||
}
|
||||
|
||||
void PE::setWinAPI(const QHash<WinAPI, QSet<QString> > &winAPI) {
|
||||
_winAPI = winAPI;
|
||||
}
|
||||
|
||||
WinAPI PE::getAPIModule(const QString &libName) const {
|
||||
if (libName.contains(API_MS_WIN, Qt::CaseInsensitive)) {
|
||||
if (libName.contains(API_MS_WIN_CORE, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Core;
|
||||
}
|
||||
|
||||
if (libName.contains(API_MS_WIN_EVENTING, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Eventing;
|
||||
}
|
||||
|
||||
if (libName.contains(API_MS_WIN_DEVICES, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Devices;
|
||||
}
|
||||
|
||||
if (libName.contains(API_MS_WIN_CRT, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Crt;
|
||||
}
|
||||
|
||||
if (libName.contains(API_MS_WIN_SECURITY, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Security;
|
||||
}
|
||||
|
||||
if (libName.contains(API_MS_WIN_BASE, Qt::CaseInsensitive)) {
|
||||
return WinAPI::Base;
|
||||
}
|
||||
|
||||
return WinAPI::Other;
|
||||
|
||||
}
|
||||
|
||||
return WinAPI::NoWinAPI;
|
||||
}
|
||||
|
||||
PE::PE(): IGetLibInfo () {
|
||||
|
||||
}
|
||||
@ -75,6 +134,7 @@ bool PE::getLibInfo(const QString &lib, LibInfo &info) const {
|
||||
|
||||
info.setName(QFileInfo(lib).fileName());
|
||||
info.setPath(QFileInfo(lib).absolutePath());
|
||||
info.setWinApi(getAPIModule(info.getName()));
|
||||
|
||||
if (!getDep(parsedPeLib->internal, info)) {
|
||||
peparse::DestructParsedPE(parsedPeLib);
|
||||
@ -83,6 +143,7 @@ bool PE::getLibInfo(const QString &lib, LibInfo &info) const {
|
||||
|
||||
peparse::DestructParsedPE(parsedPeLib);
|
||||
|
||||
|
||||
return info.isValid();
|
||||
}
|
||||
|
||||
|
12
Deploy/pe.h
12
Deploy/pe.h
@ -13,6 +13,14 @@
|
||||
#include <QVector>
|
||||
#include "igetlibinfo.h"
|
||||
|
||||
#define API_MS_WIN "api-ms-win-"
|
||||
#define API_MS_WIN_CORE "-core-"
|
||||
#define API_MS_WIN_EVENTING "-Eventing-"
|
||||
#define API_MS_WIN_DEVICES "-devices-"
|
||||
#define API_MS_WIN_CRT "-crt-"
|
||||
#define API_MS_WIN_SECURITY "-security-"
|
||||
#define API_MS_WIN_BASE "-base-"
|
||||
|
||||
namespace peparse {
|
||||
struct parsed_pe_internal;
|
||||
}
|
||||
@ -21,6 +29,7 @@ class PE : public IGetLibInfo {
|
||||
private:
|
||||
|
||||
bool getDep(peparse::parsed_pe_internal *, LibInfo &res) const;
|
||||
QHash<WinAPI, QSet<QString>> _winAPI;
|
||||
|
||||
public:
|
||||
|
||||
@ -31,11 +40,14 @@ public:
|
||||
_ROM = 0x107,
|
||||
};
|
||||
PE();
|
||||
WinAPI getAPIModule(const QString &libName) const;
|
||||
|
||||
bool getLibInfo(const QString& lib, LibInfo& info) const override;
|
||||
|
||||
~PE() override;
|
||||
|
||||
QHash<WinAPI, QSet<QString>> getWinAPI() const;
|
||||
void setWinAPI(const QHash<WinAPI, QSet<QString>> &winAPI);
|
||||
};
|
||||
|
||||
#endif // PE_H
|
||||
|
@ -62,12 +62,13 @@ clearSnap.commands = rm parts prime stage *.snap -rdf
|
||||
deploySnap.commands = rm *.snap -rdf && chmod 777 -R $$PWD/../prime && snapcraft && cp *.snap $$PWD/../Distro/
|
||||
releaseSnap.commands = snapcraft push *.snap # bad patern
|
||||
|
||||
unix:deploy.depends += clearSnap
|
||||
unix:deploy.depends += buildSnap
|
||||
|
||||
|
||||
!isEmpty( ONLINE ) {
|
||||
|
||||
message(Snap)
|
||||
unix:deploy.depends += clearSnap
|
||||
unix:deploy.depends += buildSnap
|
||||
unix:deploy.depends += deploySnap
|
||||
unix:release.depends += releaseSnap
|
||||
}
|
||||
|
@ -13,6 +13,17 @@ Modules::Modules()
|
||||
|
||||
}
|
||||
|
||||
QSet<QString> Modules::ignoreFilter(const QSet<QString> &input, const QString &filter) {
|
||||
QSet<QString> res;
|
||||
for (auto& val : input) {
|
||||
if (!val.contains(filter)) {
|
||||
res.insert(val);
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
|
||||
QSet<QString> Modules::qtLibs() {
|
||||
TestUtils utils;
|
||||
#ifdef Q_OS_WIN
|
||||
|
@ -20,6 +20,7 @@ private:
|
||||
public:
|
||||
Modules();
|
||||
|
||||
static QSet<QString> ignoreFilter(const QSet<QString>& input, const QString& filter);
|
||||
static QSet<QString> qtLibs();
|
||||
static QSet<QString> qmlLibs();
|
||||
static QSet<QString> qmlLibsExtractPlugins();
|
||||
|
@ -46,9 +46,9 @@ private:
|
||||
QStringList getFilesFromDir(const QString& dir);
|
||||
|
||||
|
||||
void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr, bool noWarnings = false);
|
||||
void runTestParams(const QStringList &list, QSet<QString> *tree = nullptr, bool noWarnings = false, bool onlySize = false);
|
||||
|
||||
void checkResults(const QSet<QString> &tree, bool noWarnings);
|
||||
void checkResults(const QSet<QString> &tree, bool noWarnings, bool onlySize = false);
|
||||
public:
|
||||
deploytest();
|
||||
/**
|
||||
@ -83,6 +83,9 @@ private slots:
|
||||
// tested flags : help, version
|
||||
void testHelp();
|
||||
|
||||
// tested flags customScript
|
||||
void costomScript();
|
||||
|
||||
// tested flags clear noOvervrite
|
||||
void testOverwrite();
|
||||
|
||||
@ -852,7 +855,7 @@ void deploytest::testSetTargetDir() {
|
||||
|
||||
}
|
||||
|
||||
void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, bool noWarnings) {
|
||||
void deploytest::runTestParams(const QStringList &list, QSet<QString>* tree, bool noWarnings, bool onlySize) {
|
||||
|
||||
QuasarAppUtils::Params::parseParams(list);
|
||||
|
||||
@ -860,7 +863,7 @@ void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, boo
|
||||
QVERIFY(deploy.run() == 0);
|
||||
|
||||
if (tree) {
|
||||
checkResults(*tree, noWarnings);
|
||||
checkResults(*tree, noWarnings, onlySize);
|
||||
}
|
||||
|
||||
#ifdef WITH_SNAP
|
||||
@ -898,7 +901,7 @@ void deploytest::runTestParams(const QStringList& list, QSet<QString>* tree, boo
|
||||
#endif
|
||||
}
|
||||
|
||||
void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings) {
|
||||
void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings , bool onlySize) {
|
||||
TestUtils utils;
|
||||
|
||||
QVERIFY(DeployCore::_config);
|
||||
@ -908,6 +911,11 @@ void deploytest::checkResults(const QSet<QString> &tree, bool noWarnings) {
|
||||
|
||||
auto comapre = utils.compareTree(resultTree, tree);
|
||||
|
||||
if (onlySize) {
|
||||
QVERIFY(resultTree.size() > tree.size());
|
||||
return;
|
||||
}
|
||||
|
||||
if (comapre.size() != 0) {
|
||||
|
||||
bool bug = false;
|
||||
@ -976,6 +984,59 @@ void deploytest::testHelp() {
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void deploytest::costomScript() {
|
||||
TestUtils utils;
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
|
||||
auto comapareTree = utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
|
||||
"./" + DISTRO_DIR + "/bin/qt.conf",
|
||||
"./" + DISTRO_DIR + "/TestOnlyC.sh"});
|
||||
QString bin = TestBinDir + "TestOnlyC";
|
||||
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.sh";
|
||||
|
||||
#else
|
||||
QFile f("./" + DISTRO_DIR + "/TestOnlyC.exe");
|
||||
auto comapareTree = utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
|
||||
"./" + DISTRO_DIR + "/TestOnlyC.bat",
|
||||
"./" + DISTRO_DIR + "/qt.conf"});
|
||||
QString bin = TestBinDir + "TestOnlyC.exe";
|
||||
QString scriptPath = "./" + DISTRO_DIR + "/TestOnlyC.bat";
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
runTestParams({"-bin", bin, "force-clear", "noOverwrite", "-libOut", "lib"}, &comapareTree);
|
||||
|
||||
QFile script(scriptPath);
|
||||
QVERIFY(script.open(QIODevice::ReadOnly));
|
||||
auto scriptText = script.readAll();
|
||||
|
||||
QVERIFY(!scriptText.contains("Begin Custom Script"));
|
||||
|
||||
script.close();
|
||||
|
||||
runTestParams({"-bin", bin, "force-clear", "noOverwrite",
|
||||
"-libOut", "lib",
|
||||
"-customScript", "echo 'this is test script'"}, &comapareTree);
|
||||
|
||||
QVERIFY(script.open(QIODevice::ReadOnly));
|
||||
|
||||
scriptText = script.readAll();
|
||||
|
||||
QVERIFY(scriptText.contains("Begin Custom Script"));
|
||||
QVERIFY(scriptText.contains("echo 'this is test script'"));
|
||||
QVERIFY(scriptText.contains("End Custom Script"));
|
||||
|
||||
script.close();
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
void deploytest::testOverwrite() {
|
||||
@ -1226,6 +1287,35 @@ void deploytest::testConfFile() {
|
||||
|
||||
QFile::remove(TestBinDir + "/../folder/For/Testing/Deploy/File/TestConf.json");
|
||||
|
||||
// Test generar string in confFile
|
||||
comapareTree = Modules::qtLibs();
|
||||
|
||||
comapareTree = Modules::ignoreFilter(comapareTree, "/plugins/p");
|
||||
#ifdef Q_OS_UNIX
|
||||
comapareTree -= utils.createTree(
|
||||
{
|
||||
"./" + DISTRO_DIR + "/lib/libQt5EglFSDeviceIntegration.so",
|
||||
"./" + DISTRO_DIR + "/lib/libQt5WebSockets.so"
|
||||
});
|
||||
auto bin = TestBinDir + "QtWidgetsProject";
|
||||
#else
|
||||
comapareTree -= utils.createTree(
|
||||
{
|
||||
"./" + DISTRO_DIR + "/Qt5WebSockets.dll"
|
||||
});
|
||||
auto bin = TestBinDir + "QtWidgetsProject.exe";
|
||||
#endif
|
||||
|
||||
runTestParams({"-bin", bin,
|
||||
"-qmake", qmake,
|
||||
"clear",
|
||||
"-ignore", "/plugins/p",
|
||||
"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
|
||||
|
||||
|
||||
runTestParams({"-confFile", TestBinDir + "/TestConf.json"}, &comapareTree);
|
||||
QFile::remove(TestBinDir + "/TestConf.json");
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
QFile f("./" + DISTRO_DIR + "/bin/TestOnlyC");
|
||||
comapareTree = utils.createTree(
|
||||
@ -1694,6 +1784,61 @@ void deploytest::testSystemLib() {
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-synch-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-util-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Core-Heap-Obsolete-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Core-Kernel32-Private-L1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-file-l2-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-localization-obsolete-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-string-l2-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-string-obsolete-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-core-xstate-l2-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-com-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-comm-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-datetime-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-debug-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-delayload-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-errorhandling-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-fibers-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-file-l1-2-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-interlocked-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-io-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-kernel32-legacy-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-libraryloader-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-localization-l1-2-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-memory-l1-1-2.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-privateprofile-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-processenvironment-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-processthreads-l1-1-2.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-processtopology-obsolete-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-realtime-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-registry-l2-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-rtlsupport-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-legacy-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-shlwapi-obsolete-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-shutdown-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-stringansi-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-stringloader-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-sysinfo-l1-2-1.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-l1-2-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-legacy-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-threadpool-private-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-timezone-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-url-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-version-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-wow64-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-core-xstate-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-service-core-l1-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/libgcc_s_seh-1.dll",
|
||||
"./" + DISTRO_DIR + "/libstdc++-6.dll",
|
||||
"./" + DISTRO_DIR + "/libwinpthread-1.dll",
|
||||
@ -1822,7 +1967,25 @@ void deploytest::testSystemLib() {
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-time-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-security-base-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-security-cryptoapi-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/dwmapi.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Controller-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Eventing-Legacy-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-Security-Lsalookup-L2-1-1.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-devices-config-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-security-lsapolicy-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/API-MS-Win-security-provider-L1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-conio-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-convert-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-environment-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-filesystem-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-heap-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-locale-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-multibyte-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-process-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-stdio-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-crt-utility-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-eventing-consumer-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/api-ms-win-security-sddl-l1-1-0.dll",
|
||||
"./" + DISTRO_DIR + "/mpr.dll",
|
||||
"./" + DISTRO_DIR + "/profapi.dll",
|
||||
"./" + DISTRO_DIR + "/rpcrt4.dll",
|
||||
@ -1830,7 +1993,8 @@ void deploytest::testSystemLib() {
|
||||
"./" + DISTRO_DIR + "/userenv.dll",
|
||||
"./" + DISTRO_DIR + "/uxtheme.dll",
|
||||
"./" + DISTRO_DIR + "/version.dll",
|
||||
"./" + DISTRO_DIR + "/win32u.dll"
|
||||
"./" + DISTRO_DIR + "/ucrtbase.dll",
|
||||
|
||||
});
|
||||
|
||||
runTestParams({"-bin", bin, "clear" ,
|
||||
@ -1838,6 +2002,7 @@ void deploytest::testSystemLib() {
|
||||
"deploySystem"
|
||||
}, &comapareTree, true);
|
||||
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -55,10 +55,10 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
|
||||
| | Examples:" },
|
||||
| | cqtdeployer qif - for use default templates of qt installer framework." |
|
||||
| | cqtdeployer -qif path/to/folder/with/qifTemplate - for use custom templates of qt installer framework." |
|
||||
| -customScript [scriptCode] | Insert extra code inTo All run script. |
|
||||
| deploySystem | Deploys all libraries |
|
||||
| clear | Deletes deployable files of the previous session. |
|
||||
| force-clear | Deletes the destination directory before deployment. |
|
||||
| | For example -runScript myApp.sh |
|
||||
| allQmlDependes | Extracts all the qml libraries. |
|
||||
| | (not recommended, as it takes great amount of computer memory) |
|
||||
| version / v | Shows compiled version |
|
||||
@ -130,6 +130,7 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
|
||||
| | Примеры:" },
|
||||
| | cqtdeployer qif - для использования стандартных шаблонов фреймворка qt. "|
|
||||
| | cqtdeployer -qif path/to/folder/with/qifTemplate - для использования пользовательских шаблонов среды установки qt. "|
|
||||
| -customScript [scriptCode] | Установит дополнительный код в скрипты запуска. |
|
||||
| -extraPlugin [list,params] | Устанавливает дополнительный путь для extraPlugin приложения |
|
||||
| -recursiveDepth [params] | Устанавливает глубину поиска библиотек (по умолчанию 0) |
|
||||
| -targetDir [params] | Устанавливает целевой каталог (по умолчанию это путь к первому развертываемому файлу)|
|
||||
@ -138,7 +139,6 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
|
||||
| deploySystem | Копирует все библиотеки кроме libc |
|
||||
| clear | Удаляет все старые файлы (с прошлого запуска) |
|
||||
| force-clear | Удаляет целевую директорию перед развертыванием |
|
||||
| | пример -runScript myApp.sh |
|
||||
| allQmlDependes | Извлекает все библиотеки qml. |
|
||||
| | (не рекомендуется, так как занимает много памяти) |
|
||||
| deploySystem-with-libc | Копирует все зависимости в том числе и libc |
|
||||
|
Loading…
x
Reference in New Issue
Block a user