added implementation

This commit is contained in:
Andrei Yankovich 2023-06-16 23:17:41 +02:00
parent 433ca6024a
commit 6939c3c255
14 changed files with 141 additions and 70 deletions

View File

@ -125,8 +125,7 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| -prefix [package;val,val] | Sets the prefix for the package relatively a target directory | | -prefix [package;val,val] | Sets the prefix for the package relatively a target directory |
| -extraData [package;val,val]| Adds the extra files or directories like a target. The selected directory will be copy to the extraDataOut location with save own structure.| | -extraData [package;val,val]| Adds the extra files or directories like a target. The selected directory will be copy to the extraDataOut location with save own structure.|
| -tr [package;val,val] | Adds qm files into the translations folder. | | -tr [package;val,val] | Adds qm files into the translations folder. |
| -extraDepends [package;val,val] | Adds extra dependencies for package, if package is skiped then for default package. Example -extraDepends libssl.so or -targetPackage packageName;myExecutable -extraDepends packageName;libssl.so |
| | Example: "-extraLib mySql" - forces to copy all libraries whose names contain mySql to the project folder. This option is case-insensitive on Windows and case-sensitive on other platforms. This option will only search libraries in system environments similar to **deploySystem**.|
### Controll of targets options ### Controll of targets options
| Option | Descriptiion | | Option | Descriptiion |
@ -135,9 +134,10 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| -disableRunScript [target,target2,target3] | Disables the generation of run script for selected targets| | -disableRunScript [target,target2,target3] | Disables the generation of run script for selected targets|
| -disableShortCut [target,target2,target3] | Disables the generation of shortcut for selected targets | | -disableShortCut [target,target2,target3] | Disables the generation of shortcut for selected targets |
| -runScript [target;val,val] | forces cqtdeployer swap default run script to new from the arguments of option. This option copy all content from input file and insert all code into runScript.sh or .bat. Example of use: cqtdeployer -runScript "myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh" For get more information about customScript see the documentation [page](CustomScripts.md)| | -runScript [target;val,val] | forces cqtdeployer swap default run script to new from the arguments of option. This option copy all content from input file and insert all code into runScript.sh or .bat. Example of use: cqtdeployer -runScript "myTargetMame;path/to/my/myCustomLaunchScript.sh,myTargetSecondMame;path/to/my/mySecondCustomLaunchScript.sh" For get more information about customScript see the documentation [page](CustomScripts.md)|
| -extraDepends [target;val,val] | Adds extra dependencies for target, if package is skiped then for all targets. Example -extraDepends libssl.so or -targetPackage packageName;myExecutable -extraDepends packageName;libssl.so |
### Plugins Controll Options ### Plugins Controll Options
| Option | Descriptiion | | Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------| |-----------------------------|-----------------------------------------------------------|
| -extraPlugin [package;val1;val2,SingeleVal]| Sets an additional path to third-party application plug-in | | -extraPlugin [package;val1;val2,SingeleVal]| Sets an additional path to third-party application plug-in |

View File

