diff options
author | Morten Johan Sørvig <morten.sorvig@digia.com> | 2014-03-24 09:18:35 +0100 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-03-26 10:25:18 +0100 |
commit | 15b56c2f8948de0aabfe44d7b3ccb0712d48c664 (patch) | |
tree | 22a1b556d3f92a2350e86f3004bdfa5ffcc7c46f | |
parent | 6b8a875f630a554a43edaadcf1d6312ed4f19ffd (diff) |
MacDeployQt: Add -always-overwrite option.
Support incrementally re-deploying to an existing app
bundle. Overwrite files that already exist in the
bundle. Disable the "Can not find Qt" warning. Skip
plugin deployment if Qt can not be found.
Remove usages of the Qt4-style binary packages from
/Developer.
Task-number: QTBUG-36043
Change-Id: I11d1e36e6beef24b55979fc4d853e19b60551740
Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r-- | src/macdeployqt/macdeployqt/main.cpp | 13 | ||||
-rw-r--r-- | src/macdeployqt/shared/shared.cpp | 22 |
2 files changed, 23 insertions, 12 deletions
diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp index 811e5d610..b4881789e 100644 --- a/src/macdeployqt/macdeployqt/main.cpp +++ b/src/macdeployqt/macdeployqt/main.cpp @@ -58,6 +58,7 @@ int main(int argc, char **argv) qDebug() << " -use-debug-libs : Deploy with debug versions of frameworks and plugins (implies -no-strip)"; qDebug() << " -executable=<path> : Let the given executable use the deployed frameworks too"; qDebug() << " -qmldir=<path> : Deploy imports used by .qml files in the given path"; + qDebug() << " -always-overwrite : Copy files enven if the target file exists"; qDebug() << ""; qDebug() << "macdeployqt takes an application bundle as input and makes it"; qDebug() << "self-contained by copying in the Qt frameworks and plugins that"; @@ -85,6 +86,7 @@ int main(int argc, char **argv) bool dmg = false; bool useDebugLibs = false; extern bool runStripEnabled; + extern bool alwaysOwerwriteEnabled; QStringList additionalExecutables; QStringList qmlDirs; @@ -126,6 +128,9 @@ int main(int argc, char **argv) LogError() << "Missing qml directory path"; else qmlDirs << argument.mid(index+1); + } else if (argument == QByteArray("-always-overwrite")) { + LogDebug() << "Argument found:" << argument; + alwaysOwerwriteEnabled = true; } else if (argument.startsWith("-")) { LogError() << "Unknown argument" << argument << "\n"; return 0; @@ -134,12 +139,8 @@ int main(int argc, char **argv) DeploymentInfo deploymentInfo = deployQtFrameworks(appBundlePath, additionalExecutables, useDebugLibs); - if (plugins) { - if (deploymentInfo.qtPath.isEmpty()) - deploymentInfo.pluginPath = "/Developer/Applications/Qt/plugins"; // Assume binary package. - else - deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins"; - + if (plugins && !deploymentInfo.qtPath.isEmpty()) { + deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins"; LogNormal(); deployPlugins(appBundlePath, deploymentInfo, useDebugLibs); createQtConf(appBundlePath); diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index 210366be8..722f1be3a 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -55,6 +55,7 @@ #include "shared.h" bool runStripEnabled = true; +bool alwaysOwerwriteEnabled = false; int logLevel = 1; using std::cout; @@ -96,9 +97,15 @@ inline QDebug operator<<(QDebug debug, const ApplicationBundleInfo &info) bool copyFilePrintStatus(const QString &from, const QString &to) { if (QFile(to).exists()) { - LogNormal() << "File exists, skip copy:" << to; - return false; - } else if (QFile::copy(from, to)) { + if (alwaysOwerwriteEnabled) { + QFile(to).remove(); + } else { + qDebug() << "File exists, skip copy:" << to; + return false; + } + } + + if (QFile::copy(from, to)) { QFile dest(to); dest.setPermissions(dest.permissions() | QFile::WriteOwner | QFile::WriteUser); LogNormal() << " copied:" << from; @@ -384,7 +391,7 @@ QString copyFramework(const FrameworkInfo &framework, const QString path) return QString(); } - if (!QFile::exists(to)) { // copy the binary and resources if that wasn't done before + if (!QFile::exists(to) || alwaysOwerwriteEnabled) { // copy the binary and resources if that wasn't done before copyFilePrintStatus(from, to); const QString resourcesSourcePath = framework.frameworkPath + "/Resources"; @@ -532,7 +539,7 @@ DeploymentInfo deployQtFrameworks(const QString &appBundlePath, const QStringLis QStringList allBinaryPaths = QStringList() << applicationBundle.binaryPath << applicationBundle.libraryPaths << additionalExecutables; QList<FrameworkInfo> frameworks = getQtFrameworksForPaths(allBinaryPaths, useDebugLibs); - if (frameworks.isEmpty()) { + if (frameworks.isEmpty() && !alwaysOwerwriteEnabled) { LogWarning(); LogWarning() << "Could not find any external Qt frameworks to deploy in" << appBundlePath; LogWarning() << "Perhaps macdeployqt was already used on" << appBundlePath << "?"; @@ -636,7 +643,7 @@ void createQtConf(const QString &appBundlePath) QDir().mkpath(filePath); QFile qtconf(fileName); - if (qtconf.exists()) { + if (qtconf.exists() && !alwaysOwerwriteEnabled) { LogWarning(); LogWarning() << fileName << "already exists, will not overwrite."; LogWarning() << "To make sure the plugins are loaded from the correct location,"; @@ -765,6 +772,9 @@ void createDiskImage(const QString &appBundlePath) QFile dmg(dmgName); + if (dmg.exists() && alwaysOwerwriteEnabled) + dmg.remove(); + if (dmg.exists()) { LogNormal() << "Disk image already exists, skipping .dmg creation for" << dmg.fileName(); } else { |