mirror of
https://github.com/QuasarApp/CQtDeployer.git
synced 2025-04-27 18:24:33 +00:00
Added support extraFiles #ref 114
Using: -extraData tmpFile,rmpFolder -extraDataOut path This options support the multipackage distributions.
This commit is contained in:
parent
8bc33007d0
commit
c2e2d145c6
@ -19,7 +19,6 @@
|
||||
"ignoreEnv": "/my/ignore/path",
|
||||
"clear": true,
|
||||
"force-clear": false,
|
||||
"allQmlDependes": false,
|
||||
"libDir": "./",
|
||||
"recursiveDepth": "3",
|
||||
"extraLibs": "myExtraLib (libssl)",
|
||||
|
@ -1,7 +1,7 @@
|
||||
{
|
||||
"noOverwrite": false,
|
||||
"bin": "./",
|
||||
"binDir": "./",
|
||||
"extraData": "",
|
||||
"qmlDir": "./",
|
||||
"deploySystem": false,
|
||||
"deploySystem-with-libc": false,
|
||||
@ -10,7 +10,6 @@
|
||||
"ignoreEnv": "/my/ignore/path",
|
||||
"clear": true,
|
||||
"force-clear": false,
|
||||
"allQmlDependes": false,
|
||||
"libDir": "./",
|
||||
"recursiveDepth": "3",
|
||||
"extraLibs": "myExtraLib (libssl)",
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"binDir": "./",
|
||||
"bin": "./",
|
||||
"clear": true,
|
||||
"libDir": "./",
|
||||
"recursiveDepth": "5"
|
||||
|
@ -348,6 +348,8 @@ bool ConfigParser::initDistroStruct() {
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
auto recOut = QuasarAppUtils::Params::getStrArg("recOut").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
auto extraDataOut = QuasarAppUtils::Params::getStrArg("extraDataOut").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto name = QuasarAppUtils::Params::getStrArg("name").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
@ -368,6 +370,9 @@ bool ConfigParser::initDistroStruct() {
|
||||
auto prefix = QuasarAppUtils::Params::getStrArg("prefix").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto extraData = QuasarAppUtils::Params::getStrArg("extraData").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
auto erroLog = [](const QString &flag){
|
||||
QuasarAppUtils::Params::log(QString("Set %0 fail, because you try set %0 for not inited package."
|
||||
" Use 'targetPackage' flag for init the packages").arg(flag),
|
||||
@ -405,6 +410,11 @@ bool ConfigParser::initDistroStruct() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (extraDataOut.size() && !parsePackagesPrivate(mainDistro, extraDataOut, &DistroModule::setExtraDataOutDir)) {
|
||||
erroLog("extraDataOut");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (name.size() && !parsePackagesPrivate(mainDistro, name, &DistroModule::setName)) {
|
||||
erroLog("name");
|
||||
return false;
|
||||
@ -445,6 +455,11 @@ bool ConfigParser::initDistroStruct() {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (extraData.size() && !parsePackagesPrivate(mainDistro, extraData, &DistroModule::addExtraData)) {
|
||||
erroLog("extraData");
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -515,11 +530,6 @@ bool ConfigParser::initQmlInput() {
|
||||
auto qmlDir = QuasarAppUtils::Params::getStrArg("qmlDir").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("allQmlDependes")) {
|
||||
_config.deployQml = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
auto erroLog = [](const QString &flag){
|
||||
QuasarAppUtils::Params::log(QString("Set %0 fail, because you try set %0 for not inited package."
|
||||
" Use 'targetPackage' flag for init the packages").arg(flag),
|
||||
@ -547,17 +557,28 @@ bool ConfigParser::parseDeployMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
setTargetDir();
|
||||
|
||||
auto bin = QuasarAppUtils::Params::getStrArg("bin").
|
||||
split(DeployCore::getSeparator(0));
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
if (!setTargets(bin)) {
|
||||
if (bin.size() && !setTargets(bin)) {
|
||||
|
||||
auto binDir = QuasarAppUtils::Params::getStrArg("binDir");
|
||||
if (!setTargetsRecursive(binDir)) {
|
||||
QuasarAppUtils::Params::log("setTargetDir fail!",
|
||||
QuasarAppUtils::Error);
|
||||
return false;
|
||||
}
|
||||
QuasarAppUtils::Params::log("Sets input targets is failed!",
|
||||
QuasarAppUtils::Warning);
|
||||
}
|
||||
|
||||
auto xData = QuasarAppUtils::Params::getStrArg("extraData").
|
||||
split(DeployCore::getSeparator(0), splitbehavior);
|
||||
|
||||
|
||||
if (!(_config.targets().count() || xData.count())) {
|
||||
QuasarAppUtils::Params::log("The targets initialize is failed!",
|
||||
QuasarAppUtils::Error);
|
||||
|
||||
QuasarAppUtils::Params::log("Use bin or extraData optins. And check input pathes.",
|
||||
QuasarAppUtils::Info);
|
||||
return false;
|
||||
}
|
||||
|
||||
_config.depchLimit = 0;
|
||||
@ -705,7 +726,7 @@ bool ConfigParser::setTargets(const QStringList &value) {
|
||||
isfillList = true;
|
||||
}
|
||||
else if (targetInfo.isDir()) {
|
||||
if (!setBinDir(i)) {
|
||||
if (!setTargetsInDir(i)) {
|
||||
QuasarAppUtils::Params::log(i + " du not contains executable binaries!",
|
||||
QuasarAppUtils::Debug);
|
||||
continue;
|
||||
@ -721,31 +742,27 @@ bool ConfigParser::setTargets(const QStringList &value) {
|
||||
if (!isfillList)
|
||||
return false;
|
||||
|
||||
setTargetDir();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigParser::setTargetsRecursive(const QString &dir) {
|
||||
if (!setBinDir(dir, true)) {
|
||||
QuasarAppUtils::Params::log("setBinDir failed!",
|
||||
if (!setTargetsInDir(dir, true)) {
|
||||
QuasarAppUtils::Params::log("setTargetsInDir failed!",
|
||||
QuasarAppUtils::Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
setTargetDir();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ConfigParser::setBinDir(const QString &dir, bool recursive) {
|
||||
bool ConfigParser::setTargetsInDir(const QString &dir, bool recursive) {
|
||||
QDir d(dir);
|
||||
if (dir.isEmpty() || !d.exists()) {
|
||||
QuasarAppUtils::Params::log(dir + " dir not exits!",
|
||||
QuasarAppUtils::Debug);
|
||||
return false;
|
||||
}
|
||||
QuasarAppUtils::Params::log("setBinDir check path: " + dir,
|
||||
QuasarAppUtils::Params::log("setTargetsInDir check path: " + dir,
|
||||
QuasarAppUtils::Debug);
|
||||
QFileInfoList list;
|
||||
|
||||
@ -759,7 +776,7 @@ bool ConfigParser::setBinDir(const QString &dir, bool recursive) {
|
||||
for (const auto &file : list) {
|
||||
|
||||
if (file.isDir()) {
|
||||
result |= setBinDir(file.absoluteFilePath(), recursive);
|
||||
result |= setTargetsInDir(file.absoluteFilePath(), recursive);
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1395,13 +1412,9 @@ bool ConfigParser::smartMoveTargets() {
|
||||
|
||||
QString targetPath = _config.getTargetDir() + "/" + i.value().getPackage();
|
||||
|
||||
if (DeployCore::isLib(target)) {
|
||||
targetPath += _config.getDistro(i.key()).getLibOutDir();
|
||||
} else {
|
||||
targetPath += _config.getDistro(i.key()).getBinOutDir();
|
||||
}
|
||||
targetPath += _config.getDistro(i.key()).getBinOutDir();
|
||||
|
||||
if (!_fileManager->smartCopyFile(target.absoluteFilePath(), targetPath)) {
|
||||
if (!_fileManager->cp(target.absoluteFilePath(), targetPath)) {
|
||||
result = false;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
void setTargetDir(const QString &target = "");
|
||||
bool setTargets(const QStringList &value);
|
||||
bool setTargetsRecursive(const QString &dir);
|
||||
bool setBinDir(const QString &dir, bool recursive = false);
|
||||
bool setTargetsInDir(const QString &dir, bool recursive = false);
|
||||
|
||||
void initIgnoreList();
|
||||
void initIgnoreEnvList();
|
||||
|
@ -17,6 +17,7 @@ DependencyMap &DependencyMap::operator +=(const DependencyMap &other) {
|
||||
this->_qtModules = this->_qtModules | other._qtModules;
|
||||
this->_neadedLibs = this->_neadedLibs + other._neadedLibs;
|
||||
this->_systemLibs = this->_systemLibs + other._systemLibs;
|
||||
this->_extraData = this->_extraData + other._extraData;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -25,6 +26,7 @@ DependencyMap &DependencyMap::operator -=(const DependencyMap &other) {
|
||||
this->_qtModules = this->_qtModules & (~other._qtModules);
|
||||
this->_neadedLibs = this->_neadedLibs - other._neadedLibs;
|
||||
this->_systemLibs = this->_systemLibs - other._systemLibs;
|
||||
this->_extraData = this->_extraData - other._extraData;
|
||||
|
||||
return *this;
|
||||
}
|
||||
@ -55,6 +57,10 @@ void DependencyMap::addNeadedLib(const QString &lib) {
|
||||
DeployCore::addQtModule(_qtModules, lib);
|
||||
}
|
||||
|
||||
void DependencyMap::addExtraData(const QString &data) {
|
||||
_extraData += data;
|
||||
}
|
||||
|
||||
void DependencyMap::removeModule(DeployCore::QtModule module) {
|
||||
_qtModules = _qtModules & (~module);
|
||||
}
|
||||
@ -67,6 +73,10 @@ void DependencyMap::removeNeadedLib(const QString &lib) {
|
||||
_neadedLibs.remove(lib);
|
||||
}
|
||||
|
||||
void DependencyMap::removeExtraData(const QString &data) {
|
||||
_extraData -= data;
|
||||
}
|
||||
|
||||
bool DependencyMap::containsSysLib(const QString &lib) const {
|
||||
return _systemLibs.contains(lib);
|
||||
}
|
||||
@ -79,13 +89,17 @@ bool DependencyMap::containsNeadedLib(const QString &lib) const {
|
||||
return _neadedLibs.contains(lib);
|
||||
}
|
||||
|
||||
QSet<QString> DependencyMap::targets() const
|
||||
{
|
||||
bool DependencyMap::containsExtraData(const QString &data) const {
|
||||
return _extraData.contains(data);
|
||||
}
|
||||
|
||||
const QSet<QString> DependencyMap::targets() const {
|
||||
return _targets;
|
||||
}
|
||||
|
||||
void DependencyMap::setTargets(const QSet<QString> &targets)
|
||||
{
|
||||
_targets = targets;
|
||||
|
||||
const QSet<QString> DependencyMap::extraData() const {
|
||||
return _extraData;
|
||||
}
|
||||
|
||||
|
||||
|
@ -27,21 +27,23 @@ public:
|
||||
DeployCore::QtModule qtModules() const;
|
||||
const QSet<QString>& neadedLibs() const;
|
||||
const QSet<QString>& systemLibs() const;
|
||||
const QSet<QString> extraData() const;
|
||||
const QSet<QString> targets() const;
|
||||
|
||||
void addModule(DeployCore::QtModule module);
|
||||
void addSystemLib(const QString& lib);
|
||||
void addNeadedLib(const QString& lib);
|
||||
void addExtraData(const QString& data);
|
||||
|
||||
void removeModule(DeployCore::QtModule module);
|
||||
void removeSystemLib(const QString& lib);
|
||||
void removeNeadedLib(const QString& lib);
|
||||
void removeExtraData(const QString& data);
|
||||
|
||||
bool containsSysLib(const QString& lib) const;
|
||||
bool containsModule(DeployCore::QtModule module) const;
|
||||
bool containsNeadedLib(const QString& lib) const;
|
||||
|
||||
QSet<QString> targets() const;
|
||||
void setTargets(const QSet<QString> &targets);
|
||||
bool containsExtraData(const QString& data) const;
|
||||
|
||||
private:
|
||||
DeployCore::QtModule _qtModules = DeployCore::NONE;
|
||||
@ -49,6 +51,8 @@ private:
|
||||
QSet<QString> _neadedLibs;
|
||||
QSet<QString> _systemLibs;
|
||||
QSet<QString> _targets;
|
||||
QSet<QString> _extraData;
|
||||
|
||||
};
|
||||
|
||||
#endif // DEPENDENCIESMAP_H
|
||||
|
@ -159,7 +159,7 @@ RunMode DeployCore::getMode() {
|
||||
return RunMode::Init;
|
||||
}
|
||||
|
||||
if (C("bin") || C("binDir")) {
|
||||
if (C("bin") || C("extraData")) {
|
||||
return RunMode::Deploy;
|
||||
}
|
||||
|
||||
@ -196,7 +196,6 @@ void DeployCore::help() {
|
||||
{"noCheckPATH", "Disables automatic search of paths to qmake in system PATH."},
|
||||
{"noRecursiveiIgnoreEnv", "Disables recursive ignore for ignoreEnv option."},
|
||||
{"v / version", "Shows compiled version"},
|
||||
{"allQmlDependes", "Extracts all the qml libraries. (not recommended, as it takes great amount of computer memory)"},
|
||||
{"qif", "Create the QIF installer for deployment programm"
|
||||
" You can specify the path to your own installer template. Examples: cqtdeployer -qif path/to/myCustom/qif."},
|
||||
{"qifFromSystem", "force use system binarycreator tool of qif from path or qt"},
|
||||
@ -217,7 +216,6 @@ void DeployCore::help() {
|
||||
{
|
||||
"Part 2 Deploy options", {
|
||||
{"-bin [list, params]", "Deployable file or folder. For example -bin ~/my/project/bin/,~/my/project/bin.exe"},
|
||||
{"-binDir [params]", "A folder which includes deployable files (recursive search)"},
|
||||
{"-confFile [params]", "The path to the json file with all deployment configurations. Using this file,"
|
||||
" you can add the necessary options, thereby simplifying the command invocation in the console."
|
||||
" However, the parameters in Kansol have a higher priority than in the file."
|
||||
@ -246,6 +244,7 @@ void DeployCore::help() {
|
||||
{"-pluginOut [package;path,path]", "Sets path to plugins out directory"},
|
||||
{"-binOut [package;path,path]", "Sets path to binary out directory"},
|
||||
{"-recOut [package;path,path]", "Sets path to recurses out directory"},
|
||||
{"-extraDataOut [package;path,path]", "Sets path to extra data files out directory"},
|
||||
{"-name [package;val,val]", "Sets name for a package. "
|
||||
"If this if you do not specify a package, the value will be assigned to the default package ("")"},
|
||||
{"-description [package;val,val]", "Sets description for a package"},
|
||||
@ -255,6 +254,7 @@ void DeployCore::help() {
|
||||
{"-publisher [package;val,val]", "Sets publisher for a package"},
|
||||
{"-homePage [package;val,val]", "Sets the home page url for a package"},
|
||||
{"-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 dirrectory will be copy to the binary location with save own structure."},
|
||||
|
||||
}
|
||||
},
|
||||
@ -300,7 +300,7 @@ QStringList DeployCore::helpKeys() {
|
||||
"help",
|
||||
"noOverwrite",
|
||||
"bin",
|
||||
"binDir",
|
||||
"extraData",
|
||||
"qmlDir",
|
||||
"deploySystem",
|
||||
"deploySystem-with-libc",
|
||||
@ -309,7 +309,6 @@ QStringList DeployCore::helpKeys() {
|
||||
"ignoreEnv",
|
||||
"clear",
|
||||
"force-clear",
|
||||
"allQmlDependes",
|
||||
"libDir",
|
||||
"extraLibs",
|
||||
"extraPlugin",
|
||||
@ -327,6 +326,7 @@ QStringList DeployCore::helpKeys() {
|
||||
"pluginOut",
|
||||
"binOut",
|
||||
"recOut",
|
||||
"extraDataOut",
|
||||
"version",
|
||||
"verbose",
|
||||
"qif",
|
||||
|
@ -148,3 +148,15 @@ bool DistroModule::isValid() {
|
||||
void DistroModule::setKey(const QString &key) {
|
||||
_key = key;
|
||||
}
|
||||
|
||||
QSet<QString> DistroModule::extraData() const {
|
||||
return _extraData;
|
||||
}
|
||||
|
||||
void DistroModule::setExtraData(const QSet<QString> &extraFiles) {
|
||||
_extraData = extraFiles;
|
||||
}
|
||||
|
||||
void DistroModule::addExtraData(const QString &extraFile) {
|
||||
_extraData += extraFile;
|
||||
}
|
||||
|
@ -62,6 +62,10 @@ public:
|
||||
|
||||
bool isValid();
|
||||
|
||||
QSet<QString> extraData() const;
|
||||
void setExtraData(const QSet<QString> &extraFiles);
|
||||
void addExtraData(const QString &extraFile);
|
||||
|
||||
protected:
|
||||
void setKey(const QString &key);
|
||||
|
||||
@ -83,6 +87,8 @@ private:
|
||||
QSet<QString> _enabled;
|
||||
QSet<QString> _disabled;
|
||||
QSet<QString> _extraPlugins;
|
||||
QSet<QString> _extraData;
|
||||
|
||||
};
|
||||
|
||||
#endif // DISTROMODULE_H
|
||||
|
@ -72,6 +72,14 @@ bool DistroStruct::isEmpty() {
|
||||
|
||||
}
|
||||
|
||||
QString DistroStruct::getExtraDataOutDir(const QString& basePath) const {
|
||||
return toFullPath(getRelativePath(basePath) + extraDataOutDir);
|
||||
}
|
||||
|
||||
void DistroStruct::setExtraDataOutDir(const QString &value) {
|
||||
extraDataOutDir = value;
|
||||
}
|
||||
|
||||
QString DistroStruct::toFullPath(QString path) const {
|
||||
return PathUtils::toFullPath(path);
|
||||
}
|
||||
|
@ -18,6 +18,7 @@
|
||||
class DEPLOYSHARED_EXPORT DistroStruct
|
||||
{
|
||||
private:
|
||||
QString extraDataOutDir;
|
||||
QString libOutDir;
|
||||
QString binOutDir;
|
||||
QString qmlOutDir;
|
||||
@ -39,6 +40,7 @@ public:
|
||||
void setTrOutDir(const QString &value);
|
||||
void setResOutDir(const QString &value);
|
||||
void setPluginsOutDir(const QString &value);
|
||||
void setExtraDataOutDir(const QString &value);
|
||||
|
||||
QString getLibOutDir(const QString& basePath = "/") const;
|
||||
QString getBinOutDir(const QString& basePath = "/") const;
|
||||
@ -47,10 +49,12 @@ public:
|
||||
QString getResOutDir(const QString& basePath = "/") const;
|
||||
QString getPluginsOutDir(const QString& basePath = "/") const;
|
||||
QString getRootDir(const QString& basePath = "/") const;
|
||||
QString getExtraDataOutDir(const QString& basePath = "/") const;
|
||||
|
||||
bool isEmpty();
|
||||
|
||||
friend class deploytest;
|
||||
|
||||
};
|
||||
|
||||
#endif // DISTROSTRUCT_H
|
||||
|
@ -99,10 +99,21 @@ QList<QString> Extracter::angleGLLibs() {
|
||||
void Extracter::extractAllTargets() {
|
||||
auto cfg = DeployCore::_config;
|
||||
for (auto i = cfg->packages().cbegin(); i != cfg->packages().cend(); ++i) {
|
||||
_packageDependencyes[i.key()] = {};
|
||||
auto &dep = _packageDependencyes[i.key()];
|
||||
|
||||
for (const auto &target : i.value().targets()) {
|
||||
extract(target, &_packageDependencyes[i.key()]);
|
||||
extract(target, &dep);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::extractExtraDataTargets() {
|
||||
auto cfg = DeployCore::_config;
|
||||
for (auto i = cfg->packages().cbegin(); i != cfg->packages().cend(); ++i) {
|
||||
auto &dep = _packageDependencyes[i.key()];
|
||||
|
||||
for (const auto &target : i.value().extraData()) {
|
||||
dep.addExtraData(target);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -200,6 +211,19 @@ void Extracter::copyLibs(const QSet<QString> &files, const QString& package) {
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyExtraData(const QSet<QString> &files, const QString &package) {
|
||||
auto cnf = DeployCore::_config;
|
||||
auto targetPath = cnf->getTargetDir() + "/" + package;
|
||||
auto distro = cnf->getDistroFromPackage(package);
|
||||
|
||||
for (const auto &file : files) {
|
||||
|
||||
if (!_fileManager->cp(file, targetPath + distro.getExtraDataOutDir())) {
|
||||
QuasarAppUtils::Params::log(file + " not copied");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Extracter::copyFiles() {
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
@ -211,9 +235,12 @@ void Extracter::copyFiles() {
|
||||
copyLibs(_packageDependencyes[i.key()].systemLibs(), i.key());
|
||||
}
|
||||
|
||||
|
||||
if (!QuasarAppUtils::Params::isEndable("noStrip") && !_fileManager->strip(cnf->getTargetDir())) {
|
||||
QuasarAppUtils::Params::log("strip failed!");
|
||||
}
|
||||
|
||||
copyExtraData(_packageDependencyes[i.key()].extraData(), i.key());
|
||||
}
|
||||
}
|
||||
|
||||
@ -241,6 +268,7 @@ void Extracter::deploy() {
|
||||
_cqt->smartMoveTargets();
|
||||
_scaner->setEnvironment(DeployCore::_config->envirement.environmentList());
|
||||
extractAllTargets();
|
||||
extractExtraDataTargets();
|
||||
|
||||
if (DeployCore::_config->deployQml && !extractQml()) {
|
||||
QuasarAppUtils::Params::log("qml not extacted!",
|
||||
@ -359,97 +387,59 @@ void Extracter::extractPluginLib(const QString& item, const QString& package) {
|
||||
|
||||
}
|
||||
|
||||
bool Extracter::extractQmlAll() {
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
if (!QFileInfo::exists(cnf->qtDir.getQmls())) {
|
||||
QuasarAppUtils::Params::log("qml dir wrong!",
|
||||
QuasarAppUtils::Warning);
|
||||
return false;
|
||||
}
|
||||
|
||||
for (auto i = cnf->packages().cbegin(); i != cnf->packages().cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + "/" + i.key();
|
||||
auto distro = cnf->getDistroFromPackage(i.key());
|
||||
|
||||
QStringList listItems;
|
||||
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.getQmls(), targetPath + distro.getQmlOutDir(),
|
||||
DeployCore::debugExtensions(),
|
||||
&listItems)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto &item : listItems) {
|
||||
extractPluginLib(item, i.key());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Extracter::extractQmlFromSource() {
|
||||
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
for (auto i = cnf->packages().cbegin(); i != cnf->packages().cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + "/" + i.key();
|
||||
auto distro = cnf->getDistroFromPackage(i.key());
|
||||
|
||||
QStringList plugins;
|
||||
QStringList listItems;
|
||||
|
||||
for (const auto &qmlInput: distro.qmlInput()) {
|
||||
QFileInfo info(qmlInput);
|
||||
|
||||
if (!info.isDir()) {
|
||||
QuasarAppUtils::Params::log("extract qml fail! qml source dir not exits or is not dir " + qmlInput,
|
||||
QuasarAppUtils::Error);
|
||||
continue;
|
||||
}
|
||||
QuasarAppUtils::Params::log("extractQmlFromSource " + info.absoluteFilePath());
|
||||
|
||||
if (!QFileInfo::exists(cnf->qtDir.getQmls())) {
|
||||
QuasarAppUtils::Params::log("qml dir wrong!",
|
||||
QuasarAppUtils::Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
QML ownQmlScaner(cnf->qtDir.getQmls());
|
||||
|
||||
if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
|
||||
QuasarAppUtils::Params::log("qml scaner run failed!",
|
||||
QuasarAppUtils::Error);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.getQmls(),
|
||||
targetPath + distro.getQmlOutDir(),
|
||||
DeployCore::debugExtensions() ,
|
||||
&listItems, &plugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto &item : listItems) {
|
||||
extractPluginLib(item, i.key());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Extracter::extractQml() {
|
||||
|
||||
if (QuasarAppUtils::Params::isEndable("qmlDir")) {
|
||||
return extractQmlFromSource();
|
||||
auto cnf = DeployCore::_config;
|
||||
|
||||
} else if (QuasarAppUtils::Params::isEndable("allQmlDependes")) {
|
||||
return extractQmlAll();
|
||||
for (auto i = cnf->packages().cbegin(); i != cnf->packages().cend(); ++i) {
|
||||
auto targetPath = cnf->getTargetDir() + "/" + i.key();
|
||||
auto distro = cnf->getDistroFromPackage(i.key());
|
||||
|
||||
QStringList plugins;
|
||||
QStringList listItems;
|
||||
|
||||
for (const auto &qmlInput: distro.qmlInput()) {
|
||||
QFileInfo info(qmlInput);
|
||||
|
||||
if (!info.isDir()) {
|
||||
QuasarAppUtils::Params::log("extract qml fail! qml source dir not exits or is not dir " + qmlInput,
|
||||
QuasarAppUtils::Error);
|
||||
continue;
|
||||
}
|
||||
QuasarAppUtils::Params::log("extractQmlFromSource " + info.absoluteFilePath());
|
||||
|
||||
if (!QFileInfo::exists(cnf->qtDir.getQmls())) {
|
||||
QuasarAppUtils::Params::log("qml dir wrong!",
|
||||
QuasarAppUtils::Warning);
|
||||
continue;
|
||||
}
|
||||
|
||||
QML ownQmlScaner(cnf->qtDir.getQmls());
|
||||
|
||||
if (!ownQmlScaner.scan(plugins, info.absoluteFilePath())) {
|
||||
QuasarAppUtils::Params::log("qml scaner run failed!",
|
||||
QuasarAppUtils::Error);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (!_fileManager->copyFolder(cnf->qtDir.getQmls(),
|
||||
targetPath + distro.getQmlOutDir(),
|
||||
DeployCore::debugExtensions() ,
|
||||
&listItems, &plugins)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
for (const auto &item : listItems) {
|
||||
extractPluginLib(item, i.key());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -38,13 +38,13 @@ private:
|
||||
MetaFileManager *_metaFileManager;
|
||||
|
||||
void extract(const QString &file, DependencyMap* depMap, const QString& mask = "");
|
||||
void extractExtraData(DependencyMap* depMap, const QString& mask = "");
|
||||
|
||||
bool copyTranslations(const QStringList &list, const QString &package);
|
||||
|
||||
bool extractQml();
|
||||
|
||||
QFileInfoList findFilesInsideDir(const QString &name, const QString &dirpath);
|
||||
bool extractQmlAll();
|
||||
bool extractQmlFromSource();
|
||||
/**
|
||||
* @brief extractLib
|
||||
* @param file file of lib
|
||||
@ -67,11 +67,14 @@ private:
|
||||
*/
|
||||
void compress();
|
||||
void extractAllTargets();
|
||||
void extractExtraDataTargets();
|
||||
|
||||
void extractPlugins();
|
||||
|
||||
void copyFiles();
|
||||
void copyTr();
|
||||
void copyLibs(const QSet<QString> &files, const QString &package);
|
||||
void copyExtraData(const QSet<QString> &files, const QString &package);
|
||||
|
||||
bool isWebEngine(const QString& package) const;
|
||||
void extractPluginLib(const QString &item, const QString &package);
|
||||
|
@ -256,7 +256,9 @@ bool FileManager::moveFile(const QString &file, const QString &target, QStringLi
|
||||
return fileActionPrivate(file, target, masks, true, targetIsFile);
|
||||
}
|
||||
|
||||
bool FileManager::copyFolder(const QString &from, const QString &to, const QStringList &filter,
|
||||
bool FileManager::copyFolder(const QString &from,
|
||||
const QString &to,
|
||||
const QStringList &filter,
|
||||
QStringList *listOfCopiedItems, QStringList *mask, bool force) {
|
||||
|
||||
QDir fromDir(from);
|
||||
@ -264,9 +266,12 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
|
||||
auto list = fromDir.entryInfoList(QDir::NoDotAndDotDot | QDir::AllEntries);
|
||||
|
||||
for (const auto &item : list) {
|
||||
if (QFileInfo(item).isDir()) {
|
||||
if (item.isDir()) {
|
||||
|
||||
if (!copyFolder(item.absoluteFilePath(), to + "/" + item.fileName(), filter, listOfCopiedItems, mask, force)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
copyFolder(item.absoluteFilePath(), to + "/" + item.fileName(), filter, listOfCopiedItems, mask, force);
|
||||
} else {
|
||||
|
||||
if (!force) {
|
||||
@ -316,6 +321,35 @@ bool FileManager::copyFolder(const QString &from, const QString &to, const QStri
|
||||
return true;
|
||||
}
|
||||
|
||||
bool FileManager::cp(const QString &from,
|
||||
const QString &to,
|
||||
const QStringList &filter,
|
||||
QStringList *listOfCopiedItems,
|
||||
QStringList *mask,
|
||||
bool force) {
|
||||
|
||||
QFileInfo info(from);
|
||||
if (!info.exists())
|
||||
return false;
|
||||
|
||||
if (info.isDir()) {
|
||||
// This is qt bug, filename return emptu value if dir have the seporator on the end of path.
|
||||
// Qt 5.15.2
|
||||
auto last = from.right(1);
|
||||
if (last == "/" || last == "\\") {
|
||||
last = from.mid(0, from.size() -1 );
|
||||
}
|
||||
|
||||
info.setFile(last);
|
||||
|
||||
return copyFolder(from, to + "/" + info.fileName(),
|
||||
filter, listOfCopiedItems, mask, force);
|
||||
}
|
||||
|
||||
|
||||
return copyFile(from, to, mask);
|
||||
}
|
||||
|
||||
bool FileManager::moveFolder(const QString &from, const QString &to, const QString& ignore) {
|
||||
QFileInfo info(from);
|
||||
|
||||
|
@ -55,6 +55,15 @@ public:
|
||||
QStringList *listOfCopiedItems = nullptr,
|
||||
QStringList *mask = nullptr);
|
||||
|
||||
bool copyFolder(const QString &from, const QString &to,
|
||||
const QStringList &filter = QStringList(),
|
||||
QStringList *listOfCopiedItems = nullptr,
|
||||
QStringList *mask = nullptr, bool force = false);
|
||||
|
||||
bool cp(const QString &from, const QString &to,
|
||||
const QStringList &filter = QStringList(),
|
||||
QStringList *listOfCopiedItems = nullptr,
|
||||
QStringList *mask = nullptr, bool force = false);
|
||||
|
||||
bool removeFile(const QString &file);
|
||||
bool removeFile(const QFileInfo &file);
|
||||
@ -73,10 +82,7 @@ public:
|
||||
bool moveFile(const QString &file, const QString &target,
|
||||
QStringList *mask = nullptr, bool targetIsFile = false);
|
||||
|
||||
bool copyFolder(const QString &from, const QString &to,
|
||||
const QStringList &filter = QStringList(),
|
||||
QStringList *listOfCopiedItems = nullptr,
|
||||
QStringList *mask = nullptr, bool force = false);
|
||||
|
||||
|
||||
bool moveFolder(const QString &from, const QString &to, const QString &ignore = "");
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"binDir": "$BIN_DIR",
|
||||
"bin": "$BIN_DIR",
|
||||
"clear": true,
|
||||
"libDir": "./",
|
||||
"recursiveDepth": "5",
|
||||
|
@ -100,7 +100,7 @@ private slots:
|
||||
void testOverwrite();
|
||||
|
||||
// tested flags binDir
|
||||
void testBinDir();
|
||||
void testextraData();
|
||||
|
||||
// tested flags qmlDir qmake
|
||||
void testQt();
|
||||
@ -1022,7 +1022,7 @@ void deploytest::testPrefix() {
|
||||
}
|
||||
|
||||
void deploytest::customTest() {
|
||||
runTestParams({"-confFile", "This is pass to custom configuretion",
|
||||
runTestParams({"-confFile", "path",
|
||||
"qifFromSystem"});
|
||||
}
|
||||
|
||||
@ -1132,7 +1132,7 @@ void deploytest::testRelativeLink() {
|
||||
void deploytest::testCheckQt() {
|
||||
|
||||
Deploy *deployer = new Deploy();
|
||||
QuasarAppUtils::Params::parseParams({"-binDir", TestBinDir, "clear",
|
||||
QuasarAppUtils::Params::parseParams({"-bin", TestBinDir, "clear",
|
||||
"noCheckRPATH", "noCheckPATH", "noQt"});
|
||||
QVERIFY(deployer->prepare());
|
||||
|
||||
@ -1507,38 +1507,40 @@ void deploytest::testOverwrite() {
|
||||
|
||||
}
|
||||
|
||||
void deploytest::testBinDir() {
|
||||
void deploytest::testextraData() {
|
||||
TestUtils utils;
|
||||
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
auto comapareTree = utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/bin/TestOnlyC",
|
||||
"./" + DISTRO_DIR + "/bin/qt.conf",
|
||||
"./" + DISTRO_DIR + "/bin/QtWidgetsProject",
|
||||
"./" + DISTRO_DIR + "/bin/TestQMLWidgets",
|
||||
"./" + DISTRO_DIR + "/TestOnlyC.sh",
|
||||
"./" + DISTRO_DIR + "/QtWidgetsProject.sh",
|
||||
"./" + DISTRO_DIR + "/TestQMLWidgets.sh"});
|
||||
{"./" + DISTRO_DIR + "/build/TestOnlyC",
|
||||
"./" + DISTRO_DIR + "/build/QtWidgetsProject",
|
||||
"./" + DISTRO_DIR + "/build/TestQMLWidgets"});
|
||||
#else
|
||||
auto comapareTree = utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/TestOnlyC.exe",
|
||||
"./" + DISTRO_DIR + "/QtWidgetsProject.exe",
|
||||
"./" + DISTRO_DIR + "/TestQMLWidgets.exe",
|
||||
"./" + DISTRO_DIR + "/qt.conf"});
|
||||
{"./" + DISTRO_DIR + "/build/TestOnlyC.exe",
|
||||
"./" + DISTRO_DIR + "/build/QtWidgetsProject.exe",
|
||||
"./" + DISTRO_DIR + "/build/TestQMLWidgets.exe"});
|
||||
#endif
|
||||
|
||||
#ifdef Q_OS_UNIX
|
||||
comapareTree += utils.createTree(
|
||||
{"./" + DISTRO_DIR + "/bin/quicknanobrowser",
|
||||
"./" + DISTRO_DIR + "/quicknanobrowser.sh",
|
||||
"./" + DISTRO_DIR + "/bin/webui",
|
||||
"./" + DISTRO_DIR + "/webui.sh"});
|
||||
{"./" + DISTRO_DIR + "/build/quicknanobrowser",
|
||||
"./" + DISTRO_DIR + "/build/webui"});
|
||||
#endif
|
||||
|
||||
|
||||
runTestParams({"-binDir", TestBinDir, "clear",
|
||||
runTestParams({"-extraData", TestBinDir, "clear",
|
||||
"noCheckRPATH", "noCheckPATH", "noQt"}, &comapareTree);
|
||||
|
||||
|
||||
comapareTree = TestModule.replace(comapareTree, {
|
||||
{"DistributionKit/build",
|
||||
"DistributionKit/myExtraData/build"}});
|
||||
|
||||
runTestParams({"-extraData", TestBinDir, "clear",
|
||||
"noCheckRPATH", "noCheckPATH", "noQt",
|
||||
"-extraDataOut", "myExtraData"}, &comapareTree);
|
||||
}
|
||||
|
||||
void deploytest::testConfFile() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user