diff --git a/Deploy/DeployResources.qrc b/Deploy/DeployResources.qrc
index c0e29d8..602f56a 100644
--- a/Deploy/DeployResources.qrc
+++ b/Deploy/DeployResources.qrc
@@ -26,8 +26,4 @@
Distributions/Templates/Icon.png
Distributions/Templates/Icon.ico
-
- ScriptsTemplates/windows.bat
- ScriptsTemplates/linux.sh
-
diff --git a/Deploy/Distributions/Templates/deb/DEBIAN/postinst b/Deploy/Distributions/Templates/deb/DEBIAN/postinst
index 55918ee..caeaebe 100755
--- a/Deploy/Distributions/Templates/deb/DEBIAN/postinst
+++ b/Deploy/Distributions/Templates/deb/DEBIAN/postinst
@@ -1,7 +1,6 @@
#!/bin/bash
APPS=$BASH_ARRAY_APPLICATIONS
-APPS_SHORTCUTS=$BASH_ARRAY_SHORTCUTS_APPLICATIONS
TARGET_DIR=/opt/$PREFIX/
@@ -36,20 +35,14 @@ do
DEST_NAME=$app
+ SRC_FILE="$TARGET_DIR/$app.sh"
+ DEST_FILE="/usr/share/applications/$app.desktop"
+ createShortCut
+
if [ ! -e /usr/bin/"${app,,}" ]; then
ln -s "$TARGET_DIR/$app.sh" /usr/bin/"${app,,}"
echo "${app,,}"
fi
done
-for app in "${APPS_SHORTCUTS[@]}"
-do
-
- DEST_NAME=$app
-
- SRC_FILE="$TARGET_DIR/$app"
- DEST_FILE="/usr/share/applications/${app%.*}.desktop"
- createShortCut
-done
-
diff --git a/Deploy/Distributions/Templates/deb/DEBIAN/prerm b/Deploy/Distributions/Templates/deb/DEBIAN/prerm
index 64b778a..0e0a2e6 100755
--- a/Deploy/Distributions/Templates/deb/DEBIAN/prerm
+++ b/Deploy/Distributions/Templates/deb/DEBIAN/prerm
@@ -1,18 +1,15 @@
#!/bin/bash
APPS=$BASH_ARRAY_APPLICATIONS
-APPS_SHORTCUTS=$BASH_ARRAY_SHORTCUTS_APPLICATIONS
for app in "${APPS[@]}"
do
+ SRC_FILE="$TARGET_DIR/$app.sh"
+ rm "/usr/share/applications/$app.desktop"
+
if [ -e /usr/bin/"${app,,}" ]; then
rm /usr/bin/"${app,,}"
echo "Remove ${app,,}"
fi
done
-
-for app in "${APPS_SHORTCUTS[@]}"
-do
- rm "/usr/share/applications/${app%.*}.desktop"
-done
diff --git a/Deploy/Distributions/Templates/qif/packages/default/meta/installscript.qs b/Deploy/Distributions/Templates/qif/packages/default/meta/installscript.qs
index 4a74850..554f184 100644
--- a/Deploy/Distributions/Templates/qif/packages/default/meta/installscript.qs
+++ b/Deploy/Distributions/Templates/qif/packages/default/meta/installscript.qs
@@ -2,13 +2,6 @@ function Component() {
}
-function getBasename(file) {
- if (!file.length)
- return ""
-
- return file.split('.')[0];
-}
-
function generateShortCutCmd(cmd) {
var prefix = "$PREFIX";
@@ -19,8 +12,8 @@ function generateShortCutCmd(cmd) {
component.addOperation(
"CreateShortcut",
- "@TargetDir@/" + prefix + "/" + cmd,
- "@DesktopDir@/" + getBasename(cmd) + ".lnk",
+ "@TargetDir@/" + prefix + "/" + cmd + ".bat",
+ "@DesktopDir@/" + cmd + ".lnk",
"iconPath=@TargetDir@/$ICON",
"iconId=0");
@@ -30,14 +23,14 @@ function generateShortCutCmd(cmd) {
if (systemInfo.kernelType === "linux") {
console.log("create icons!!! on LINUX");
component.addOperation("CreateDesktopEntry",
- "@HomeDir@/.local/share/applications/" + getBasename(cmd) + ".desktop",
+ "@HomeDir@/.local/share/applications/" + cmd + ".desktop",
"Version=@Version@\n
Type=Application\n
Terminal=false\n
- Exec=\"@TargetDir@/" + prefix + "/" + cmd + "\"\n
- Name=" + getBasename(cmd) + "\n
+ Exec=\"@TargetDir@/" + prefix + "/" + cmd + ".sh\"\n
+ Name=" + cmd + "\n
Icon=@TargetDir@/$ICON\n
- Name[en_US]=" + getBasename(cmd));
+ Name[en_US]=" + cmd);
console.log("create icons!!! on LINUX done");
}
@@ -48,9 +41,8 @@ Component.prototype.createOperations = function() {
component.createOperations();
var cmdArray = ["array", "of", "cmds"]; // will be changed in cqtdeployer
- var shortcutsCmdArray = ["array", "of", "shortcut", "cmds"]; // will be changed in cqtdeployer
- shortcutsCmdArray.forEach( function (item){
+ cmdArray.forEach( function (item){
generateShortCutCmd(item);
});
diff --git a/Deploy/Distributions/idistribution.cpp b/Deploy/Distributions/idistribution.cpp
index 2d8aaf6..937b389 100644
--- a/Deploy/Distributions/idistribution.cpp
+++ b/Deploy/Distributions/idistribution.cpp
@@ -196,25 +196,10 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
QString cmdArray = "[";
QString bashArray = "(";
- QString cmdShortCutsArray = "[";
- QString bashShortCutsArray = "(";
int initSize = cmdArray.size();
for (const auto &target :pkg.targets()) {
- const DeployConfig *cfg = DeployCore::_config;
- auto fileinfo = QFileInfo(target);
- auto targetInfo = cfg->targets().value(target);
-
- if (targetInfo.getShortCut()) {
- if (cmdArray.size() > initSize) {
- cmdShortCutsArray += ",";
- bashShortCutsArray += " ";
- }
-
- cmdShortCutsArray += "\"" + targetInfo.getRunScriptFile() + "\"";
- bashShortCutsArray += "\"" + targetInfo.getRunScriptFile() + "\"";
- }
-
+ auto fileinfo = QFileInfo(target);
if (fileinfo.suffix().compare("exe", ONLY_WIN_CASE_INSENSIATIVE) == 0 || fileinfo.suffix().isEmpty()) {
if (cmdArray.size() > initSize) {
cmdArray += ",";
@@ -226,13 +211,9 @@ bool iDistribution::collectInfo(const DistroModule& pkg,
}
cmdArray += "]";
bashArray += ")";
- cmdShortCutsArray += "]";
- bashShortCutsArray += ")";
info.Custom = {{"[\"array\", \"of\", \"cmds\"]", cmdArray}};
- info.Custom["[\"array\", \"of\", \"shortcut\", \"cmds\"]"] = cmdShortCutsArray;
- info.Custom["$BASH_ARRAY_APPLICATIONS"] = bashArray;
info.Custom["$BASH_ARRAY_APPLICATIONS"] = bashArray;
if (info.Name.isEmpty()) {
diff --git a/Deploy/ScriptsTemplates/linux.sh b/Deploy/ScriptsTemplates/linux.sh
deleted file mode 100644
index c9e1aae..0000000
--- a/Deploy/ScriptsTemplates/linux.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-#!/bin/sh
-
-# This is default bat run script of The CQtDeployer project.
-# This file contains key word that will replaced after deploy project.
-#
-# ####################################################################
-#
-# CQT_LIB_PATH - are releative path to libraryes of a deployed distribution.
-# CQT_QML_PATH - are releative path to qml libraryes of a deployed distribution.
-# CQT_PLUGIN_PATH - are releative path to qt plugins of a deployed distribution.
-# CQT_BIN_PATH - are releative path to targets of a deployed distribution.
-
-# CQT_SYSTEM_LIB_PATH - are releative path to system libraryes of a deployed distribution.
-# CQT_BASE_NAME - are base name of the executable that will be launched after run this script.
-# CQT_CUSTOM_SCRIPT_BLOCK - This is code from the customScript option
-# CQT_RUN_COMMAND - This is command for run application. Requred BASE_DIR variable.
-#
-# ####################################################################
-
-BASE_DIR=$(dirname \"$(readlink -f \"$0\")\")
-export LD_LIBRARY_PATH=\"$BASE_DIR\"CQT_LIB_PATH:\"$BASE_DIR\":$LD_LIBRARY_PATH
-export QML_IMPORT_PATH=\"$BASE_DIR\"CQT_QML_PATH:$QML_IMPORT_PATH
-export QML2_IMPORT_PATH=\"$BASE_DIR\"CQT_QML_PATH:$QML2_IMPORT_PATH
-export QT_PLUGIN_PATH=\"$BASE_DIR\"CQT_PLUGIN_PATH:$QT_PLUGIN_PATH
-export QTWEBENGINEPROCESS_PATH=\"$BASE_DIR\"CQT_BIN_PATH/QtWebEngineProcess
-export QTDIR=\"$BASE_DIR\"
-export CQT_PKG_ROOT=\"$BASE_DIR\"
-export CQT_RUN_FILE=\"$BASE_DIR/CQT_BASE_NAME.sh\"
-
-export QT_QPA_PLATFORM_PLUGIN_PATH=\"$BASE_DIR\"CQT_PLUGIN_PATH/platforms:$QT_QPA_PLATFORM_PLUGIN_PATH
-
-CQT_CUSTOM_SCRIPT_BLOCK
-
-CQT_RUN_COMMAND
diff --git a/Deploy/ScriptsTemplates/windows.bat b/Deploy/ScriptsTemplates/windows.bat
deleted file mode 100644
index af3f2f6..0000000
--- a/Deploy/ScriptsTemplates/windows.bat
+++ /dev/null
@@ -1,22 +0,0 @@
-:: This is default bat run script of The CQtDeployer project.
-:: This file contains key word that will replaced after deploy project.
-
-:: ####################################################################
-
-:: LIB_PATH - are releative path to libraryes of a deployed distribution.
-:: SYSTEM_LIB_PATH - are releative path to system libraryes of a deployed distribution.
-:: BASE_NAME - are base name of the executable that will be launched after run this script.
-:: CUSTOM_SCRIPT_BLOCK - This is code from the customScript option
-:: RUN_COMMAND - This is command for run application. Requred BASE_DIR variable.
-
-:: ####################################################################
-
-@echo off
-SET BASE_DIR=%~dp0
-SET PATH=%BASE_DIR%LIB_PATH;%PATH%;SYSTEM_LIB_PATH
-SET CQT_PKG_ROOT=%BASE_DIR%
-SET CQT_RUN_FILE=%BASE_DIR%BASE_NAME.bat
-
-CUSTOM_SCRIPT_BLOCK
-
-RUN_COMMAND
diff --git a/Deploy/configparser.cpp b/Deploy/configparser.cpp
index 135bb89..f7f4085 100644
--- a/Deploy/configparser.cpp
+++ b/Deploy/configparser.cpp
@@ -75,7 +75,7 @@ void parseTargetPrivate(DeployConfig& conf,
auto pair = iconPair.split(DeployCore::getSeparator(1), splitbehavior);
if (pair.size() == 1) {
- QuasarAppUtils::Params::log(QString("Set new default property for all tagets: " + pair.value(0)),
+ QuasarAppUtils::Params::log(QString("Set new default icon for all tagets: " + pair.value(0)),
QuasarAppUtils::Debug);
for (auto& editableTarget: cointainer) {
(editableTarget.*adder)(pair.value(0));
@@ -96,7 +96,7 @@ void parseTargetPrivate(DeployConfig& conf,
}
for (const auto &target: targetsMap) {
- QuasarAppUtils::Params::log(QString("Set new property for %0 taget.").
+ QuasarAppUtils::Params::log(QString("Set new icon for %0 taget. Icon: %1").
arg(pair.value(0), pair.value(1)),
QuasarAppUtils::Debug);
(target->*adder)(pair.value(1));
@@ -104,34 +104,6 @@ void parseTargetPrivate(DeployConfig& conf,
}
}
-template
-bool enableOptionFotTargetPrivate(DeployConfig& conf,
- const QStringList &inputParams,
- Enabler enabler) {
-
- for (const auto &iconPair: inputParams) {
- auto pair = iconPair.split(DeployCore::getSeparator(1), splitbehavior);
-
- if (pair.size() != 1) {
- QuasarAppUtils::Params::log(QString("Failed parese list of option values, This option support only single leve list. "
- " Example: use -Option val1,val2,val3 "),
- QuasarAppUtils::Error);
- return false;
- }
-
- const auto targetsMap = conf.getTargetsListByFilter(pair.value(0));
-
- for (const auto &target: targetsMap) {
- QuasarAppUtils::Params::log(QString("Set new property for %0 taget.").
- arg(pair.value(0)),
- QuasarAppUtils::Debug);
- (target->*enabler)();
- }
- }
-
- return true;
-}
-
bool ConfigParser::parseParams() {
auto path = QuasarAppUtils::Params::getArg("confFile");
@@ -606,6 +578,35 @@ bool ConfigParser::initPackages() {
return true;
}
+bool ConfigParser::initRunScripts() {
+ const auto list = QuasarAppUtils::Params::getArg("runScript").split(DeployCore::getSeparator(0), splitbehavior);
+
+ for (const auto& line: list) {
+ auto pair = line.split(DeployCore::getSeparator(1), splitbehavior);
+ if (pair.size() != 2) {
+ QuasarAppUtils::Params::log("Syntax error of the runScript option."
+ " Example of use :"
+ " -runScript \"myTarget;path/To/Target/RunScript.sh,"
+ "mySecondTarget;path/To/Target/SecondRunScript.sh\"",
+ QuasarAppUtils::Error);
+ return false;
+ }
+
+ QFileInfo script(pair.value(1));
+
+ if (!script.isFile()) {
+ QuasarAppUtils::Params::log(QString("The %0 file does not exist.").arg(script.absoluteFilePath()),
+ QuasarAppUtils::Error);
+ return false;
+ }
+
+ _config.registerRunScript(pair.value(0),
+ script.absoluteFilePath());
+ }
+
+ return true;
+}
+
bool ConfigParser::initQmlInput() {
auto qmlDir = QuasarAppUtils::Params::getArg("qmlDir").
@@ -682,6 +683,11 @@ bool ConfigParser::parseDeployMode() {
}
}
+
+ if (!initRunScripts()) {
+ return false;
+ }
+
initIgnoreEnvList();
initEnvirement();
initIgnoreList();
@@ -700,9 +706,9 @@ bool ConfigParser::parseDeployMode() {
" then you must use the classic version of CQtDeployer instead of the snap version."
" This is due to the fact that the snap version"
" runs in an isolated container and has limited access"
- " to system utilities and the environment."
- " For get the classic version of cqtdeployer use the cqtdeployer installer"
- " https://github.com/QuasarApp/CQtDeployer/releases", QuasarAppUtils::Info);
+ " to system utilities and the environment. "
+ "For get the classic version of cqtdeployer use the cqtdeployer installer "
+ "https://github.com/QuasarApp/CQtDeployer/releases", QuasarAppUtils::Info);
}
return false;
@@ -754,39 +760,15 @@ bool ConfigParser::parseInitMode() {
return true;
}
-bool ConfigParser::configureTargets() {
+void ConfigParser::configureTargets() {
const auto icons = QuasarAppUtils::Params::getArg("icon").
split(DeployCore::getSeparator(0), splitbehavior);
- const auto runScripts = QuasarAppUtils::Params::getArg("runScript").
- split(DeployCore::getSeparator(0), splitbehavior);
-
- const auto disableShortcuts = QuasarAppUtils::Params::getArg("disableRunScript").
- split(DeployCore::getSeparator(0), splitbehavior);
-
- const auto disableRunScripts = QuasarAppUtils::Params::getArg("disableShortCut").
- split(DeployCore::getSeparator(0), splitbehavior);
-
-
if (icons.size()) {
parseTargetPrivate(_config, icons, &TargetInfo::setIcon);
}
- if (runScripts.size()) {
- parseTargetPrivate(_config, runScripts, &TargetInfo::setRunScript);
- }
-
- if (disableShortcuts.size() && !enableOptionFotTargetPrivate(_config, disableShortcuts, &TargetInfo::disableShortCut)) {
- packagesErrorLog("disableShortCut");
- return false;
- }
-
- if (disableRunScripts.size() && !enableOptionFotTargetPrivate(_config, disableRunScripts, &TargetInfo::disableRunScript)) {
- packagesErrorLog("disableRunScript");
- return false;
- }
-
- return true;
+ return;
}
bool ConfigParser::parseClearMode() {
@@ -1168,7 +1150,7 @@ bool ConfigParser::initQmake() {
auto qt = *qtList.begin();
- if (qt.rightRef(3).compare(QString("lib"), Qt::CaseInsensitive)) {
+ if (qt.right(3).compare("lib", Qt::CaseInsensitive)) {
return initQmakePrivate(QFileInfo(qt + "/../bin/qmake").absoluteFilePath());
}
@@ -1584,7 +1566,9 @@ bool ConfigParser::smartMoveTargets() {
_config.targetsEdit() = temp;
- return result && configureTargets();
+ configureTargets();
+
+ return result;
}
ConfigParser::ConfigParser(FileManager *filemanager, PluginsParser *pluginsParser, DependenciesScanner* scaner, Packing *pac):
diff --git a/Deploy/configparser.h b/Deploy/configparser.h
index 69f3685..54a9d20 100644
--- a/Deploy/configparser.h
+++ b/Deploy/configparser.h
@@ -52,6 +52,7 @@ private:
bool loadFromFile(const QString& file);
bool initDistroStruct();
bool initPackages();
+ bool initRunScripts();
bool parseDeployMode();
bool parseInfoMode();
bool parseInitMode();
@@ -59,7 +60,7 @@ private:
* @brief configureTargets Sets targets data from options.
* @return true if function finishe successfull
*/
- bool configureTargets();
+ void configureTargets();
bool parseClearMode();
diff --git a/Deploy/deployconfig.cpp b/Deploy/deployconfig.cpp
index e9439d1..09836b2 100644
--- a/Deploy/deployconfig.cpp
+++ b/Deploy/deployconfig.cpp
@@ -104,6 +104,15 @@ void DeployConfig::setDefaultPackage(const QString &value) {
defaultPackage = value;
}
+void DeployConfig::registerRunScript(const QString &targetName,
+ const QString &scriptPath) {
+ _runScripts.insert(targetName, scriptPath);
+}
+
+QString DeployConfig::getRunScript(const QString &targetName) const {
+ return _runScripts.value(targetName, "");
+}
+
QtMajorVersion DeployConfig::isNeededQt() const {
auto Qt = QtMajorVersion::NoQt;
diff --git a/Deploy/deployconfig.h b/Deploy/deployconfig.h
index f2935a5..2abdf08 100644
--- a/Deploy/deployconfig.h
+++ b/Deploy/deployconfig.h
@@ -122,6 +122,9 @@ public:
QString getDefaultPackage() const;
void setDefaultPackage(const QString &value);
+ void registerRunScript(const QString& targetName, const QString& scriptPath);
+ QString getRunScript(const QString& targetName) const;
+
/**
* @brief isNeededQt This method return all needed qt major version for all targets.
* @return qt major version
@@ -152,6 +155,12 @@ private:
*/
QHash _packages;
+ /**
+ * @brief _runScripts
+ * target - pathToScript
+ */
+ QHash _runScripts;
+
/**
* @brief targetDir - targe directory (this folder conteins all files of distrebution kit)
*/
diff --git a/Deploy/deploycore.cpp b/Deploy/deploycore.cpp
index 37ba1cd..8d5a3dd 100644
--- a/Deploy/deploycore.cpp
+++ b/Deploy/deploycore.cpp
@@ -295,10 +295,7 @@ void DeployCore::help() {
{
"Part 4 Control of packages options", {
- {"-icon [target;val,val]", "Sets path to icon for a targets"},
- {"-disableRunScript [target;val,val]", "Disables a generation of run script for selected targets"},
- {"-disableShortCut [target;val,val]", "Disables a generation of shortcut for selected targets"}
-
+ {"-icon [target;val,val]", "Sets path to icon for a targets"}
}
},
diff --git a/Deploy/metafilemanager.cpp b/Deploy/metafilemanager.cpp
index b2b9ab6..b0c3aac 100644
--- a/Deploy/metafilemanager.cpp
+++ b/Deploy/metafilemanager.cpp
@@ -27,15 +27,46 @@ bool MetaFileManager::createRunScriptWindows(const QString &target) {
QFileInfo targetInfo(target);
QString content;
- auto runScript = targetinfo.getRunScript();
+ auto runScript = cnf->getRunScript(targetInfo.fileName());
+ if (runScript.size()) {
+ QFile script(runScript);
+ if (!script.open(QIODevice::ReadOnly)) {
+ return false;
+ }
+ content = script.readAll();
+ script.close();
- QFile script(runScript);
- if (!script.open(QIODevice::ReadOnly)) {
- return false;
+ } else {
+
+ bool fGui = DeployCore::isGui(_mudulesMap.value(target));
+ auto systemLibsDir = distro.getLibOutDir() + DeployCore::systemLibsFolderName();
+
+ content =
+ "@echo off \n"
+ "SET BASE_DIR=%~dp0\n"
+ "SET PATH=%BASE_DIR%" + distro.getLibOutDir() + ";%PATH%;" + systemLibsDir + "\n"
+ "SET CQT_PKG_ROOT=%BASE_DIR%\n"
+ "SET CQT_RUN_FILE=%BASE_DIR%%0.bat\n"
+
+ "%3\n";
+
+ // Run application as invoke of the console for consle applications
+ // And run gui applciation in the detached mode.
+ if (fGui) {
+ content += "start \"%0\" %4 \"%BASE_DIR%" + distro.getBinOutDir() + "%1\" %2 \n";
+ } else {
+ content += "call \"%BASE_DIR%" + distro.getBinOutDir() + "%1\" %2 \n";
+ }
+
+ content = content.arg(targetInfo.baseName(), targetInfo.fileName(), "%*",
+ generateCustoScriptBlok(true)); // %0 %1 %2 %3
+
+ content = QDir::toNativeSeparators(content);
+
+ if (fGui) {
+ content = content.arg("/B"); // %4
+ }
}
- content = script.readAll();
- script.close();
- replace(toReplace(target, distro), content);
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + targetInfo.baseName()+ ".bat";
@@ -59,7 +90,6 @@ bool MetaFileManager::createRunScriptWindows(const QString &target) {
bool MetaFileManager::createRunScriptLinux(const QString &target) {
auto cnf = DeployCore::_config;
- auto targetinfo = cnf->targets().value(target);
if (!cnf->targets().contains(target)) {
return false;
@@ -69,15 +99,48 @@ bool MetaFileManager::createRunScriptLinux(const QString &target) {
QFileInfo targetInfo(target);
QString content;
- auto runScript = targetinfo.getRunScript();
- QFile script(runScript);
- if (!script.open(QIODevice::ReadOnly)) {
- return false;
- }
- content = script.readAll();
- script.close();
- replace(toReplace(target, distro), content);
+ auto runScript = cnf->getRunScript(targetInfo.fileName());
+ if (runScript.size()) {
+ QFile script(runScript);
+ if (!script.open(QIODevice::ReadOnly)) {
+ return false;
+ }
+ content = script.readAll();
+ script.close();
+ } else {
+
+ auto systemLibsDir = distro.getLibOutDir() + DeployCore::systemLibsFolderName();
+
+ content =
+ "#!/bin/sh\n"
+ "BASE_DIR=$(dirname \"$(readlink -f \"$0\")\")\n"
+ "export "
+ "LD_LIBRARY_PATH=\"$BASE_DIR\"" + distro.getLibOutDir() +
+ ":\"$BASE_DIR\":$LD_LIBRARY_PATH:\"$BASE_DIR\"" + systemLibsDir + "\n"
+ "export QML_IMPORT_PATH=\"$BASE_DIR\"" + distro.getQmlOutDir() + ":$QML_IMPORT_PATH\n"
+ "export QML2_IMPORT_PATH=\"$BASE_DIR\"" + distro.getQmlOutDir() + ":$QML2_IMPORT_PATH\n"
+ "export QT_PLUGIN_PATH=\"$BASE_DIR\"" + distro.getPluginsOutDir() + ":$QT_PLUGIN_PATH\n"
+ "export QTWEBENGINEPROCESS_PATH=\"$BASE_DIR\"" + distro.getBinOutDir() + "QtWebEngineProcess\n"
+ "export QTDIR=\"$BASE_DIR\"\n"
+ "export CQT_PKG_ROOT=\"$BASE_DIR\"\n"
+ "export CQT_RUN_FILE=\"$BASE_DIR/%2\"\n"
+
+ "export "
+ "QT_QPA_PLATFORM_PLUGIN_PATH=\"$BASE_DIR\"" + distro.getPluginsOutDir() +
+ "platforms:$QT_QPA_PLATFORM_PLUGIN_PATH\n"
+ ""
+ "%1\n"
+ "\"$BASE_DIR" + distro.getBinOutDir() + "%0\" \"$@\"\n";
+
+ content = content.arg(targetInfo.fileName()); // %0
+
+ content = content.arg(generateCustoScriptBlok(false),
+ targetInfo.baseName()+ ".sh"); // %1 %2
+
+
+
+ }
QString fname = DeployCore::_config->getTargetDir(target) + QDir::separator() + targetInfo.baseName()+ ".sh";
@@ -110,9 +173,9 @@ QString MetaFileManager::generateCustoScriptBlok(bool bat) const {
auto cstSh = QuasarAppUtils::Params::getArg("customScript", "");
if (cstSh.size()) {
res = "\n" +
- commentMarker + "Begin Custom Script (generated by customScript flag)\n"
+ commentMarker + "Begin Custom Script (generated by customScript flag)\n"
"%0\n" +
- commentMarker + "End Custom Script\n"
+ commentMarker + "End Custom Script\n"
"\n";
res = res.arg(cstSh);
@@ -185,63 +248,14 @@ bool MetaFileManager::createQConf(const QString &target) {
QFileDevice::ReadOwner);
}
-QHash MetaFileManager::toReplace(const QString& target,
- const DistroModule& distro) const {
- QFileInfo targetInfo(target);
-
- QHash result = {
- {"CQT_BIN_PATH", distro.getBinOutDir()},
- {"CQT_LIB_PATH", distro.getLibOutDir()},
- {"CQT_QML_PATH", distro.getQmlOutDir()},
- {"CQT_PLUGIN_PATH", distro.getPluginsOutDir()},
- {"CQT_SYSTEM_LIB_PATH", distro.getLibOutDir() + DeployCore::systemLibsFolderName()},
- {"CQT_BASE_NAME", targetInfo.baseName()}
- };
-
- bool fGui = DeployCore::isGui(_mudulesMap.value(target));
-
-
- if (targetInfo.completeSuffix().compare(".exe", Qt::CaseInsensitive) == 0) {
- result.insert("CQT_CUSTOM_SCRIPT_BLOCK", generateCustoScriptBlok(true));
-
- // Run application as invoke of the console for consle applications
- // And run gui applciation in the detached mode.
- QString runCmd;
- if (fGui) {
- runCmd = "start \"" + targetInfo.baseName() + "\" /B " +
- "\"%BASE_DIR%" + distro.getBinOutDir() + targetInfo.fileName() + "\" %*";
- } else {
- runCmd = "call \"%BASE_DIR%" + distro.getBinOutDir() + targetInfo.fileName() + "\" %*";
- }
-
- result.insert("CQT_RUN_COMMAND", runCmd);
-
- } else {
- result.insert("CQT_CUSTOM_SCRIPT_BLOCK", generateCustoScriptBlok(false));
-
- QString runCmd = "\"$BASE_DIR" + distro.getBinOutDir() + targetInfo.fileName() + "\" \"$@\" ";
-
- result.insert("CQT_RUN_COMMAND", runCmd);
- }
-
- return result;
-}
-
-void MetaFileManager::replace(const QHash &map, QString &content) {
- for (auto it = map.begin(); it != map.end(); ++it) {
- content = content.replace(it.key(), it.value());
- }
-
-}
-
void MetaFileManager::createRunMetaFiles(const QHash& modulesMap) {
_mudulesMap = modulesMap;
for (auto i = DeployCore::_config->targets().cbegin(); i != DeployCore::_config->targets().cend(); ++i) {
- if (i.value().fEnableRunScript() && !createRunScript(i.key())) {
+ if (!createRunScript(i.key())) {
QuasarAppUtils::Params::log("Failed to create a run script: " + i.key(),
- QuasarAppUtils::Error);
+ QuasarAppUtils::Error);
}
if (!createQConf(i.key())) {
diff --git a/Deploy/metafilemanager.h b/Deploy/metafilemanager.h
index 533d540..8bb88d1 100644
--- a/Deploy/metafilemanager.h
+++ b/Deploy/metafilemanager.h
@@ -12,8 +12,6 @@
#include
class FileManager;
-class DistroModule;
-class TargetInfo;
class MetaFileManager
{
@@ -34,11 +32,6 @@ private:
bool createQConf(const QString &target);
- QHash toReplace(const QString &target,
- const DistroModule &distro) const;
-
- void replace(const QHash& map, QString& content);
-
FileManager* _fileManager = nullptr;
QHash _mudulesMap;
};
diff --git a/Deploy/targetinfo.cpp b/Deploy/targetinfo.cpp
index 0209413..562d6f3 100644
--- a/Deploy/targetinfo.cpp
+++ b/Deploy/targetinfo.cpp
@@ -6,28 +6,21 @@
//#
#include "targetinfo.h"
-#include "deploycore.h"
-#include "deployconfig.h"
TargetInfo::TargetInfo() {
}
-TargetInfo::~TargetInfo() {
- if (_fEnableRunScript)
- delete _fEnableRunScript;
-}
-
-const QString & TargetInfo::getPackage() const {
- return _package;
+QString TargetInfo::getPackage() const {
+ return package;
}
void TargetInfo::setPackage(const QString &value) {
- _package = value;
+ package = value;
}
QString TargetInfo::getIcon() const {
- if (_icon.isEmpty()) {
+ if (icon.isEmpty()) {
QFileInfo info(getName());
if (info.suffix() == "exe") {
return ":/shared/Distributions/Templates/Icon.ico";
@@ -37,74 +30,11 @@ QString TargetInfo::getIcon() const {
}
- return _icon;
+ return icon;
}
void TargetInfo::setIcon(const QString &value) {
- _icon = value;
-}
-
-bool TargetInfo::getShortCut() const {
- return _fEnableShortCut;
-}
-
-void TargetInfo::setShortCut(bool shortcut) {
- _fEnableShortCut = shortcut;
-}
-
-void TargetInfo::disableShortCut() {
- setShortCut(false);
-}
-
-QString TargetInfo::getRunScript() const {
- if (_runScript.isEmpty()) {
- QFileInfo info(getName());
- if (info.suffix() == "exe") {
- return ":/Scripts/ScriptsTemplates/windows.bat";
- }
-
- return ":/Scripts/ScriptsTemplates/linux.sh";
- }
-
- return _runScript;
-}
-
-void TargetInfo::setRunScript(const QString &newRunScript) {
- _runScript = newRunScript;
-}
-
-QString TargetInfo::getRunScriptFile() const {
-
- if (_fEnableRunScript) {
- QFileInfo runscriptInfo(_runScript);
- QFileInfo info(getName());
-
- return info.baseName() + "." + runscriptInfo.completeSuffix();
- }
-
- return getName();
-}
-
-bool TargetInfo::fEnableRunScript() const {
-
- if (!_fEnableRunScript) {
- QFileInfo info(fullPath());
- QString compleSufix = info.completeSuffix();
- return compleSufix.compare(".exe", Qt::CaseInsensitive) == 0 || compleSufix.isEmpty();
- }
-
- return _fEnableRunScript;
-}
-
-void TargetInfo::setFEnableRunScript(bool newFEnableRunScript) {
- if (!_fEnableRunScript)
- _fEnableRunScript = new bool;
-
- *_fEnableRunScript = newFEnableRunScript;
-}
-
-void TargetInfo::disableRunScript() {
- setFEnableRunScript(false);
+ icon = value;
}
diff --git a/Deploy/targetinfo.h b/Deploy/targetinfo.h
index 9862b41..68e30d1 100644
--- a/Deploy/targetinfo.h
+++ b/Deploy/targetinfo.h
@@ -11,102 +11,20 @@
#include "distrostruct.h"
#include "libinfo.h"
-/**
- * @brief The TargetInfo class This clas scontains information about target object. (executable or another files marked in a bin option)
- */
class DEPLOYSHARED_EXPORT TargetInfo: public LibInfo
{
public:
TargetInfo();
- ~TargetInfo();
- /**
- * @brief getPackage This method return name of the package in that contains this target.
- * @return name of the package in that contains this target.
- */
- const QString & getPackage() const;
-
- /**
- * @brief setPackage This method sets new value for pacakge name in that contains this target.
- * @param value new This is new value of the pacakge.
- */
+ QString getPackage() const;
void setPackage(const QString &value);
- /**
- * @brief getIcon This method return path to default icon of the target.
- * @return icon path.
- * @note if the icon not set then return default icon.
- */
QString getIcon() const;
-
- /**
- * @brief setIcon This method sets new iconf for target.
- * @param value
- */
void setIcon(const QString &value);
- /**
- * @brief getShortCut This method return true if the target need to create shortcut.
- * @return true if shortcut needed for this target.
- */
- bool getShortCut() const;
-
- /**
- * @brief setShortCut This method sets new status of the creating shortcut.
- * @param shortcut This is new value of the shortcut
- */
- void setShortCut(bool shortcut);
-
- /**
- * @brief disableShortCut This method disable shortcut for this target.
- */
- void disableShortCut();
-
- /**
- * @brief getRunScript This method return path to run script.
- * @return path to run script
- * @note By Default return path to default run scrip file from cqtdeployer resources.
- */
- QString getRunScript() const;
-
- /**
- * @brief setRunScript sets New path of the run script.
- * @param newRunScript This is new path of the run sscript.
- */
- void setRunScript(const QString &newRunScript);
-
- /**
- * @brief getRunScriptFile This method return name fo the run script file or executable file if the run script are not needed
- * @return runscript name
- */
- QString getRunScriptFile() const;
-
-
- /**
- * @brief fEnableRunScript This return true if the run script will be generateed for this target else false.
- * @return true if the run script will be generateed for this target else false.
- */
- bool fEnableRunScript() const;
-
- /**
- * @brief setFEnableRunScript This method enable or disable generation runScript.
- * @param newFEnableRunScript New value.
- */
- void setFEnableRunScript(bool newFEnableRunScript);
-
- /**
- * @brief disableRunScript This method disable run script for this target.
- */
- void disableRunScript();
-
private:
- QString _package = "";
- QString _icon = "";
- bool _fEnableShortCut = true;
- bool *_fEnableRunScript = nullptr;
-
- QString _runScript = "";
-
- };
+ QString package = "";
+ QString icon = "";
+};
#endif // TARGETINFO_H
diff --git a/UnitTests/tst_deploytest.cpp b/UnitTests/tst_deploytest.cpp
index a9eeaee..a67a6bb 100644
--- a/UnitTests/tst_deploytest.cpp
+++ b/UnitTests/tst_deploytest.cpp
@@ -181,9 +181,6 @@ private slots:
void testMd5();
- void testDisableShortcuts();
- void testDisableRunScripts();
-
void customTest();
};
@@ -1467,15 +1464,6 @@ void deploytest::testMd5() {
"qifFromSystem"}, &comapareTreeqif);
}
-void deploytest::testDisableShortcuts() {
- QVERIFY(false);
-}
-
-void deploytest::testDisableRunScripts() {
- QVERIFY(false);
-
-}
-
void deploytest::customTest() {
//runTestParams({"-confFile", "",
// "qifFromSystem"});
diff --git a/md/en/Options.md b/md/en/Options.md
index 3733e0f..6f4bdb4 100644
--- a/md/en/Options.md
+++ b/md/en/Options.md
@@ -126,8 +126,7 @@ cqtdeployer -option1 value1 -option2 list, of, values flag1 flag2 flag3
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -icon [target;val,val] | Sets path to icon for a targets |
-| -disableRunScript [target;val,val] | Disables a generation of run script for selected targets|
-| -disableShortCut [target;val,val] | Disables a generation of shortcut for selected targets |
+
### Plugins Controll Options
diff --git a/md/ru/Options.md b/md/ru/Options.md
index 41ed28c..263f90e 100644
--- a/md/ru/Options.md
+++ b/md/ru/Options.md
@@ -124,8 +124,6 @@ cqtdeployer -option1 value1 -option2 list,of,values flag1 flag2 flag3
| Option | Descriptiion |
|-----------------------------|-----------------------------------------------------------|
| -icon [target;val,val] | Установит путь к иконке или логотипу для целе |
-| -disableRunScript [target; val, val]| Отключает создание сценария выполнения для выбранных целей |
-| -disableShortCut [target; val, val] | Отключает создание ярлыков для выбранных целей |
### Параметры управления плагинами: