From 85e64f95c8637f876ba84dcbd01e375050e76d8c Mon Sep 17 00:00:00 2001 From: =?utf8?q?Morten=20Johan=20S=C3=B8rvig?= Date: Tue, 6 May 2014 14:05:13 +0200 Subject: [PATCH] Add option for skipping use of private API. The qsqlodbc and qsqlpsql are known to cause rejections from the Mac App store due to use of private/deprecated API. The plugins are deployed whenever the SQL module is used. Due to this corse granularity of plugin selection apps may find themselves rejected for plugins which they are not actually using. Make macdeployqt print a warning when sqlodbc or sqlpsql is deployed. Add "-appstore-compliant" which will skip deployment of the plugins. Task-number: QTBUG-37835 Task-number: QTBUG-38607 Change-Id: I7325156ffaf228a97d7ceeb12f329b3f10db4ff2 Reviewed-by: Gabriel de Dietrich --- src/macdeployqt/macdeployqt/main.cpp | 11 +++++++++++ src/macdeployqt/shared/shared.cpp | 16 ++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/src/macdeployqt/macdeployqt/main.cpp b/src/macdeployqt/macdeployqt/main.cpp index 80c8979..450d114 100644 --- a/src/macdeployqt/macdeployqt/main.cpp +++ b/src/macdeployqt/macdeployqt/main.cpp @@ -52,6 +52,7 @@ int main(int argc, char **argv) qDebug() << " -qmldir= : Deploy imports used by .qml files in the given path"; qDebug() << " -always-overwrite : Copy files even if the target file exists"; qDebug() << " -codesign= : Run codesign with the given identity on all executables"; + qDebug() << " -appstore-compliant: Skip deployment of components that use private API"; qDebug() << ""; qDebug() << "macdeployqt takes an application bundle as input and makes it"; qDebug() << "self-contained by copying in the Qt frameworks and plugins that"; @@ -61,6 +62,12 @@ int main(int argc, char **argv) qDebug() << "framework. The accessibility, image formats, and text codec"; qDebug() << "plugins are always copied, unless \"-no-plugins\" is specified."; qDebug() << ""; + qDebug() << "Qt plugins may use private API and will cause the app to be"; + qDebug() << "rejected from the Mac App store. MacDeployQt will print a warning"; + qDebug() << "when known incompatible plugins are deployed. Use -appstore-compliant "; + qDebug() << "to skip these plugins. Currently two SQL plugins are known to"; + qDebug() << "be incompatible: qsqlodbc and qsqlpsql."; + qDebug() << ""; qDebug() << "See the \"Deploying an Application on Qt/Mac\" topic in the"; qDebug() << "documentation for more information about deployment on Mac OS X."; @@ -83,6 +90,7 @@ int main(int argc, char **argv) QStringList qmlDirs; extern bool runCodesign; extern QString codesignIdentiy; + extern bool appstoreCompliant; for (int i = 2; i < argc; ++i) { QByteArray argument = QByteArray(argv[i]); @@ -134,6 +142,9 @@ int main(int argc, char **argv) runCodesign = true; codesignIdentiy = argument.mid(index+1); } + } else if (argument == QByteArray("-appstore-compliant")) { + LogDebug() << "Argument found:" << argument; + appstoreCompliant = true; } else if (argument.startsWith("-")) { LogError() << "Unknown argument" << argument << "\n"; return 1; diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp index d6dcfb6..c5eb9f9 100644 --- a/src/macdeployqt/shared/shared.cpp +++ b/src/macdeployqt/shared/shared.cpp @@ -55,6 +55,7 @@ bool runStripEnabled = true; bool alwaysOwerwriteEnabled = false; bool runCodesign = false; QString codesignIdentiy; +bool appstoreCompliant = false; int logLevel = 1; using std::cout; @@ -959,8 +960,19 @@ void deployPlugins(const ApplicationBundleInfo &appBundleInfo, const QString &pl if (deploymentInfo.deployedFrameworks.contains(QStringLiteral("QtSql.framework"))) { QStringList sqlPlugins = QDir(pluginSourcePath + QStringLiteral("/sqldrivers")).entryList(QStringList() << QStringLiteral("*.dylib")); foreach (const QString &plugin, sqlPlugins) { - if (!plugin.endsWith(QStringLiteral("_debug.dylib"))) - pluginList.append(QStringLiteral("sqldrivers/") + plugin); + if (plugin.endsWith(QStringLiteral("_debug.dylib"))) + continue; + + // Some sql plugins are known to cause app store rejections. Skip or warn for these plugins. + if (plugin.startsWith(QStringLiteral("libqsqlodbc")) || plugin.startsWith(QStringLiteral("libqsqlpsql"))) { + LogWarning() << "Plugin" << plugin << "uses private API and is not Mac App store compliant."; + if (appstoreCompliant) { + LogWarning() << "Skip plugin" << plugin; + continue; + } + } + + pluginList.append(QStringLiteral("sqldrivers/") + plugin); } } -- 2.7.4