4
1
mirror of https://github.com/QuasarApp/CQtDeployer.git synced 2025-05-09 16:09:37 +00:00

added sopport the allowEmptyPackages option

This commit is contained in:
Andrei Yankovich 2020-12-07 18:30:02 +03:00
parent 9ab75e9133
commit 44939cca71
4 changed files with 60 additions and 41 deletions

@ -50,11 +50,15 @@ bool parsePackagesPrivate(Container& mainContainer,
(valueLink(mainContainer, defaultPackage, DistroModule{defaultPackage}).*adder)(first);
else {
bool skipError = QuasarAppUtils::Params::isEndable("allowEmptyPackages");
first = PathUtils::fullStripPath(first);
if (!mainContainer.contains(first)) {
if (!skipError && !mainContainer.contains(first)) {
return false;
}
for (int i = 1; i < paramsList.size(); ++i) {
(valueLink(mainContainer, first, DistroModule{first}).*adder)(paramsList[i]);
}
@ -373,90 +377,85 @@ bool ConfigParser::initDistroStruct() {
auto extraData = QuasarAppUtils::Params::getStrArg("extraData").
split(DeployCore::getSeparator(0), splitbehavior);
auto erroLog = [](const QString &flag){
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),
QuasarAppUtils::Error);
};
// init distro stucts for all targets
if (binOut.size() && !parsePackagesPrivate(mainDistro, binOut, &DistroModule::setBinOutDir)) {
erroLog("binOut");
packagesErrorLog("binOut");
return false;
}
if (libOut.size() && !parsePackagesPrivate(mainDistro, libOut, &DistroModule::setLibOutDir)) {
erroLog("libOut");
packagesErrorLog("libOut");
return false;
}
if (qmlOut.size() && !parsePackagesPrivate(mainDistro, qmlOut, &DistroModule::setQmlOutDir)) {
erroLog("qmlOut");
packagesErrorLog("qmlOut");
return false;
}
if (trOut.size() && !parsePackagesPrivate(mainDistro, trOut, &DistroModule::setTrOutDir)) {
erroLog("trOut");
packagesErrorLog("trOut");
return false;
}
if (pluginOut.size() && !parsePackagesPrivate(mainDistro, pluginOut, &DistroModule::setPluginsOutDir)) {
erroLog("pluginOut");
packagesErrorLog("pluginOut");
return false;
}
if (recOut.size() && !parsePackagesPrivate(mainDistro, recOut, &DistroModule::setResOutDir)) {
erroLog("recOut");
packagesErrorLog("recOut");
return false;
}
if (extraDataOut.size() && !parsePackagesPrivate(mainDistro, extraDataOut, &DistroModule::setExtraDataOutDir)) {
erroLog("extraDataOut");
packagesErrorLog("extraDataOut");
return false;
}
if (name.size() && !parsePackagesPrivate(mainDistro, name, &DistroModule::setName)) {
erroLog("name");
packagesErrorLog("name");
return false;
}
if (description.size() && !parsePackagesPrivate(mainDistro, description, &DistroModule::setDescription)) {
erroLog("description");
packagesErrorLog("description");
return false;
}
if (deployVersion.size() && !parsePackagesPrivate(mainDistro, deployVersion, &DistroModule::setVersion)) {
erroLog("deployVersion");
packagesErrorLog("deployVersion");
return false;
}
if (releaseDate.size() && !parsePackagesPrivate(mainDistro, releaseDate, &DistroModule::setReleaseData)) {
erroLog("releaseDate");
packagesErrorLog("releaseDate");
return false;
}
if (icon.size() && !parsePackagesPrivate(mainDistro, icon, &DistroModule::setIcon)) {
erroLog("icon");
packagesErrorLog("icon");
return false;
}
if (publisher.size() && !parsePackagesPrivate(mainDistro, publisher, &DistroModule::setPublisher)) {
erroLog("Publisher");
packagesErrorLog("Publisher");
return false;
}
if (homepage.size() && !parsePackagesPrivate(mainDistro, homepage, &DistroModule::setHomePage)) {
erroLog("homePage");
packagesErrorLog("homePage");
return false;
}
if (prefix.size() && !parsePackagesPrivate(mainDistro, prefix, &DistroModule::setPrefix)) {
erroLog("prefix");
packagesErrorLog("prefix");
return false;
}
if (extraData.size() && !parsePackagesPrivate(mainDistro, extraData, &DistroModule::addExtraData)) {
erroLog("extraData");
packagesErrorLog("extraData");
return false;
}
@ -530,23 +529,25 @@ bool ConfigParser::initQmlInput() {
auto qmlDir = QuasarAppUtils::Params::getStrArg("qmlDir").
split(DeployCore::getSeparator(0), splitbehavior);
auto erroLog = [](const QString &flag){
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),
QuasarAppUtils::Error);
};
// init distro stucts for all targets
_config.deployQml = qmlDir.size();
if (qmlDir.size() && !parsePackagesPrivate(_config.packagesEdit(), qmlDir, &DistroModule::addQmlInput)) {
erroLog("qmlDir");
packagesErrorLog("qmlDir");
return false;
}
return true;
}
void ConfigParser::packagesErrorLog(const QString &flag) {
QuasarAppUtils::Params::log(QString("Set %0 fail, because you try set %0 for not inited package."
" Use 'targetPackage' flag for init the packages. "
"Or if you want to configure emty package use the allowEmptyPackages option for disable this error message.").arg(flag),
QuasarAppUtils::Error);
}
bool ConfigParser::parseDeployMode() {
if (QuasarAppUtils::Params::isEndable("deploySystem-with-libc")) {
@ -1243,31 +1244,25 @@ bool ConfigParser::initPlugins() {
auto listDisablePlugins = QuasarAppUtils::Params::getStrArg("disablePlugins").
split(DeployCore::getSeparator(0), splitbehavior);
auto erroLog = [](const QString &flag){
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),
QuasarAppUtils::Error);
};
if (listExtraPlugin.size() && !parsePackagesPrivate(_config.packagesEdit(),
listExtraPlugin,
&DistroModule::addExtraPlugins)) {
erroLog("extra plugins");
packagesErrorLog("extra plugins");
return false;
}
if (listEnablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(),
listEnablePlugins,
&DistroModule::addEnabledPlugins)) {
erroLog("enable plugins");
packagesErrorLog("enable plugins");
return false;
}
if (listDisablePlugins.size() && !parsePackagesPrivate(_config.packagesEdit(),
listDisablePlugins,
&DistroModule::addDisabledPlugins)) {
erroLog("disable plugins");
packagesErrorLog("disable plugins");
return false;
}