@ -461,9 +461,6 @@ bool ConfigParser::initDistroStruct() {
auto trData = QuasarAppUtils::Params::getArg("tr"). auto trData = QuasarAppUtils::Params::getArg("tr").
split(DeployCore::getSeparator(0), splitbehavior); split(DeployCore::getSeparator(0), splitbehavior);
auto extraDependsData = QuasarAppUtils::Params::getArg("extraDepends").
split(DeployCore::getSeparator(0), splitbehavior);
auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb"). auto installDirDeb = QuasarAppUtils::Params::getArg("installDirDeb").
split(DeployCore::getSeparator(0), splitbehavior); split(DeployCore::getSeparator(0), splitbehavior);
@ -554,11 +551,6 @@ bool ConfigParser::initDistroStruct() {
return false; return false;
} }
if (extraDependsData.size() && !parsePackagesPrivate(mainDistro, extraDependsData, &DistroModule::addExtraDepends)) {
packagesErrorLog("extraDepends");
return false;
}
if (installDirDeb.size() && !parsePackagesPrivate(mainDistro, installDirDeb, &DistroModule::setInstallDirDEB)) { if (installDirDeb.size() && !parsePackagesPrivate(mainDistro, installDirDeb, &DistroModule::setInstallDirDEB)) {
packagesErrorLog("installDirDeb"); packagesErrorLog("installDirDeb");
return false; return false;
@ -824,6 +816,8 @@ bool ConfigParser::configureTargets() {
const auto disableShortcuts = QuasarAppUtils::Params::getArg("disableShortCut"). const auto disableShortcuts = QuasarAppUtils::Params::getArg("disableShortCut").
split(DeployCore::getSeparator(0), splitbehavior); split(DeployCore::getSeparator(0), splitbehavior);
const auto extraDepends = QuasarAppUtils::Params::getArg("extraDepends").
split(DeployCore::getSeparator(0), splitbehavior);
if (icons.size()) { if (icons.size()) {
parseTargetPrivate(_config, icons, &TargetInfo::setIcon); parseTargetPrivate(_config, icons, &TargetInfo::setIcon);
@ -843,6 +837,10 @@ bool ConfigParser::configureTargets() {
return false; return false;
} }
if (extraDepends.size()) {
parseTargetPrivate(_config, extraDepends, &TargetInfo::addExtraDepends);
}
return true; return true;
} }
@ -1450,27 +1448,27 @@ bool ConfigParser::initExtraPath() {
return true; return true;
} }
void ConfigParser::initExtraNames() { void ConfigParser::addExtraNamesMasks(const QStringList& listNamesMasks) {
for (const auto &i : listNamesMasks) {
if (i.size() > 1) {
_config.allowedPaths.addtExtraNamesMasks({i});
const auto deployExtraNames = [this](const QStringList& listNamesMasks){ QuasarAppUtils::Params::log(i + " is added as a filename mask",
for (const auto &i : listNamesMasks) { QuasarAppUtils::Debug);
if (i.size() > 1) { } else {
_config.allowedPaths.addtExtraNamesMasks({i}); QuasarAppUtils::Params::log(i + " not added in file mask because"
" the file mask must be large 2 characters",
QuasarAppUtils::Params::log(i + " is added as a filename mask", QuasarAppUtils::Debug);
QuasarAppUtils::Debug);
} else {
QuasarAppUtils::Params::log(i + " not added in file mask because"
" the file mask must be large 2 characters",
QuasarAppUtils::Debug);
}
} }
}; }
}
void ConfigParser::initExtraNames() {
auto listNamesMasks = QuasarAppUtils::Params::getArg("extraLibs"). auto listNamesMasks = QuasarAppUtils::Params::getArg("extraLibs").
split(DeployCore::getSeparator(0)); split(DeployCore::getSeparator(0));
deployExtraNames(listNamesMasks); addExtraNamesMasks(listNamesMasks);
/* /*
* Task https://github.com/QuasarApp/CQtDeployer/issues/422 * Task https://github.com/QuasarApp/CQtDeployer/issues/422
@ -1479,7 +1477,7 @@ void ConfigParser::initExtraNames() {
*/ */
if (_config.isNeededQt()) { if (_config.isNeededQt()) {
auto libs = DeployCore::Qt3rdpartyLibs( _config.getPlatformOfAll()); auto libs = DeployCore::Qt3rdpartyLibs( _config.getPlatformOfAll());
deployExtraNames(libs); addExtraNamesMasks(libs);
} }
} }

View File

@ -68,7 +68,6 @@ private:
bool setTargets(const QStringList &value); bool setTargets(const QStringList &value);
bool setTargetsRecursive(const QString &dir); bool setTargetsRecursive(const QString &dir);
bool setTargetsInDir(const QString &dir, bool recursive = false); bool setTargetsInDir(const QString &dir, bool recursive = false);
void initIgnoreList(); void initIgnoreList();
void initIgnoreEnvList(); void initIgnoreEnvList();
@ -120,6 +119,7 @@ private:
*/ */
bool addTarget(const TargetData &target); bool addTarget(const TargetData &target);
void initCustomPlatform(); void initCustomPlatform();
void addExtraNamesMasks(const QStringList &listNamesMasks);
}; };
#endif // CQT_H #endif // CQT_H

View File

