Skip to content

Commit

Permalink
fix #130 fix #129
Browse files Browse the repository at this point in the history
  • Loading branch information
EndrII committed Jun 19, 2019
1 parent bc49921 commit 89b141a
Show file tree
Hide file tree
Showing 6 changed files with 69 additions and 12 deletions.
70 changes: 63 additions & 7 deletions Deploy/deploy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ void Deploy::setQmake(const QString &value) {
bool Deploy::initDir(const QString &path) {

if (!QFileInfo::exists(path)) {
deployedFiles += path;
addToDeployed(path);
if (!QDir().mkpath(path)) {
return false;
}
Expand Down Expand Up @@ -199,7 +199,7 @@ bool Deploy::createRunScript(const QString &target) {
"\"$BASE_DIR\"/bin/%1 \"$@\"";

content = content.arg(QFileInfo(target).fileName());
int ld_index = find("ld-linux",deployedFiles);
int ld_index = find("ld-linux", deployedFiles);

if (ld_index >= 0 && QuasarAppUtils::Params::isEndable("deploySystem") &&
!QuasarAppUtils::Params::isEndable("noLibc")) {
Expand All @@ -222,7 +222,7 @@ bool Deploy::createRunScript(const QString &target) {
F.flush();
F.close();

deployedFiles += fname;
addToDeployed(fname);

return F.setPermissions(QFileDevice::ExeOther | QFileDevice::WriteOther |
QFileDevice::ReadOther | QFileDevice::ExeUser |
Expand All @@ -231,8 +231,35 @@ bool Deploy::createRunScript(const QString &target) {
QFileDevice::ReadOwner);
}

void Deploy::createQConf() {
bool Deploy::createQConf() {

QString content =
"[Paths]\n"
"Prefix= ./\n"
"Libraries= ./\n"
"Plugins= ./plugins\n"
"Imports= ./qml\n"
"Qml2Imports= ./qml\n";


QString fname = targetDir + QDir::separator() + "qt.conf";

QFile F(fname);
if (!F.open(QIODevice::WriteOnly)) {
return false;
}

F.write(content.toUtf8());
F.flush();
F.close();

addToDeployed(fname);

return F.setPermissions(QFileDevice::ExeOther | QFileDevice::WriteOther |
QFileDevice::ReadOther | QFileDevice::ExeUser |
QFileDevice::WriteUser | QFileDevice::ReadUser |
QFileDevice::ExeOwner | QFileDevice::WriteOwner |
QFileDevice::ReadOwner);
}

void Deploy::initIgnoreList()
Expand Down Expand Up @@ -301,12 +328,23 @@ void Deploy::deploy() {
QuasarAppUtils::Params::verboseLog("deploy msvc failed");
}

bool targetWindows = false;

for (auto i = targets.cbegin(); i != targets.cend(); ++i) {

if (QFileInfo(i.key()).completeSuffix() == "exe") {
targetWindows = true;
}

if (i.value() && !createRunScript(i.key())) {
qCritical() << "run script not created!";
}
}

if (targetWindows && !createQConf()) {
QuasarAppUtils::Params::verboseLog("create qt.conf failr", QuasarAppUtils::Warning);
}

settings.setValue(targetDir, deployedFiles);
}

Expand Down Expand Up @@ -428,8 +466,7 @@ bool Deploy::fileActionPrivate(const QString &file, const QString &target,
}
}

deployedFiles += target + QDir::separator() + name;

addToDeployed(target + QDir::separator() + name);
return true;
}

Expand Down Expand Up @@ -816,7 +853,7 @@ bool Deploy::smartMoveTargets() {
result = false;
}

deployedFiles += targetPath;
addToDeployed(targetPath);

temp.insert(targetPath + "/" + target.fileName(), i.value());

Expand Down Expand Up @@ -982,13 +1019,24 @@ void Deploy::clear() {

deployedFiles = settings.value(targetDir, QStringList()).toStringList();

QStringList deployedDirs = {};

for (auto file : deployedFiles) {
if (QFileInfo(file).isFile()) {
QFile::remove(file);
} else {
deployedDirs += file;
QDir(file).removeRecursively();
}
}

for (auto & dir: deployedDirs) {
QDir qdir(dir);
if (!qdir.entryList(QDir::NoDotAndDotDot).count()) {
qdir.removeRecursively();
}
}

deployedFiles.clear();

}
Expand Down Expand Up @@ -1038,6 +1086,14 @@ bool Deploy::strip(const QString &dir) {
#endif
}

bool Deploy::addToDeployed(const QString& path) {
auto info = QFileInfo(path);
if (info.isFile() || !info.exists()) {
deployedFiles += info.absoluteFilePath();
}
return true;
}

void Deploy::initEnvirement() {
QProcessEnvironment env = QProcessEnvironment::systemEnvironment();

Expand Down
3 changes: 2 additions & 1 deletion Deploy/deploy.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class DEPLOYSHARED_EXPORT Deploy {
void copyPlugins(const QStringList &list);
bool copyTranslations(QStringList list);

bool createQConf();
bool copyFolder(const QString &from, const QString &to,
const QStringList &filter = QStringList(),
QStringList *listOfCopiedItems = nullptr,
Expand All @@ -83,6 +84,7 @@ class DEPLOYSHARED_EXPORT Deploy {

bool strip(const QString &dir);

bool addToDeployed(const QString& path);
QStringList extractImportsFromDir(const QString &dirpath);
QFileInfoList findFilesInsideDir(const QString &name, const QString &dirpath);
bool extractQmlAll();
Expand Down Expand Up @@ -120,7 +122,6 @@ class DEPLOYSHARED_EXPORT Deploy {
bool setTargetsRecursive(const QString& dir);

bool createRunScript(const QString &target);
void createQConf();

void deploy();
QString getQtDir() const;
Expand Down
2 changes: 1 addition & 1 deletion installer/config/configLinux.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.2.2.4</Version>
<Version>1.2.3.0</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>
Expand Down
2 changes: 1 addition & 1 deletion installer/config/configWin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<WizardDefaultWidth>640px</WizardDefaultWidth>
<WizardDefaultHeight>400px</WizardDefaultHeight>
<Name>CQtDeployer</Name>
<Version>1.2.2.3</Version>
<Version>1.2.3.0</Version>
<Title>CQtDeployer</Title>
<Publisher>QuasarApp</Publisher>
<StartMenuDir>CQtDeployer</StartMenuDir>
Expand Down
2 changes: 1 addition & 1 deletion installer/packages/cqtdeployer/meta/package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Package>
<DisplayName>CQtDeployer</DisplayName>
<Description>CQtDeployer</Description>
<Version>1.2.2.4</Version>
<Version>1.2.3.0</Version>
<Default>true</Default>
<ForcedInstallation>false</ForcedInstallation>
<Script>installscript.js</Script>
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#

name: cqtdeployer # you probably want to 'snapcraft register <name>'
version: '1.2.2.4' # just for humans, typically '1.2+git' or '1.3.2'
version: '1.2.3.0' # just for humans, typically '1.2+git' or '1.3.2'
summary: deploy your qt projects # 79 char long summary
description: |
Console app for deploy qt libs.
Expand Down

0 comments on commit 89b141a

Please sign in to comment.