Merge branch 'v1.4' of github.com:QuasarApp/CQtDeployer into v1.4

This commit is contained in:
Andrei Yankovich 2020-01-18 15:45:34 +03:00
commit 56cc654112
7 changed files with 161 additions and 27 deletions

View File

@ -21,11 +21,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: {
@ -132,17 +131,8 @@ void ConfigParser::readKey(const QString& key, const QJsonObject& obj,
QString val = i.toString();
if (!val.isEmpty()) {
if (PathUtils::isPath(val)) {
QString path;
if (PathUtils::isAbsalutPath(val)) {
path = QFileInfo(val).absoluteFilePath();
} else {
path = QFileInfo(confFileDir + '/' + val).absoluteFilePath();
}
list.push_back(path);
if (PathUtils::isReleativePath(val)) {
list.push_back(QFileInfo(confFileDir + '/' + val).absoluteFilePath());
} else {
list.push_back(val);
}
@ -155,16 +145,12 @@ void ConfigParser::readKey(const QString& key, const QJsonObject& obj,
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);
@ -514,6 +500,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"));
}

View File

@ -14,7 +14,9 @@
#include <QDebug>
#include "pathutils.h"
DependenciesScanner::DependenciesScanner() {}
DependenciesScanner::DependenciesScanner() {
}
void DependenciesScanner::clearScaned() {
_scanedLibs.clear();
@ -158,6 +160,11 @@ void DependenciesScanner::addToWinAPI(const QString &lib, QHash<WinAPI, QSet<QSt
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);

View File

@ -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) {

View File

@ -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

View File

@ -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

View File

@ -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();

View File

@ -894,6 +894,7 @@ void deploytest::costomScript() {
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";
@ -1177,6 +1178,37 @@ 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");
}
void deploytest::testQt() {
@ -1540,6 +1572,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",
@ -1668,7 +1755,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",
@ -1676,7 +1781,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" ,