@ -72,6 +72,8 @@ private:
bool initQmake();
bool initQmlInput();
void packagesErrorLog(const QString &flag);
bool setQmake(const QString &value);
bool setQtDir(const QString &value);

@ -210,6 +210,7 @@ void DeployCore::help() {
" For gui application sue the deploySystem option "
"(on snap version you need to turn on permission)"},
{"noQt", "Ignore the error of initialize of a qmake. Use only if your application does not use the qt framework."},
{"allowEmptyPackages", "Allow configure the empty packages."},
}
},
@ -237,7 +238,8 @@ void DeployCore::help() {
},
{
"Part 3 Controll of packages options", {
{"-targetPackage [package;tar1,package;tar2]", "Creates a new package and adds 'tar1 and tar2' to it"},
{"-targetPackage [package;tar1,package;tar2]", "Creates a new package and adds 'tar1 and tar2' to it."
"If you want configure the package that do not have any targets use the allowEmptyPackages option."},
{"-qmlOut [package;path,path]", "Sets path to qml out directory"},
{"-libOut [package;path,path]", "Sets path to libraries out directory"},
{"-trOut [package;path,path]", "Sets path to translations out directory"},

@ -54,7 +54,8 @@ private:
QSet<QString> *tree = nullptr,
const QStringList &checkableKeys = {},
bool noWarnings = false,
bool onlySize = false);
bool onlySize = false,
exitCodes exitCode = exitCodes::Good);
void checkResults(const QSet<QString> &tree,
const QStringList &checkagbleKeys,
@ -164,6 +165,7 @@ private slots:
void testQmlScaner();
void testPrefix();
void testallowEmptyPackages();
void customTest();
};
@ -1021,6 +1023,23 @@ void deploytest::testPrefix() {
"-prefix", "package;prefix"}, &comapareTree);
}
void deploytest::testallowEmptyPackages() {
TestUtils utils;
#ifdef Q_OS_UNIX
QString bin = TestBinDir + "TestOnlyC";
#else
QString bin = TestBinDir + "TestOnlyC.exe";
#endif
runTestParams({"-bin", bin, "force-clear",
"-prefix", "package;prefix"}, nullptr, {}, false, false,
exitCodes::PrepareError);
runTestParams({"-bin", bin, "force-clear",
"-prefix", "package;prefix",
"allowEmptyPackages"});
}
void deploytest::customTest() {
runTestParams({"-confFile", "path",
"qifFromSystem"});
@ -1278,12 +1297,13 @@ void deploytest::testZip() {
void deploytest::runTestParams(QStringList list,
QSet<QString>* tree,
const QStringList &checkableKeys,
bool noWarnings, bool onlySize) {
bool noWarnings, bool onlySize,
exitCodes exitCode) {
QuasarAppUtils::Params::parseParams(list);
Deploy deploy;
if (deploy.run() != Good)
if (deploy.run() != exitCode)
QVERIFY(false);
if (tree) {