fix output logs

This commit is contained in:
Andrei Yankovich 2020-04-04 15:43:46 +03:00
parent c9fbda9bd7
commit 2e41cd0b2d
16 changed files with 147 additions and 121 deletions

View File

@ -24,12 +24,10 @@ int main(int argc, char *argv[]) {
if (!QuasarAppUtils::Params::parseParams(argc, argv)) { if (!QuasarAppUtils::Params::parseParams(argc, argv)) {
qWarning() << "wrong parametrs"; QuasarAppUtils::Params::log("wrong parametrs", QuasarAppUtils::Warning);
DeployCore::help(); DeployCore::help();
exit(0); exit(0);
} }
QuasarAppUtils::Params::setEnable("noWriteInFileLog", true);
Deploy deploy; Deploy deploy;
return deploy.run(); return deploy.run();

View File

@ -236,7 +236,7 @@ QString QIF::getStyle(const QString& input) const {
return f.absoluteFilePath(); return f.absoluteFilePath();
} }
QuasarAppUtils::Params::verboseLog(input + " not exits", QuasarAppUtils::Params::log(input + " not exits",
QuasarAppUtils::Error); QuasarAppUtils::Error);
return ""; return "";

View File

@ -71,7 +71,7 @@ bool ConfigParser::parseParams() {
if (QFile::exists(path)) { if (QFile::exists(path)) {
if (!loadFromFile(path)) { if (!loadFromFile(path)) {
QuasarAppUtils::Params::verboseLog("failed to parse " + path, QuasarAppUtils::Params::log("failed to parse " + path,
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
} }
@ -82,39 +82,46 @@ bool ConfigParser::parseParams() {
switch (DeployCore::getMode()) { switch (DeployCore::getMode()) {
case RunMode::Info: { case RunMode::Info: {
qInfo() << "Print info ..." ; QuasarAppUtils::Params::log("Print info ...",
QuasarAppUtils::Info);
if (!parseInfoMode()) { if (!parseInfoMode()) {
qCritical() << "show info is failed!"; QuasarAppUtils::Params::log("show info is failed!",
QuasarAppUtils::Error);
return false; return false;
} }
break; break;
} }
case RunMode::Clear: { case RunMode::Clear: {
qInfo() << "clear ..." ; QuasarAppUtils::Params::log("clear ...",
QuasarAppUtils::Info);
if (!parseClearMode()) { if (!parseClearMode()) {
qCritical() << "clear is failed!"; QuasarAppUtils::Params::log("clear is failed!",
QuasarAppUtils::Error);
return false; return false;
} }
break; break;
} }
case RunMode::Init: { case RunMode::Init: {
qInfo() << "Init ..." ; QuasarAppUtils::Params::log("Init ...",
QuasarAppUtils::Info);
if (!parseInitMode()) { if (!parseInitMode()) {
qCritical() << "init is failed!"; QuasarAppUtils::Params::log("init is failed!",
QuasarAppUtils::Error);
return false; return false;
} }
break; break;
} }
case RunMode::Deploy: { case RunMode::Deploy: {
qInfo() << "Deploy ..." ; QuasarAppUtils::Params::log("Deploy ...",
QuasarAppUtils::Info);
if (!parseDeployMode()) { if (!parseDeployMode()) {
qCritical() << "deploy is failed!"; QuasarAppUtils::Params::log("deploy is failed!",
QuasarAppUtils::Error);
return false; return false;
} }
break; break;
@ -125,7 +132,7 @@ bool ConfigParser::parseParams() {
DeployCore::_config = &_config; DeployCore::_config = &_config;
if (createFile && !createFromDeploy(path)) { if (createFile && !createFromDeploy(path)) {
QuasarAppUtils::Params::verboseLog("Do not create a deploy config file in " + path, QuasarAppUtils::Params::log("Do not create a deploy config file in " + path,
QuasarAppUtils::Error); QuasarAppUtils::Error);
} }
@ -350,7 +357,7 @@ bool ConfigParser::initDistroStruct() {
split(DeployCore::getSeparator(0), QString::SkipEmptyParts); split(DeployCore::getSeparator(0), QString::SkipEmptyParts);
auto erroLog = [](const QString &flag){ auto erroLog = [](const QString &flag){
QuasarAppUtils::Params::verboseLog(QString("Set %0 fail, because you try set %0 for not inited package." QuasarAppUtils::Params::log(QString("Set %0 fail, because you try set %0 for not inited package."
" Use 'targetPackage' flag for init the packages").arg(flag), " Use 'targetPackage' flag for init the packages").arg(flag),
QuasarAppUtils::Error); QuasarAppUtils::Error);
}; };
@ -449,7 +456,7 @@ bool ConfigParser::initPackages() {
} }
} }
QuasarAppUtils::Params::verboseLog( QuasarAppUtils::Params::log(
"Set Default Package to " + defaultPackage, "Set Default Package to " + defaultPackage,
QuasarAppUtils::Info); QuasarAppUtils::Info);
} }
@ -468,7 +475,7 @@ bool ConfigParser::initQmlInput() {
} }
auto erroLog = [](const QString &flag){ auto erroLog = [](const QString &flag){
QuasarAppUtils::Params::verboseLog(QString("Set %0 fail, because you try set %0 for not inited package." QuasarAppUtils::Params::log(QString("Set %0 fail, because you try set %0 for not inited package."
" Use 'targetPackage' flag for init the packages").arg(flag), " Use 'targetPackage' flag for init the packages").arg(flag),
QuasarAppUtils::Error); QuasarAppUtils::Error);
}; };
@ -497,7 +504,8 @@ bool ConfigParser::parseDeployMode() {
auto binDir = QuasarAppUtils::Params::getStrArg("binDir"); auto binDir = QuasarAppUtils::Params::getStrArg("binDir");
if (!setTargetsRecursive(binDir)) { if (!setTargetsRecursive(binDir)) {
qCritical() << "setTargetDir fail!"; QuasarAppUtils::Params::log("setTargetDir fail!",
QuasarAppUtils::Error);
return false; return false;
} }
} }
@ -517,7 +525,8 @@ bool ConfigParser::parseDeployMode() {
_config.depchLimit = QuasarAppUtils::Params::getArg("recursiveDepth").toInt(&ok); _config.depchLimit = QuasarAppUtils::Params::getArg("recursiveDepth").toInt(&ok);
if (!ok) { if (!ok) {
_config.depchLimit = 0; _config.depchLimit = 0;
qWarning() << "recursiveDepth is invalid! use default value 0"; QuasarAppUtils::Params::log("recursiveDepth is invalid! use default value 0",
QuasarAppUtils::Warning);
} }
} }
@ -620,7 +629,8 @@ void ConfigParser::setTargetDir(const QString &target) {
} else { } else {
_config.setTargetDir(QFileInfo("./" + DISTRO_DIR).absoluteFilePath()); _config.setTargetDir(QFileInfo("./" + DISTRO_DIR).absoluteFilePath());
qInfo () << "flag targetDir not used." << "use default target dir :" << _config.getTargetDir(); QuasarAppUtils::Params::log("flag targetDir not used. use default target dir :" + _config.getTargetDir(),
QuasarAppUtils::Info);
} }
} }
@ -662,7 +672,8 @@ bool ConfigParser::setTargets(const QStringList &value) {
bool ConfigParser::setTargetsRecursive(const QString &dir) { bool ConfigParser::setTargetsRecursive(const QString &dir) {
if (!setBinDir(dir, true)) { if (!setBinDir(dir, true)) {
qWarning() << "setBinDir failed!"; QuasarAppUtils::Params::log("setBinDir failed!",
QuasarAppUtils::Warning);
return false; return false;
} }
@ -859,16 +870,16 @@ bool ConfigParser::initQmakePrivate(const QString &qmake) {
QDir dir(basePath); QDir dir(basePath);
if (!dir.cdUp()) { if (!dir.cdUp()) {
QuasarAppUtils::Params::verboseLog("fail init qmake", QuasarAppUtils::Params::log("fail init qmake",
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
} }
QuasarAppUtils::Params::verboseLog("exec qmake fail!, try init qtDir from path:" + dir.absolutePath(), QuasarAppUtils::Params::log("exec qmake fail!, try init qtDir from path:" + dir.absolutePath(),
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
if (!setQtDir(dir.absolutePath())){ if (!setQtDir(dir.absolutePath())){
QuasarAppUtils::Params::verboseLog("fail ini qmake", QuasarAppUtils::Params::log("fail ini qmake",
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
} }
@ -893,19 +904,22 @@ bool ConfigParser::initQmake() {
if (!QuasarAppUtils::Params::isEndable("noCheckPATH") && isNeededQt()) { if (!QuasarAppUtils::Params::isEndable("noCheckPATH") && isNeededQt()) {
auto env = QProcessEnvironment::systemEnvironment(); auto env = QProcessEnvironment::systemEnvironment();
auto proc = DeployCore::findProcess(env.value("PATH"), "qmake"); auto proc = DeployCore::findProcess(env.value("PATH"), "qmake");
if (proc.isEmpty()) if (proc.isEmpty()) {
QuasarAppUtils::Params::log("The deployment target requir Qt libs, but init qmake is failed.",
QuasarAppUtils::Error);
return false; return false;
}
return initQmakePrivate(proc); return initQmakePrivate(proc);
} }
QuasarAppUtils::Params::log("deploy only C libs because qmake is not found",
qInfo() << "deploy only C libs because qmake is not found"; QuasarAppUtils::Info);
return true; return true;
} }
if (qtList.size() > 1) { if (qtList.size() > 1) {
QuasarAppUtils::Params::verboseLog("Your deployment targets were compiled by different qmake," QuasarAppUtils::Params::log("Your deployment targets were compiled by different qmake,"
"qt auto-capture is not possible. Use the -qmake flag to solve this problem.", "qt auto-capture is not possible. Use the -qmake flag to solve this problem.",
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
@ -939,7 +953,7 @@ bool ConfigParser::setQmake(const QString &value) {
proc.start(); proc.start();
if (!proc.waitForFinished(1000)) { if (!proc.waitForFinished(1000)) {
QuasarAppUtils::Params::verboseLog("run qmake fail!"); QuasarAppUtils::Params::log("run qmake fail!");
return false; return false;
} }
@ -983,32 +997,32 @@ bool ConfigParser::setQtDir(const QString &value) {
QFileInfo info(value); QFileInfo info(value);
if (!QFile::exists(info.absoluteFilePath() + ("/bin"))) { if (!QFile::exists(info.absoluteFilePath() + ("/bin"))) {
QuasarAppUtils::Params::verboseLog("get qt bin fail!"); QuasarAppUtils::Params::log("get qt bin fail!");
return false; return false;
} }
_config.qtDir.setBins(info.absoluteFilePath() + ("/bin")); _config.qtDir.setBins(info.absoluteFilePath() + ("/bin"));
if (!QFile::exists(info.absoluteFilePath() + ("/lib"))) { if (!QFile::exists(info.absoluteFilePath() + ("/lib"))) {
QuasarAppUtils::Params::verboseLog("get qt lib fail!"); QuasarAppUtils::Params::log("get qt lib fail!");
return false; return false;
} }
_config.qtDir.setLibs(info.absoluteFilePath() + ("/lib")); _config.qtDir.setLibs(info.absoluteFilePath() + ("/lib"));
if (!QFile::exists(info.absoluteFilePath() + ("/qml"))) { if (!QFile::exists(info.absoluteFilePath() + ("/qml"))) {
QuasarAppUtils::Params::verboseLog("get qt qml fail!"); QuasarAppUtils::Params::log("get qt qml fail!");
} else { } else {
_config.qtDir.setQmls(info.absoluteFilePath() + ("/qml")); _config.qtDir.setQmls(info.absoluteFilePath() + ("/qml"));
} }
if (!QFile::exists(info.absoluteFilePath() + ("/plugins"))) { if (!QFile::exists(info.absoluteFilePath() + ("/plugins"))) {
QuasarAppUtils::Params::verboseLog("get qt plugins fail!"); QuasarAppUtils::Params::log("get qt plugins fail!");
} else { } else {
_config.qtDir.setPlugins(info.absoluteFilePath() + ("/plugins")); _config.qtDir.setPlugins(info.absoluteFilePath() + ("/plugins"));
} }
#ifdef Q_OS_UNIX #ifdef Q_OS_UNIX
if (!QFile::exists(info.absoluteFilePath() + ("/libexec"))) { if (!QFile::exists(info.absoluteFilePath() + ("/libexec"))) {
QuasarAppUtils::Params::verboseLog("get qt libexec fail!"); QuasarAppUtils::Params::log("get qt libexec fail!");
} else { } else {
_config.qtDir.setLibexecs(info.absoluteFilePath() + ("/libexec")); _config.qtDir.setLibexecs(info.absoluteFilePath() + ("/libexec"));
} }
@ -1018,13 +1032,13 @@ bool ConfigParser::setQtDir(const QString &value) {
#endif #endif
if (!QFile::exists(info.absoluteFilePath() + ("/translations"))) { if (!QFile::exists(info.absoluteFilePath() + ("/translations"))) {
QuasarAppUtils::Params::verboseLog("get qt translations fail!"); QuasarAppUtils::Params::log("get qt translations fail!");
} else { } else {
_config.qtDir.setTranslations(info.absoluteFilePath() + ("/translations")); _config.qtDir.setTranslations(info.absoluteFilePath() + ("/translations"));
} }
if (!QFile::exists(info.absoluteFilePath() + ("/resources"))) { if (!QFile::exists(info.absoluteFilePath() + ("/resources"))) {
QuasarAppUtils::Params::verboseLog("get qt resources fail!"); QuasarAppUtils::Params::log("get qt resources fail!");
} else { } else {
_config.qtDir.setResources(info.absoluteFilePath() + ("/resources")); _config.qtDir.setResources(info.absoluteFilePath() + ("/resources"));
} }
@ -1049,7 +1063,7 @@ void ConfigParser::setExtraPath(const QStringList &value) {
QFileInfo info(i); QFileInfo info(i);
if (info.isDir()) { if (info.isDir()) {
if (_config.targets().contains(info.absoluteFilePath())) { if (_config.targets().contains(info.absoluteFilePath())) {
QuasarAppUtils::Params::verboseLog("skip the extra lib path because it is target!", QuasarAppUtils::Params::log("skip the extra lib path because it is target!",
QuasarAppUtils::Info); QuasarAppUtils::Info);
continue; continue;
} }
@ -1063,10 +1077,10 @@ void ConfigParser::setExtraPath(const QStringList &value) {
_config.extraPaths.addExtraPathsMasks({i}); _config.extraPaths.addExtraPathsMasks({i});
QuasarAppUtils::Params::verboseLog(i + " added like a path mask", QuasarAppUtils::Params::log(i + " added like a path mask",
QuasarAppUtils::Info); QuasarAppUtils::Info);
} else { } else {
QuasarAppUtils::Params::verboseLog(i + " not added in path mask because" QuasarAppUtils::Params::log(i + " not added in path mask because"
" the path mask must be large 2 characters", " the path mask must be large 2 characters",
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
} }
@ -1078,10 +1092,10 @@ void ConfigParser::setExtraNames(const QStringList &value) {
if (i.size() > 1) { if (i.size() > 1) {
_config.extraPaths.addtExtraNamesMasks({i}); _config.extraPaths.addtExtraNamesMasks({i});
QuasarAppUtils::Params::verboseLog(i + " added like a file name mask", QuasarAppUtils::Params::log(i + " added like a file name mask",
QuasarAppUtils::Info); QuasarAppUtils::Info);
} else { } else {
QuasarAppUtils::Params::verboseLog(i + " not added in file mask because" QuasarAppUtils::Params::log(i + " not added in file mask because"
" the file mask must be large 2 characters", " the file mask must be large 2 characters",
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
} }
@ -1141,7 +1155,8 @@ void ConfigParser::initEnvirement() {
_config.envirement.addEnv(dirs); _config.envirement.addEnv(dirs);
if (_config.envirement.size() < 2) { if (_config.envirement.size() < 2) {
qWarning() << "system environment is empty"; QuasarAppUtils::Params::log("system environment is empty",
QuasarAppUtils::Warning);
} }
} }
@ -1219,5 +1234,5 @@ ConfigParser::ConfigParser(FileManager *filemanager, DependenciesScanner* scaner
_config.appDir = QuasarAppUtils::Params::getStrArg("appPath"); _config.appDir = QuasarAppUtils::Params::getStrArg("appPath");
#endif #endif
QuasarAppUtils::Params::verboseLog("appDir = " + _config.appDir); QuasarAppUtils::Params::log("appDir = " + _config.appDir);
} }

View File

@ -54,7 +54,7 @@ QMultiMap<LibPriority, LibInfo> DependenciesScanner::getLibsFromEnvirement(
} }
if (!fillLibInfo(info, lib)) { if (!fillLibInfo(info, lib)) {
QuasarAppUtils::Params::verboseLog( QuasarAppUtils::Params::log(
"error extract lib info from " + lib + "(" + libName + ")", "error extract lib info from " + lib + "(" + libName + ")",
QuasarAppUtils::VerboseLvl::Warning); QuasarAppUtils::VerboseLvl::Warning);
continue; continue;
@ -88,14 +88,15 @@ bool DependenciesScanner::fillLibInfo(LibInfo &info, const QString &file) const
} }
void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QString>& libStack) { void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QString>& libStack) {
QuasarAppUtils::Params::verboseLog("get recursive dependencies of " + lib.fullPath(), QuasarAppUtils::Params::log("get recursive dependencies of " + lib.fullPath(),
QuasarAppUtils::Info); QuasarAppUtils::Info);
if (_scanedLibs.contains(lib.fullPath())) { if (_scanedLibs.contains(lib.fullPath())) {
auto scanedLib = _scanedLibs.value(lib.fullPath()); auto scanedLib = _scanedLibs.value(lib.fullPath());
if (!scanedLib.isValid()) { if (!scanedLib.isValid()) {
qCritical() << "no valid lib in scaned libs list!"; QuasarAppUtils::Params::log( "no valid lib in scaned libs list!",
QuasarAppUtils::Error);
return; return;
} }
@ -105,7 +106,7 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS
} }
if (libStack.contains(lib.fullPath())) { if (libStack.contains(lib.fullPath())) {
QuasarAppUtils::Params::verboseLog("A recursive dependency was found in library " + lib.fullPath(), QuasarAppUtils::Params::log("A recursive dependency was found in library " + lib.fullPath(),
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
return; return;
} }
@ -117,7 +118,7 @@ void DependenciesScanner::recursiveDep(LibInfo &lib, QSet<LibInfo> &res, QSet<QS
auto libs = getLibsFromEnvirement(i); auto libs = getLibsFromEnvirement(i);
if (!libs.size()) { if (!libs.size()) {
QuasarAppUtils::Params::verboseLog("lib for dependese " + i + " not findet!!", QuasarAppUtils::Params::log("lib for dependese " + i + " not findet!!",
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
continue; continue;
} }

View File

@ -15,6 +15,7 @@
#include <QFileInfo> #include <QFileInfo>
#include <QLibraryInfo> #include <QLibraryInfo>
#include <configparser.h> #include <configparser.h>
#include <iostream>
//QString DeployCore::qtDir = ""; //QString DeployCore::qtDir = "";
//QStringList DeployCore::extraPaths = QStringList(); //QStringList DeployCore::extraPaths = QStringList();
@ -99,11 +100,11 @@ DeployCore::QtModule DeployCore::getQtModule(const QString& path) {
void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) { void DeployCore::addQtModule(DeployCore::QtModule &module, const QString &path) {
QuasarAppUtils::Params::verboseLog("current module " + QString::number(module), QuasarAppUtils::Params::log("current module " + QString::number(module),
QuasarAppUtils::Info); QuasarAppUtils::Info);
auto mod = getQtModule(path); auto mod = getQtModule(path);
QuasarAppUtils::Params::verboseLog("add new module from path " + path + QuasarAppUtils::Params::log("add new module from path " + path +
" module value " + QString::number(mod), " module value " + QString::number(mod),
QuasarAppUtils::Info); QuasarAppUtils::Info);
@ -236,9 +237,6 @@ void DeployCore::help() {
{"-releaseDate [package;val,val]", "Sets release date for package"}, {"-releaseDate [package;val,val]", "Sets release date for package"},
{"-icon [package;val,val]", "Sets path to icon for package"}, {"-icon [package;val,val]", "Sets path to icon for package"},
{"-publisher [package;val,val]", "Sets publisher for package"}, {"-publisher [package;val,val]", "Sets publisher for package"},
{"-qifStyle [path/to/style.css]", "Sets the path to the CSS style file or sets the default style. Available styles: quasar "},
{"-qifBanner [path/to/banner.png]", "Sets path to the banner png file."},
{"-qifLogo [path/to/logo.png]", "Sets path to the logo png file."},
} }
}, },
@ -339,8 +337,8 @@ QString DeployCore::getQtVersion() {
} }
void DeployCore::printVersion() { void DeployCore::printVersion() {
qInfo() << "CQtDeployer: " + getAppVersion() + " " + getAppVersionName(); std::cout << QString{"CQtDeployer: " + getAppVersion() + " " + getAppVersionName()}.toStdString() << std::endl;
qInfo() << "Qt: " + getQtVersion(); std::cout << QString{"Qt: " + getQtVersion()}.toStdString() << std::endl;
} }
bool DeployCore::isExecutable(const QFileInfo& file) { bool DeployCore::isExecutable(const QFileInfo& file) {
@ -392,19 +390,19 @@ MSVCVersion DeployCore::getMSVC(const QString &_qtBin) {
QDir dir = QFileInfo(_qtBin).absoluteFilePath(); QDir dir = QFileInfo(_qtBin).absoluteFilePath();
if (!dir.cdUp()) { if (!dir.cdUp()) {
QuasarAppUtils::Params::verboseLog("is not standart qt repo"); QuasarAppUtils::Params::log("is not standart qt repo");
return static_cast<MSVCVersion>(res); return static_cast<MSVCVersion>(res);
} }
auto msvcPath = dir.absolutePath(); auto msvcPath = dir.absolutePath();
if (!(dir.cdUp() && dir.cdUp())) { if (!(dir.cdUp() && dir.cdUp())) {
QuasarAppUtils::Params::verboseLog("is not standart qt repo"); QuasarAppUtils::Params::log("is not standart qt repo");
return static_cast<MSVCVersion>(res); return static_cast<MSVCVersion>(res);
} }
if (!msvcPath.contains("msvc")) { if (!msvcPath.contains("msvc")) {
QuasarAppUtils::Params::verboseLog("vcredis not defined"); QuasarAppUtils::Params::log("vcredis not defined");
return static_cast<MSVCVersion>(res); return static_cast<MSVCVersion>(res);
} }
@ -441,7 +439,7 @@ QString DeployCore::getVCredist(const QString &_qtbinDir) {
QDir dir = _qtbinDir; QDir dir = _qtbinDir;
if (!(dir.cdUp() && dir.cdUp() && dir.cdUp() && dir.cd("vcredist"))) { if (!(dir.cdUp() && dir.cdUp() && dir.cdUp() && dir.cd("vcredist"))) {
QuasarAppUtils::Params::verboseLog("redist not findet!"); QuasarAppUtils::Params::log("redist not findet!");
return ""; return "";
} }

View File

@ -61,12 +61,12 @@ void Envirement::addEnv(const QStringList &listDirs) {
} }
if (!QFileInfo(path).isDir()) { if (!QFileInfo(path).isDir()) {
QuasarAppUtils::Params::verboseLog("is not dir!! :" + path); QuasarAppUtils::Params::log("is not dir!! :" + path);
continue; continue;
} }
if (_dataEnvironment.contains(path)) { if (_dataEnvironment.contains(path)) {
QuasarAppUtils::Params::verboseLog ("Environment alredy added: " + path); QuasarAppUtils::Params::log ("Environment alredy added: " + path);
continue; continue;
} }

View File

@ -27,7 +27,8 @@
#include <fstream> #include <fstream>
bool Extracter::deployMSVC() { bool Extracter::deployMSVC() {
qInfo () << "try deploy msvc"; QuasarAppUtils::Params::log("try deploy msvc",
QuasarAppUtils::Info);
auto msvcInstaller = DeployCore::getVCredist(DeployCore::_config->qtDir.getBins()); auto msvcInstaller = DeployCore::getVCredist(DeployCore::_config->qtDir.getBins());
if (msvcInstaller.isEmpty()) { if (msvcInstaller.isEmpty()) {
@ -128,7 +129,8 @@ void Extracter::copyExtraPlugins(const QString& package) {
void Extracter::copyPlugins(const QStringList &list, const QString& package) { void Extracter::copyPlugins(const QStringList &list, const QString& package) {
for (const auto &plugin : list) { for (const auto &plugin : list) {
if (!copyPlugin(plugin, package)) { if (!copyPlugin(plugin, package)) {
qWarning() << plugin << " not copied!"; QuasarAppUtils::Params::log("not copied!",
QuasarAppUtils::Warning);
} }
} }
copyExtraPlugins(package); copyExtraPlugins(package);
@ -148,8 +150,8 @@ void Extracter::extractAllTargets() {
void Extracter::clear() { void Extracter::clear() {
if (QuasarAppUtils::Params::isEndable("clear") || if (QuasarAppUtils::Params::isEndable("clear") ||
QuasarAppUtils::Params::isEndable("force-clear")) { QuasarAppUtils::Params::isEndable("force-clear")) {
qInfo() << "clear old data"; QuasarAppUtils::Params::log("clear old data",
QuasarAppUtils::Info);
_fileManager->clear(DeployCore::_config->getTargetDir(), _fileManager->clear(DeployCore::_config->getTargetDir(),
QuasarAppUtils::Params::isEndable("force-clear")); QuasarAppUtils::Params::isEndable("force-clear"));
} }
@ -175,7 +177,7 @@ void Extracter::copyLibs(const QSet<QString> &files, const QString& package) {
for (const auto &file : files) { for (const auto &file : files) {
if (!_fileManager->smartCopyFile(file, targetPath + distro.getLibOutDir())) { if (!_fileManager->smartCopyFile(file, targetPath + distro.getLibOutDir())) {
QuasarAppUtils::Params::verboseLog(file + " not copied"); QuasarAppUtils::Params::log(file + " not copied");
} }
} }
} }
@ -192,7 +194,7 @@ void Extracter::copyFiles() {
} }
if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(cnf->getTargetDir())) { if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(cnf->getTargetDir())) {
QuasarAppUtils::Params::verboseLog("strip failed!"); QuasarAppUtils::Params::log("strip failed!");
} }
} }
} }
@ -206,7 +208,7 @@ void Extracter::copyTr() {
for (auto i = cnf->packages().cbegin(); i != cnf->packages().cend(); ++i) { for (auto i = cnf->packages().cbegin(); i != cnf->packages().cend(); ++i) {
if (!copyTranslations(DeployCore::extractTranslation(_packageDependencyes[i.key()].neadedLibs()), if (!copyTranslations(DeployCore::extractTranslation(_packageDependencyes[i.key()].neadedLibs()),
i.key())) { i.key())) {
QuasarAppUtils::Params::verboseLog("Failed to copy standard Qt translations", QuasarAppUtils::Params::log("Failed to copy standard Qt translations",
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
} }
} }
@ -215,15 +217,16 @@ void Extracter::copyTr() {
} }
void Extracter::deploy() { void Extracter::deploy() {
qInfo() << "target deploy started!!"; QuasarAppUtils::Params::log("target deploy started!!",
QuasarAppUtils::Info);
clear(); clear();
_cqt->smartMoveTargets(); _cqt->smartMoveTargets();
_scaner->setEnvironment(DeployCore::_config->envirement.environmentList()); _scaner->setEnvironment(DeployCore::_config->envirement.environmentList());
extractAllTargets(); extractAllTargets();
if (DeployCore::_config->deployQml && !extractQml()) { if (DeployCore::_config->deployQml && !extractQml()) {
qCritical() << "qml not extacted!"; QuasarAppUtils::Params::log("qml not extacted!",
QuasarAppUtils::Error);
} }
extractPlugins(); extractPlugins();
@ -233,16 +236,16 @@ void Extracter::deploy() {
copyTr(); copyTr();
if (!extractWebEngine()) { if (!extractWebEngine()) {
QuasarAppUtils::Params::verboseLog("deploy webEngine failed", QuasarAppUtils::Error); QuasarAppUtils::Params::log("deploy webEngine failed", QuasarAppUtils::Error);
} }
if (!deployMSVC()) { if (!deployMSVC()) {
QuasarAppUtils::Params::verboseLog("deploy msvc failed"); QuasarAppUtils::Params::log("deploy msvc failed");
} }
_metaFileManager->createRunMetaFiles(); _metaFileManager->createRunMetaFiles();
QuasarAppUtils::Params::log("deploy done!",
qInfo() << "deploy done!"; QuasarAppUtils::Info);
} }
@ -306,8 +309,8 @@ void Extracter::extractLib(const QString &file,
const QString& mask) { const QString& mask) {
assert(depMap); assert(depMap);
QuasarAppUtils::Params::log("extract lib :" + file,
qInfo() << "extract lib :" << file; QuasarAppUtils::Info);
auto data = _scaner->scan(file); auto data = _scaner->scan(file);
@ -344,7 +347,8 @@ void Extracter::extractPluginLib(const QString& item, const QString& package) {
bool Extracter::extractQmlAll() { bool Extracter::extractQmlAll() {
if (!QFileInfo::exists(DeployCore::_config->qtDir.getQmls())) { if (!QFileInfo::exists(DeployCore::_config->qtDir.getQmls())) {
qWarning() << "qml dir wrong!"; QuasarAppUtils::Params::log("qml dir wrong!",
QuasarAppUtils::Warning);
return false; return false;
} }
@ -389,20 +393,22 @@ bool Extracter::extractQmlFromSource() {
QFileInfo info(qmlInput); QFileInfo info(qmlInput);
if (!info.isDir()) { if (!info.isDir()) {
qCritical() << "extract qml fail! qml source dir not exits or is not dir " << qmlInput; QuasarAppUtils::Params::log("extract qml fail! qml source dir not exits or is not dir " + qmlInput,
QuasarAppUtils::Error);
continue; continue;
} }
QuasarAppUtils::Params::verboseLog("extractQmlFromSource " + info.absoluteFilePath()); QuasarAppUtils::Params::log("extractQmlFromSource " + info.absoluteFilePath());
if (!QFileInfo::exists(cnf->qtDir.getQmls())) { if (!QFileInfo::exists(cnf->qtDir.getQmls())) {
qWarning() << "qml dir wrong!"; QuasarAppUtils::Params::log("qml dir wrong!",
QuasarAppUtils::Warning);
continue; continue;
} }
QML ownQmlScaner(cnf->qtDir.getQmls()); QML ownQmlScaner(cnf->qtDir.getQmls());
if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) { if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
QuasarAppUtils::Params::verboseLog("qml scaner run failed!", QuasarAppUtils::Params::log("qml scaner run failed!",
QuasarAppUtils::Error); QuasarAppUtils::Error);
continue; continue;
} }
@ -451,7 +457,7 @@ void Extracter::extract(const QString &file,
extractLib(file, depMap, mask); extractLib(file, depMap, mask);
} else { } else {
QuasarAppUtils::Params::verboseLog("file with sufix " + sufix + " not supported!"); QuasarAppUtils::Params::log("file with sufix " + sufix + " not supported!");
} }
} }

View File

@ -67,7 +67,7 @@ bool FileManager::addToDeployed(const QString& path) {
|| completeSufix.toLower() == "sh")) { || completeSufix.toLower() == "sh")) {
if (!QFile::setPermissions(path, static_cast<QFile::Permission>(0x7777))) { if (!QFile::setPermissions(path, static_cast<QFile::Permission>(0x7777))) {
QuasarAppUtils::Params::verboseLog("permishens set fail", QuasarAppUtils::Warning); QuasarAppUtils::Params::log("permishens set fail", QuasarAppUtils::Warning);
} }
} }
@ -101,7 +101,7 @@ bool FileManager::strip(const QString &dir) const {
QFileInfo info(dir); QFileInfo info(dir);
if (!info.exists()) { if (!info.exists()) {
QuasarAppUtils::Params::verboseLog("dir not exits!"); QuasarAppUtils::Params::log("dir not exits!");
return false; return false;
} }
@ -154,7 +154,7 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
} }
if (!copy) { if (!copy) {
QuasarAppUtils::Params::verboseLog(((isMove)? "skip move :": "skip copy :" + file)); QuasarAppUtils::Params::log(((isMove)? "skip move :": "skip copy :" + file));
return false; return false;
} }
@ -180,15 +180,15 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
return false; return false;
} }
qInfo() << ((isMove)? "move :": "copy :") << file; QuasarAppUtils::Params::log(((isMove)? "move :": "copy :") + file,
QuasarAppUtils::Info);
QFile sourceFile(file); QFile sourceFile(file);
if (!((isMove)? if (!((isMove)?
sourceFile.rename(tergetFile): sourceFile.rename(tergetFile):
sourceFile.copy(tergetFile))) { sourceFile.copy(tergetFile))) {
QuasarAppUtils::Params::verboseLog("Qt Operation fail " + file + " >> " + tergetFile + QuasarAppUtils::Params::log("Qt Operation fail " + file + " >> " + tergetFile +
" Qt error: " + sourceFile.errorString(), " Qt error: " + sourceFile.errorString(),
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
@ -206,7 +206,7 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
dst << src.rdbuf(); dst << src.rdbuf();
if (!QFileInfo::exists(tergetFile)) { if (!QFileInfo::exists(tergetFile)) {
QuasarAppUtils::Params::verboseLog("std Operation fail file not copied. " QuasarAppUtils::Params::log("std Operation fail file not copied. "
"Сheck if you have access to the target dir", "Сheck if you have access to the target dir",
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
@ -220,7 +220,8 @@ bool FileManager::fileActionPrivate(const QString &file, const QString &target,
} else { } else {
if (QFileInfo(tergetFile).exists()) { if (QFileInfo(tergetFile).exists()) {
qInfo() << tergetFile << " already exists!"; QuasarAppUtils::Params::log(tergetFile + " already exists!",
QuasarAppUtils::Info);
return true; return true;
} }
@ -244,16 +245,18 @@ bool FileManager::smartCopyFile(const QString &file,
if (file.contains(config->getTargetDir(), ONLY_WIN_CASE_INSENSIATIVE)) { if (file.contains(config->getTargetDir(), ONLY_WIN_CASE_INSENSIATIVE)) {
if (!moveFile(file, target, mask)) { if (!moveFile(file, target, mask)) {
QuasarAppUtils::Params::verboseLog(" file not moved! try copy"); QuasarAppUtils::Params::log(" file not moved! try copy");
if (!copyFile(file, target, mask, ifFileTarget)) { if (!copyFile(file, target, mask, ifFileTarget)) {
qCritical() << "not copy target to bin dir " << file; QuasarAppUtils::Params::log("not copy target to bin dir " + file,
QuasarAppUtils::Error);
return false; return false;
} }
} }
} else { } else {
if (!copyFile(file, target, mask, ifFileTarget)) { if (!copyFile(file, target, mask, ifFileTarget)) {
qCritical() << "not copy target to bin dir " << file; QuasarAppUtils::Params::log("not copy target to bin dir " + file,
QuasarAppUtils::Error);
return false; return false;
} }
} }
@ -287,7 +290,7 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
} }
if (!skipFilter.isEmpty()) { if (!skipFilter.isEmpty()) {
QuasarAppUtils::Params::verboseLog( QuasarAppUtils::Params::log(
item.absoluteFilePath() + " ignored by filter " + skipFilter, item.absoluteFilePath() + " ignored by filter " + skipFilter,
QuasarAppUtils::VerboseLvl::Info); QuasarAppUtils::VerboseLvl::Info);
continue; continue;
@ -301,14 +304,14 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
if (config) if (config)
if (auto rule = config->ignoreList.isIgnore(info)) { if (auto rule = config->ignoreList.isIgnore(info)) {
QuasarAppUtils::Params::verboseLog( QuasarAppUtils::Params::log(
item.absoluteFilePath() + " ignored by rule " + rule->label, item.absoluteFilePath() + " ignored by rule " + rule->label,
QuasarAppUtils::VerboseLvl::Info); QuasarAppUtils::VerboseLvl::Info);
continue; continue;
} }
if (!copyFile(item.absoluteFilePath(), to , mask)) { if (!copyFile(item.absoluteFilePath(), to , mask)) {
QuasarAppUtils::Params::verboseLog( QuasarAppUtils::Params::log(
"not copied file " + to + "/" + item.fileName(), "not copied file " + to + "/" + item.fileName(),
QuasarAppUtils::VerboseLvl::Warning); QuasarAppUtils::VerboseLvl::Warning);
continue; continue;
@ -355,16 +358,16 @@ bool FileManager::moveFolder(const QString &from, const QString &to, const QStri
} }
void FileManager::clear(const QString& targetDir, bool force) { void FileManager::clear(const QString& targetDir, bool force) {
qInfo() << "clear start!"; QuasarAppUtils::Params::log( "clear start!",
QuasarAppUtils::Info);
if (force) { if (force) {
qInfo() << "clear force! " << targetDir; QuasarAppUtils::Params::log("clear force! " + targetDir,
QuasarAppUtils::Info);
if (QDir(targetDir).removeRecursively()) { if (QDir(targetDir).removeRecursively()) {
return; return;
} }
QuasarAppUtils::Params::verboseLog("Remove target Dir fail, try remove old deployemend files", QuasarAppUtils::Params::log("Remove target Dir fail, try remove old deployemend files",
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
} }
@ -383,14 +386,16 @@ void FileManager::clear(const QString& targetDir, bool force) {
if (index.value().isFile()) { if (index.value().isFile()) {
if (removeFile(index.value())) { if (removeFile(index.value())) {
qInfo() << "Remove " << index.value().absoluteFilePath() << " because it is deployed file"; QuasarAppUtils::Params::log("Remove " + index.value().absoluteFilePath() + " because it is deployed file",
QuasarAppUtils::Info);
} }
} else { } else {
QDir qdir(index.value().absoluteFilePath()); QDir qdir(index.value().absoluteFilePath());
if (!qdir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries).count()) { if (!qdir.entryList(QDir::NoDotAndDotDot | QDir::AllEntries).count()) {
qdir.removeRecursively(); qdir.removeRecursively();
qInfo() << "Remove " << index.value().absoluteFilePath() << " because it is empty"; QuasarAppUtils::Params::log("Remove " + index.value().absoluteFilePath() + " because it is empty",
QuasarAppUtils::Info);
} }
} }
} }
@ -407,11 +412,11 @@ bool FileManager::copyFile(const QString &file, const QString &target,
bool FileManager::removeFile(const QFileInfo &file) { bool FileManager::removeFile(const QFileInfo &file) {
if (!QFile::remove(file.absoluteFilePath())) { if (!QFile::remove(file.absoluteFilePath())) {
QuasarAppUtils::Params::verboseLog("Qt Operation fail (remove file) " + file.absoluteFilePath(), QuasarAppUtils::Params::log("Qt Operation fail (remove file) " + file.absoluteFilePath(),
QuasarAppUtils::Warning); QuasarAppUtils::Warning);
if (remove(file.absoluteFilePath().toLatin1())) { if (remove(file.absoluteFilePath().toLatin1())) {
QuasarAppUtils::Params::verboseLog("std Operation fail file not removed." + file.absoluteFilePath(), QuasarAppUtils::Params::log("std Operation fail file not removed." + file.absoluteFilePath(),
QuasarAppUtils::Error); QuasarAppUtils::Error);
return false; return false;
} }

View File

@ -28,7 +28,7 @@ void IgnoreRule::addRule(const IgnoreData &rule) {
bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const { bool IgnoreRule::check(const LibInfo &info, const QString& ignoreLabel) const {
if (info.fullPath().contains(ignoreLabel, Qt::CaseInsensitive)) { if (info.fullPath().contains(ignoreLabel, Qt::CaseInsensitive)) {
QuasarAppUtils::Params::verboseLog(info.fullPath() + " ignored by filter" + ignoreLabel); QuasarAppUtils::Params::log(info.fullPath() + " ignored by filter" + ignoreLabel);
return true; return true;
} }

View File

@ -210,11 +210,12 @@ void MetaFileManager::createRunMetaFiles() {
for (auto i = DeployCore::_config->targets().cbegin(); i != DeployCore::_config->targets().cend(); ++i) { for (auto i = DeployCore::_config->targets().cbegin(); i != DeployCore::_config->targets().cend(); ++i) {
if (!createRunScript(i.key())) { if (!createRunScript(i.key())) {
qCritical() << "run script not created!"; QuasarAppUtils::Params::log("run script not created!",
QuasarAppUtils::Error);
} }
if (!createQConf(i.key())) { if (!createQConf(i.key())) {
QuasarAppUtils::Params::verboseLog("create qt.conf failr", QuasarAppUtils::Warning); QuasarAppUtils::Params::log("create qt.conf failr", QuasarAppUtils::Warning);
} }
} }
} }

View File

@ -58,7 +58,7 @@ bool Packing::create() {
QString erroutLog = _proc->readAllStandardError(); QString erroutLog = _proc->readAllStandardError();
auto message = QString("message = %0").arg(stdoutLog + " " + erroutLog); auto message = QString("message = %0").arg(stdoutLog + " " + erroutLog);
QuasarAppUtils::Params::verboseLog(message, QuasarAppUtils::Params::log(message,
QuasarAppUtils::Info); QuasarAppUtils::Info);
_pakage->removeTemplate(); _pakage->removeTemplate();
@ -72,10 +72,12 @@ void Packing::handleOutputUpdate() {
QByteArray erroutLog = _proc->readAllStandardError(); QByteArray erroutLog = _proc->readAllStandardError();
if (stdoutLog.size()) if (stdoutLog.size())
qInfo() << stdoutLog; QuasarAppUtils::Params::log(stdoutLog,
QuasarAppUtils::Info);
if (erroutLog.size()) if (erroutLog.size())
qInfo() << erroutLog; QuasarAppUtils::Params::log(erroutLog,
QuasarAppUtils::Info);
} }

View File

@ -72,13 +72,13 @@ bool PluginsParser::scan(const QString& pluginPath,
auto plugins = QDir(pluginPath).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot); auto plugins = QDir(pluginPath).entryInfoList(QDir::Dirs | QDir::NoDotAndDotDot);
QuasarAppUtils::Params::verboseLog("Modules Number :" + QString::number(qtModules), QuasarAppUtils::Info); QuasarAppUtils::Params::log("Modules Number :" + QString::number(qtModules), QuasarAppUtils::Info);
for (const auto &plugin: plugins) { for (const auto &plugin: plugins) {
auto module = qtModuleForPlugin(plugin.fileName()); auto module = qtModuleForPlugin(plugin.fileName());
if (qtModules & module) { if (qtModules & module) {
QuasarAppUtils::Params::verboseLog("deploye plugin : " + plugin.absoluteFilePath(), QuasarAppUtils::Info); QuasarAppUtils::Params::log("deploye plugin : " + plugin.absoluteFilePath(), QuasarAppUtils::Info);
resDependencies.append(plugin.absoluteFilePath()); resDependencies.append(plugin.absoluteFilePath());
} }

View File

@ -111,7 +111,7 @@ bool QML::deployPath(const QString &path, QStringList &res) {
for (auto info : infoList) { for (auto info : infoList) {
if (info.fileName().contains(".so.debug") || if (info.fileName().contains(".so.debug") ||
info.fileName().contains("d.dll")) { info.fileName().contains("d.dll")) {
QuasarAppUtils::Params::verboseLog("sciped debug lib " + QuasarAppUtils::Params::log("sciped debug lib " +
info.absoluteFilePath()); info.absoluteFilePath());
continue; continue;
} }

@ -1 +1 @@
Subproject commit 0dda7b918953579ab4009af8021f3de651e48531 Subproject commit 48cde491390ad8a2d75ef2dd138e8ecafb881ef7

View File

@ -47,7 +47,7 @@ private:
QSet<QString> getFilesTree(const QStringList& keys = {}); QSet<QString> getFilesTree(const QStringList& keys = {});
void runTestParams(const QStringList &list, void runTestParams(QStringList list,
QSet<QString> *tree = nullptr, QSet<QString> *tree = nullptr,
const QStringList &checkableKeys = {}, const QStringList &checkableKeys = {},
bool noWarnings = false, bool noWarnings = false,
@ -932,12 +932,12 @@ void deploytest::testSetTargetDir() {
} }
void deploytest::runTestParams(const QStringList &list, void deploytest::runTestParams(QStringList list,
QSet<QString>* tree, QSet<QString>* tree,
const QStringList &checkableKeys, const QStringList &checkableKeys,
bool noWarnings, bool onlySize) { bool noWarnings, bool onlySize) {
QuasarAppUtils::Params::parseParams(list); QuasarAppUtils::Params::parseParams(list << "-verbose" << "3");
Deploy deploy; Deploy deploy;
if (deploy.run() != Good) if (deploy.run() != Good)

View File

@ -15,7 +15,7 @@ deployTest.commands = $$DEPLOYER -bin $$exec clear -qmake $$QMAKE_BIN -targetDir
!android:test.depends = deployTest !android:test.depends = deployTest
unix:!android:test.commands = $$PWD/deployTests/UnitTests.sh -maxwarnings 100000 unix:!android:test.commands = $$PWD/deployTests/UnitTests.sh -maxwarnings 100000
win32:test.commands = $$PWD/deployTests/UnitTests.exe -maxwarnings 100000 -o $$PWD/buildLog.log win32:test.commands = $$PWD/deployTests/UnitTests.exe -maxwarnings 100000
contains(QMAKE_HOST.os, Linux):{ contains(QMAKE_HOST.os, Linux):{
win32:test.commands = win32:test.commands =