@ -445,12 +445,6 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
"Adds qm files into the translations folder." "Adds qm files into the translations folder."
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{
{"-extraDepends"}, "{package;val,val}",
"Adds extra dependencies for package, if package is skiped then for default package.",
"Example -extraDepends libssl.so or -targetPackage packageName;myExecutable -extraDepends packageName;libssl.so"
}});
group = "Part 4 Control of target options"; group = "Part 4 Control of target options";
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
@ -458,14 +452,20 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() {
"Sets path to icon for a targets" "Sets path to icon for a targets"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-disableRunScript"}, "{package;val,val}", {"-disableRunScript"}, "{target;val,val}",
"Disables a generation of run script for selected targets" "Disables a generation of run script for selected targets"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{
{"-disableShortCut"}, "{package;val,val}", {"-disableShortCut"}, "{target;val,val}",
"Disables a generation of shortcut for selected targets" "Disables a generation of shortcut for selected targets"
}}); }});
help.insert(group, {QuasarAppUtils::OptionData{
{"-extraDepends"}, "{target;val,val}",
"Adds extra dependencies for target, if package is skiped then for rest of all targets.",
"Example -extraDepends libssl.so or -targetPackage packageName;myExecutable -extraDepends packageName;libssl.so"
}});
group = "Part 5 Plugins Control Options"; group = "Part 5 Plugins Control Options";
help.insert(group, {QuasarAppUtils::OptionData{ help.insert(group, {QuasarAppUtils::OptionData{

View File

@ -148,18 +148,6 @@ void DistroModule::setKey(const QString &key) {
_key = key; _key = key;
} }
QSet<QString> DistroModule::extraDepends() const {
return _extraDepends;
}
void DistroModule::setExtraDepends(const QSet<QString> &newExtraDepends) {
_extraDepends = newExtraDepends;
}
void DistroModule::addExtraDepends(const QString &newExtraDepends) {
_extraDepends += newExtraDepends;
}
const QString &DistroModule::zipOut() const { const QString &DistroModule::zipOut() const {
return _zipOut; return _zipOut;
} }

View File

@ -101,23 +101,6 @@ public:
*/ */
void setZipOut(const QString &newZipOut); void setZipOut(const QString &newZipOut);
/**
* @brief extraDepends This method return list of the extra depends of this package.
* @return list of the extra depends of this package.
*/
QSet<QString> extraDepends() const;
/**
* @brief setExtraDepends This method sets new list of the extra depends
* @param newExtraDepends This is new list of extra depends.
*/
void setExtraDepends(const QSet<QString> &newExtraDepends);
/**
* @brief addExtraDepends this method adds new extra depends value into list of extra depends.
* @param newExtraDepends This is new value of extra depends of this package.
*/
void addExtraDepends(const QString &newExtraDepends);
protected: protected:
void setKey(const QString &key); void setKey(const QString &key);
@ -145,9 +128,6 @@ private:
// extra translations // extra translations
QSet<QString> _tr; QSet<QString> _tr;
// extra translations
QSet<QString> _extraDepends;
QString _installDirDEB; QString _installDirDEB;
QString _debOut; QString _debOut;
QString _zipOut; QString _zipOut;

View File

@ -100,8 +100,17 @@ void Extracter::extractAllTargets() {
for (auto i = cfg->packages().cbegin(); i != cfg->packages().cend(); ++i) { for (auto i = cfg->packages().cbegin(); i != cfg->packages().cend(); ++i) {
auto &dep = _packageDependencyes[i.key()]; auto &dep = _packageDependencyes[i.key()];
for (const auto &target : i.value().targets()) { for (const auto &targetId : i.value().targets()) {
extract(target, &dep); auto target = cfg->targets().value(targetId);
const auto depends = target.extraDepends();
for (const auto &extraDepends: depends) {
dep.addNeadedLib(extraDepends);
extract(extraDepends, &dep);
}
extract(targetId, &dep);
} }
} }
} }

View File

@ -60,6 +60,10 @@ void LibInfo::addDependncies(const QString &value) {
_dependncies.insert(value); _dependncies.insert(value);
} }
void LibInfo::addDepends(const QString &value) {
addDependncies(value);
}
void LibInfo::addDependncies(const QSet<QString> &value) { void LibInfo::addDependncies(const QSet<QString> &value) {
_dependncies += value; _dependncies += value;
} }

View File

@ -37,6 +37,7 @@ public:
QSet<QString> getDependncies() const; QSet<QString> getDependncies() const;
void setDependncies(const QSet<QString> &value); void setDependncies(const QSet<QString> &value);
void addDependncies(const QString &value); void addDependncies(const QString &value);
void addDepends(const QString &value);
void addDependncies(const QSet<QString> &value); void addDependncies(const QSet<QString> &value);
void removeDependncies(const QString &value); void removeDependncies(const QString &value);

View File

@ -102,4 +102,16 @@ void TargetInfo::disableRunScript() {
setFEnableRunScript(false); setFEnableRunScript(false);
} }
const QStringList& TargetInfo::extraDepends() const {
return _extraDepends;
}
void TargetInfo::setExtraDepends(const QStringList &newExtraDepends) {
_extraDepends = newExtraDepends;
}
void TargetInfo::addExtraDepends(const QString &newExtraDepends) {
_extraDepends += newExtraDepends;
}

View File

@ -98,6 +98,24 @@ public:
*/ */
void disableRunScript(); void disableRunScript();
/**
* @brief extraDepends This method contais list of all extra depends of this target object.
* @return list of extra depends.
*/
const QStringList &extraDepends() const;
/**
* @brief setExtraDepends This method sets new list of extra depends
* @param newExtraDepends This is new value.
*/
void setExtraDepends(const QStringList &newExtraDepends);
/**
* @brief addExtraDepends This method add new value to the depends list.
* @param newExtraDepends new value of depends.
*/
void addExtraDepends(const QString& newExtraDepends);
private: private:
QString _package = ""; QString _package = "";
QString _icon = ""; QString _icon = "";
@ -105,6 +123,7 @@ private:
bool _fEnableRunScript = true; bool _fEnableRunScript = true;
QString _runScript = ""; QString _runScript = "";
QStringList _extraDepends;
}; };

