From a3223008f3299eeb256f0cdb682df7b1fd28adae Mon Sep 17 00:00:00 2001 From: EndrII Date: Thu, 9 Jun 2022 19:33:31 +0300 Subject: [PATCH] fix #699 added support of the binarycreator option --- Deploy/Distributions/qif.cpp | 8 ++++++-- Deploy/Distributions/qif.h | 1 - Deploy/deploycore.cpp | 6 ++++++ UnitTests/tst_deploytest.cpp | 32 ++++++++++++++++++++++++++++++++ md/en/Options.md | 1 + md/ru/Options.md | 1 + 6 files changed, 46 insertions(+), 3 deletions(-) diff --git a/Deploy/Distributions/qif.cpp b/Deploy/Distributions/qif.cpp index 3ab5945..32b6c6b 100644 --- a/Deploy/Distributions/qif.cpp +++ b/Deploy/Distributions/qif.cpp @@ -59,18 +59,22 @@ QList QIF::runCmd() { SystemCommandData cmd; + QString binarycreator = QuasarAppUtils::Params::getArg("binarycreator"); + if (binarycreator.isEmpty()) binarycreator = DeployCore::findProcess(toolKitEnv().concatEnv(), base); if (binarycreator.isEmpty()) { cmd.command = base; } else { - cmd.command = binarycreator; + auto commandsList = binarycreator.split(' '); + cmd.command = commandsList.first(); + cmd.arguments = QStringList{commandsList.begin() + 1, commandsList.end()}; } auto location = DeployCore::_config->getTargetDir() + "/" + getLocation(); - cmd.arguments = QStringList{ + cmd.arguments += QStringList{ "-c", QuasarAppUtils::Params::getArg("qifConfig", location + "/config/config.xml"), "-p", diff --git a/Deploy/Distributions/qif.h b/Deploy/Distributions/qif.h index 198b88b..88908fe 100644 --- a/Deploy/Distributions/qif.h +++ b/Deploy/Distributions/qif.h @@ -51,7 +51,6 @@ private: */ bool initDefaultConfiguratuin(); - QString binarycreator; TemplateInfo generalInfo; }; diff --git a/Deploy/deploycore.cpp b/Deploy/deploycore.cpp index 0d11ddd..b13c063 100644 --- a/Deploy/deploycore.cpp +++ b/Deploy/deploycore.cpp @@ -524,6 +524,12 @@ QuasarAppUtils::OptionsDataList DeployCore::avilableOptions() { " If you omit this option, the 7z format will be used as a default. " }}); + help.insert(group, {QuasarAppUtils::OptionData{ + {"-binarycreator"}, "{binarycreator command}", + "Sets new binarycreator command.", + "cqtdeployer -bin my.exe qifw -binarycreator 'wine path/to/binarycreator.exe'" + }}); + group = "Part 7 Deb package options"; help.insert(group, {QuasarAppUtils::OptionData{ diff --git a/UnitTests/tst_deploytest.cpp b/UnitTests/tst_deploytest.cpp index ff069cf..5196c9d 100644 --- a/UnitTests/tst_deploytest.cpp +++ b/UnitTests/tst_deploytest.cpp @@ -22,6 +22,8 @@ #include #include +#include + #include #include #include @@ -194,6 +196,7 @@ private slots: void testCustomPlatform(); void testQifArchiveFormat(); + void testQifBinaryCreator(); void customTest(); }; @@ -1718,6 +1721,35 @@ void deploytest::testQifArchiveFormat() { ); } +void deploytest::testQifBinaryCreator() { + TestUtils utils; + +#ifdef Q_OS_UNIX + QString bin = {TestBinDir + "TestOnlyC"}; +#else + QString bin = {TestBinDir + "TestOnlyC.exe"}; +#endif + + QuasarAppUtils::Params::parseParams({ + "-bin", bin, + "qifFromSystem", + "clear", + "qif", + "-binarycreator", "test testValue" + }); + Deploy deploy; + QVERIFY(deploy.prepare()); + FileManager fm; + QIF qif(&fm); + + auto command = qif.runCmd(); + QVERIFY(command.size() == 1); + QVERIFY(command.first().command == "test"); + QVERIFY(command.first().arguments.contains("testValue")); + + +} + void deploytest::customTest() { //runTestParams({"-confFile", "", // "qifFromSystem"}); diff --git a/md/en/Options.md b/md/en/Options.md index f6c2faa..6407e14 100644 --- a/md/en/Options.md +++ b/md/en/Options.md @@ -157,6 +157,7 @@ cqtdeployer -option1 value1 -option2 list, of, values ​​flag1 flag2 flag3 | -qifPackages [path/to/packagesFodoler] | Sets a custom path to the packages directories. By default it is qif/packages. Note This path sets releative target folder (sets by TargetDir option). | | -qifResources [path/to/resources1.qrc,path/to/resources2.qrc] | Sets a custom path to the resources files. By default this option is skipped. Note This path sets releative target folder (sets by TargetDir option). | | -qifArchiveFormat [7z,zip,tar,tar.gz,tar.bz2,tar.xz] | Sets the format used when packaging new component data archives. If you omit this option, the 7z format will be used as a default. | +| -binarycreator [binarycreator command] | Sets new binarycreator command. Example : cqtdeployer -bin my.exe qifw -binarycreator 'wine path/to/binarycreator.exe'| ### Deb package options diff --git a/md/ru/Options.md b/md/ru/Options.md index 095fd29..715c0c8 100644 --- a/md/ru/Options.md +++ b/md/ru/Options.md @@ -153,6 +153,7 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3 | -qifPackages [path/to/packagesFodoler] | Устанавливает пользовательский путь к каталогам пакетов. По умолчанию это qif/packages. Важно путь считаеться относительным целевого католога (установленным опцией targetDir). | | -qifResources [path/to/resources1.qrc,path/to/resources2.qrc] | Устанавливает пользовательский путь к файлам ресурсов. По умолчанию эта опция пропущена. Важно путь считаеться относительным целевого католога (установленным опцией targetDir). | | -qifArchiveFormat [7z,zip,tar,tar.gz,tar.bz2,tar.xz] | Задает формат, используемый при упаковке новых архивов данных компонентов. Если вы опустите этот параметр, по умолчанию будет использоваться формат 7z. | +| -binarycreator [binarycreator command] | Установит новую команду вызова binarycreator. Пример : cqtdeployer -bin my.exe qifw -binarycreator 'wine path/to/binarycreator.exe'| ### Deb package options: