CQtDeployer/Deploy/deploy.h

132 lines
3.7 KiB
C
Raw Normal View History

2018-08-19 11:00:13 +03:00
/*
2019-01-26 07:54:56 +03:00
* Copyright (C) 2018-2019 QuasarApp.
2018-08-19 11:00:13 +03:00
* Distributed under the lgplv3 software license, see the accompanying
* Everyone is permitted to copy and distribute verbatim copies
* of this license document, but changing it is not allowed.
2018-10-24 17:26:42 +03:00
*/
2018-08-19 11:00:13 +03:00
2018-08-17 20:47:49 +03:00
#ifndef DEPLOY_H
#define DEPLOY_H
#include <QDir>
2018-12-14 21:45:27 +03:00
#include <QSettings>
2018-08-17 20:47:49 +03:00
#include <QString>
#include <QStringList>
2019-03-19 21:50:05 +03:00
#include <dependenciesscanner.h>
2019-01-27 15:37:19 +03:00
#include "deploy_global.h"
2018-11-23 14:56:55 +03:00
2019-01-27 15:37:19 +03:00
class DEPLOYSHARED_EXPORT Deploy {
2018-10-24 17:26:42 +03:00
private:
2018-08-17 20:47:49 +03:00
bool deployQml = false;
2018-09-17 11:17:04 +03:00
bool onlyCLibs = false;
2018-10-24 17:26:42 +03:00
int depchLimit = 0;
2018-12-14 21:45:27 +03:00
QStringList deployedFiles;
QSettings settings;
2018-08-17 20:47:49 +03:00
QString qmlScaner = "";
QString qmake = "";
2018-12-15 20:51:25 +03:00
/**
* @brief targets
* key - path
* value - create wrapper
*/
QMap<QString, bool> targets;
2018-08-17 20:47:49 +03:00
QString targetDir = "";
2018-08-23 21:28:47 +03:00
QString qmlDir = "";
2019-01-27 15:37:19 +03:00
QString translationDir = "";
2018-11-23 14:56:55 +03:00
QStringList deployEnvironment;
2018-08-17 20:47:49 +03:00
QStringList QtLibs;
QStringList noQTLibs;
QStringList qmlLibs;
QStringList neededPlugins;
QStringList ignoreList;
2018-09-19 14:53:51 +03:00
QStringList extraPlugins;
2018-08-17 20:47:49 +03:00
2019-01-16 22:17:49 +03:00
QString appDir;
2019-03-19 21:50:05 +03:00
DependenciesScanner winScaner;
2018-11-23 14:56:55 +03:00
bool fileActionPrivate(const QString &file, const QString &target,
QStringList *mask, bool isMove);
2018-08-17 20:47:49 +03:00
2018-12-15 18:30:20 +03:00
void copyFiles(const QStringList &files);
2018-10-24 17:26:42 +03:00
bool copyFile(const QString &file, const QString &target,
QStringList *mask = nullptr);
/**
* @brief smartCopyFile
* @param file
* @param target
* @param mask
* @return if file in target dir try move file else copy
*/
bool smartCopyFile(const QString &file, const QString &target,
QStringList *mask = nullptr);
bool moveFile(const QString &file, const QString &target,
2018-10-24 17:26:42 +03:00
QStringList *mask = nullptr);
void extract(const QString &file, bool isExtractPlugins = true);
QString recursiveInvairement(int depch, QDir &dir);
void extractPlugins(const QString &lib);
bool copyPlugin(const QString &plugin);
2018-10-24 17:26:42 +03:00
void copyPlugins(const QStringList &list);
2019-01-27 15:37:19 +03:00
bool copyTranslations(QStringList list);
2018-12-24 18:25:05 +03:00
bool copyFolder(const QString &from, const QString &to,
const QStringList &filter = QStringList(),
2018-09-08 12:18:00 +03:00
QStringList *listOfCopiedItems = nullptr,
QStringList *mask = nullptr);
2018-08-18 22:36:28 +03:00
bool extractQml();
2019-01-26 22:27:36 +03:00
bool strip(const QString &dir);
2018-08-17 23:54:29 +03:00
2018-08-23 21:28:47 +03:00
QStringList extractImportsFromDir(const QString &dirpath);
2018-12-15 20:51:25 +03:00
QFileInfoList findFilesInsideDir(const QString &name, const QString &dirpath);
2018-08-24 16:18:37 +03:00
bool extractQmlAll();
2019-01-21 21:41:22 +03:00
bool extractQmlFromSource(const QString &sourceDir);
2018-08-24 16:18:37 +03:00
QString filterQmlPath(const QString &path);
2019-03-17 18:42:07 +03:00
void extractLib(const QString & file, bool isExtractPlugins);
2018-11-23 14:56:55 +03:00
void addEnv(const QString& dir);
QString concatEnv() const;
2018-12-15 20:51:25 +03:00
bool smartMoveTargets();
bool isLib(const QFileInfo &file);
bool setBinDir(const QString& dir, bool recursive = false);
2018-12-16 15:41:03 +03:00
bool initDir(const QString &path);
void setTargetDir();
2018-10-24 17:26:42 +03:00
2018-12-09 17:35:07 +03:00
public:
2018-08-17 20:47:49 +03:00
Deploy();
2018-11-23 14:56:55 +03:00
void initEnvirement();
2018-08-17 20:47:49 +03:00
bool getDeployQml() const;
void setDeployQml(bool value);
QString getQmlScaner() const;
void setQmlScaner(const QString &value);
QString getQmake() const;
void setQmake(const QString &value);
2018-12-15 20:51:25 +03:00
bool setTargets(const QStringList &value);
bool setTargetsRecursive(const QString& dir);
bool createRunScript(const QString &target);
void createQConf();
2018-08-17 20:47:49 +03:00
void deploy();
QString getQtDir() const;
void setQtDir(const QString &value);
2018-08-18 19:02:07 +03:00
void clear();
2018-09-17 11:17:04 +03:00
void setOnlyCLibs(bool value);
2018-09-18 16:36:05 +03:00
void setExtraPath(const QStringList &value);
2018-09-19 14:53:51 +03:00
void setExtraPlugins(const QStringList &value);
2018-10-24 17:26:42 +03:00
void setDepchLimit(int value);
2019-01-26 22:27:36 +03:00
friend class deploytest;
2018-08-17 20:47:49 +03:00
};
#endif // DEPLOY_H