View File

@ -9,6 +9,8 @@
#include "qttest.h" #include "qttest.h"
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
#include "extradependstest.h"
#include "allowemptypackagestest.h" #include "allowemptypackagestest.h"
#include "binprefixtest.h" #include "binprefixtest.h"
#include "checkqttest.h" #include "checkqttest.h"
@ -100,6 +102,7 @@ private slots:
// main tests works on linux only // main tests works on linux only
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
TestCase(extraDependsTest, ExtraDependsTest)
TestCase(allowemptypackagestest, AllowEmptyPackagesTest ) TestCase(allowemptypackagestest, AllowEmptyPackagesTest )
TestCase(binprefixtest, BinPrefixTest) TestCase(binprefixtest, BinPrefixTest)
TestCase(checkqttest, CheckQtTest) TestCase(checkqttest, CheckQtTest)

View File

@ -0,0 +1,33 @@
//#
//# Copyright (C) 2020-2023 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#include "extradependstest.h"
#include "modules.h"
ExtraDependsTest::ExtraDependsTest() {
}
void ExtraDependsTest::test() {
TestUtils utils;
QString bin = TestBinDir + "TestOnlyC";
auto comapareTree = TestModule.onlyC();
comapareTree = utils.createTree(
{
"./" + DISTRO_DIR + "/lib/libicutu.so.56.1",
});
runTestParams({"-bin", bin, "clear" ,
"-extraDepends", "libicutu.so.56.1"}, &comapareTree);
runTestParams({"-bin", bin, "clear" ,
"-extraDepends", "TestOnlyC;libicutu.so.56.1"}, &comapareTree);
}

View File

@ -0,0 +1,24 @@
//#
//# Copyright (C) 2023-2023 QuasarApp.
//# Distributed under the GPLv3 software license, see the accompanying
//# Everyone is permitted to copy and distribute verbatim copies
//# of this license document, but changing it is not allowed.
//#
#ifndef EXTRADEPENDSTEST_H
#define EXTRADEPENDSTEST_H
#include "testbase.h"
#include "testutils.h"
#include <QtTest>
class ExtraDependsTest: public TestBase, protected TestUtils
{
public:
ExtraDependsTest();
void test() override;
};
#endif // EXTRADEPENDSTEST_H