windeployqt: Do not deploy insighttracker plugin by default

Qt insight's TP is using plugin type "generic" so that insight plugins
can be deployed for every Qt application. As "generic" plugins are part
of QtGui windeployqt deploys these if a dependency to QtGui is found.

As defaulting to a deployment of insight plugins might cause confusion
among users, we make deployment of these plugins explicit if the module
is available.

Pick-to: 6.6 6.5 6.2 5.15
Change-Id: I9d2a8595373d5a15b7afbeaf7174226563b1cb6f
Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Reviewed-by: Timothée Keller <timothee.keller@qt.io>
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
bb10
Oliver Wolff 2023-07-27 09:58:55 +02:00
parent e71693efb9
commit ae7bc8803f
1 changed files with 25 additions and 4 deletions

View File

@ -189,6 +189,7 @@ struct Options {
bool dryRun = false;
bool patchQt = true;
bool ignoreLibraryErrors = false;
bool deployInsightTrackerPlugin = false;
};
// Return binary to be deployed from folder, ignore pre-existing web engine process.
@ -459,6 +460,11 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
parser->addPositionalArgument(QStringLiteral("[files]"),
QStringLiteral("Binaries or directory containing the binary."));
QCommandLineOption deployInsightTrackerOption(QStringLiteral("deploy-insighttracker"),
QStringLiteral("Deploy insight tracker plugin."));
// The option will be added to the parser if the module is available (see block below)
bool insightTrackerModuleAvailable = false;
OptionPtrVector enabledModuleOptions;
OptionPtrVector disabledModuleOptions;
const size_t qtModulesCount = qtModuleEntries.size();
@ -467,6 +473,10 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
for (const QtModule &module : qtModuleEntries) {
const QString option = moduleNameToOptionName(module.name);
const QString name = module.name;
if (name == u"InsightTracker") {
parser->addOption(deployInsightTrackerOption);
insightTrackerModuleAvailable = true;
}
const QString enabledDescription = QStringLiteral("Add ") + name + QStringLiteral(" module.");
CommandLineOptionPtr enabledOption(new QCommandLineOption(option, enabledDescription));
parser->addOption(*enabledOption.data());
@ -547,6 +557,8 @@ static inline int parseArguments(const QStringList &arguments, QCommandLineParse
options->patchQt = !parser->isSet(noPatchQtOption);
options->ignoreLibraryErrors = parser->isSet(ignoreErrorOption);
if (insightTrackerModuleAvailable)
options->deployInsightTrackerPlugin = parser->isSet(deployInsightTrackerOption);
for (const QtModule &module : qtModuleEntries) {
if (parser->isSet(*enabledModuleOptions.at(module.id)))
@ -841,7 +853,7 @@ static QString deployPlugin(const QString &plugin, const QDir &subDir,
ModuleBitset *usedQtModules, const ModuleBitset &disabledQtModules,
const QStringList &disabledPluginTypes,
const QString &libraryLocation, const QString &infix,
Platform platform)
Platform platform, bool deployInsightTrackerPlugin)
{
const QString subDirName = subDir.dirName();
// Filter out disabled plugins
@ -849,6 +861,12 @@ static QString deployPlugin(const QString &plugin, const QDir &subDir,
std::wcout << "Skipping plugin " << plugin << " due to skipped plugin type " << subDirName << '\n';
return {};
}
if (subDirName == u"generic" && plugin.contains(u"qinsighttracker")
&& !deployInsightTrackerPlugin) {
std::wcout << "Skipping plugin " << plugin
<< ". Use -deploy-insighttracker if you want to use it.\n";
return {};
}
const QString pluginPath = subDir.absoluteFilePath(plugin);
// Deploy QUiTools plugins as is without further dependency checking.
@ -898,7 +916,8 @@ QStringList findQtPlugins(ModuleBitset *usedQtModules, const ModuleBitset &disab
const QStringList &disabledPluginTypes,
const QString &qtPluginsDirName, const QString &libraryLocation,
const QString &infix,
DebugMatchMode debugMatchModeIn, Platform platform, QString *platformPlugin)
DebugMatchMode debugMatchModeIn, Platform platform, QString *platformPlugin,
bool deployInsightTrackerPlugin)
{
if (qtPluginsDirName.isEmpty())
return QStringList();
@ -944,7 +963,8 @@ QStringList findQtPlugins(ModuleBitset *usedQtModules, const ModuleBitset &disab
for (const QString &plugin : plugins) {
const QString pluginPath =
deployPlugin(plugin, subDir, usedQtModules, disabledQtModules,
disabledPluginTypes, libraryLocation, infix, platform);
disabledPluginTypes, libraryLocation, infix, platform,
deployInsightTrackerPlugin);
if (!pluginPath.isEmpty()) {
if (isPlatformPlugin)
*platformPlugin = subDir.absoluteFilePath(plugin);
@ -1412,7 +1432,8 @@ static DeployResult deploy(const Options &options, const QMap<QString, QString>
// qtaccessiblequick plugin.
disabled,
options.disabledPluginTypes, qtpathsVariables.value(QStringLiteral("QT_INSTALL_PLUGINS")),
libraryLocation, infix, debugMatchMode, options.platform, &platformPlugin);
libraryLocation, infix, debugMatchMode, options.platform, &platformPlugin,
options.deployInsightTrackerPlugin);
// Apply options flags and re-add library names.
QString qtGuiLibrary;