Simplify handling of qmlplugindump

Much of it isn't needed anymore:
- we do not build a debug version of qmlplugindump anymore since Qt 5.0
- on mac, qmlplugindump is not an app bundle since Qt 5.1
- since commit 6871f31b4e, the env parameter was just passed through

So if we take out this and all the infrastructure around it,
qmlplugindump is just a tool that we can handle like all the other
tools.

Change-Id: Ifa583ce7052a9030858312ab7c2e20f7ebce4051
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fawzi Mohamed <fawzi.mohamed@qt.io>
This commit is contained in:
Kai Köhne
2021-03-09 13:16:04 +01:00
committed by Kai Koehne
parent bc518cf353
commit 4f8474e532
8 changed files with 27 additions and 224 deletions

View File

@@ -49,7 +49,6 @@
#include <qmljs/qmljsbind.h>
#include <qmljs/qmljsfindexportedcpptypes.h>
#include <qmljs/qmljsplugindumper.h>
#include <qtsupport/qmldumptool.h>
#include <qtsupport/qtkitinformation.h>
#include <qtsupport/qtsupportconstants.h>
#include <texteditor/textdocument.h>
@@ -128,14 +127,10 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
Kit *activeKit = activeTarget ? activeTarget->kit() : KitManager::defaultKit();
QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitAspect::qtVersion(activeKit);
bool preferDebugDump = false;
bool setPreferDump = false;
projectInfo.tryQmlDump = false;
if (activeTarget) {
if (BuildConfiguration *bc = activeTarget->activeBuildConfiguration()) {
preferDebugDump = bc->buildType() == BuildConfiguration::Debug;
setPreferDump = true;
// Append QML2_IMPORT_PATH if it is defined in build configuration.
// It enables qmlplugindump to correctly dump custom plugins or other dependent
// plugins that are not installed in default Qt qml installation directory.
@@ -149,8 +144,6 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
projectInfo.applicationDirectories.append(target.targetFilePath.parentDir().toString());
}
}
if (!setPreferDump && qtVersion)
preferDebugDump = (qtVersion->defaultBuildConfig() & QtSupport::BaseQtVersion::DebugBuild);
if (qtVersion && qtVersion->isValid()) {
projectInfo.tryQmlDump = project && qtVersion->type() == QLatin1String(QtSupport::Constants::DESKTOPQT);
projectInfo.qtQmlPath = qtVersion->qmlPath().toFileInfo().canonicalFilePath();
@@ -160,16 +153,13 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
projectInfo.qtVersionString = QLatin1String(qVersion());
}
if (projectInfo.tryQmlDump) {
QtSupport::QmlDumpTool::pathAndEnvironment(activeKit,
preferDebugDump, &projectInfo.qmlDumpPath,
&projectInfo.qmlDumpEnvironment);
projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag();
} else {
projectInfo.qmlDumpPath.clear();
projectInfo.qmlDumpEnvironment.clear();
projectInfo.qmlDumpHasRelocatableFlag = true;
projectInfo.qmlDumpPath.clear();
const QtSupport::BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(activeKit);
if (version && projectInfo.tryQmlDump) {
projectInfo.qmlDumpPath = version->qmlplugindumpCommand();
projectInfo.qmlDumpHasRelocatableFlag = version->hasQmlDumpWithRelocatableFlag();
}
setupProjectInfoQmlBundles(projectInfo);
return projectInfo;
}

View File

@@ -11,7 +11,6 @@ add_qtc_plugin(QtSupport
exampleslistmodel.cpp exampleslistmodel.h
gettingstartedwelcomepage.cpp gettingstartedwelcomepage.h
profilereader.cpp profilereader.h
qmldumptool.cpp qmldumptool.h
qscxmlcgenerator.cpp qscxmlcgenerator.h
qtbuildaspects.cpp qtbuildaspects.h
qtconfigwidget.cpp qtconfigwidget.h

View File

@@ -25,7 +25,6 @@
#include "baseqtversion.h"
#include "qtconfigwidget.h"
#include "qmldumptool.h"
#include "qtkitinformation.h"
#include "qtversionfactory.h"
@@ -48,6 +47,7 @@
#include <qtsupport/qtsupportconstants.h>
#include <utils/algorithm.h>
#include <utils/buildablehelperlibrary.h>
#include <utils/displayname.h>
#include <utils/fileinprojectfinder.h>
#include <utils/hostosinfo.h>
@@ -211,7 +211,6 @@ public:
QtVersionData m_data;
bool m_isUpdating = false;
bool m_hasQmlDump = false; // controlled by m_versionInfoUpToDate
bool m_mkspecUpToDate = false;
bool m_mkspecReadUpToDate = false;
bool m_defaultConfigIsDebug = true;
@@ -238,6 +237,7 @@ public:
QString m_linguistCommand;
QString m_qscxmlcCommand;
QString m_qmlsceneCommand;
QString m_qmlplugindumpCommand;
MacroExpanderWrapper m_expander;
};
@@ -1010,6 +1010,24 @@ QString BaseQtVersion::qmlsceneCommand() const
return d->m_qmlsceneCommand;
}
QString BaseQtVersion::qmlplugindumpCommand() const
{
if (!isValid())
return QString();
if (!d->m_qmlplugindumpCommand.isNull())
return d->m_qmlplugindumpCommand;
ensureMkSpecParsed();
const QString path
= qmlBinPath().pathAppended(HostOsInfo::withExecutableSuffix("qmlplugindump")).toString();
d->m_qmlplugindumpCommand = QFileInfo(path).isFile() ? path : QString();
return d->m_qmlplugindumpCommand;
}
QString BaseQtVersionPrivate::findHostBinary(HostBinaries binary) const
{
QString baseDir;
@@ -1261,7 +1279,6 @@ void BaseQtVersionPrivate::updateVersionInfo()
m_data.installed = true;
m_data.hasExamples = false;
m_data.hasDocumentation = false;
m_hasQmlDump = false;
if (!queryQMakeVariables(m_qmakeCommand, q->qmakeRunEnvironment(), &m_versionInfo)) {
m_qmakeIsExecutable = false;
@@ -1292,17 +1309,8 @@ void BaseQtVersionPrivate::updateVersionInfo()
m_data.hostDataPath = FilePath::fromUserInput(qmakeProperty("QT_HOST_DATA"));
m_data.hostPrefixPath = FilePath::fromUserInput(qmakeProperty("QT_HOST_PREFIX"));
const QString qtInstallBins = q->binPath().toString();
const QString qtHeaderData = q->headerPath().toString();
if (!qtInstallBins.isNull()) {
if (!qtInstallBins.isEmpty()) {
m_hasQmlDump
= !QmlDumpTool::toolForQtPaths(qtInstallBins, false).isEmpty()
|| !QmlDumpTool::toolForQtPaths(qtInstallBins, true).isEmpty();
}
}
// Now check for a qt that is configured with a prefix but not installed
QString installDir = q->hostBinPath().toString();
if (!installDir.isNull()) {
@@ -1676,29 +1684,12 @@ Environment BaseQtVersion::qmakeRunEnvironment() const
return Environment::systemEnvironment();
}
bool BaseQtVersion::hasQmlDump() const
{
d->updateVersionInfo();
return d->m_hasQmlDump;
}
bool BaseQtVersion::hasQmlDumpWithRelocatableFlag() const
{
return ((qtVersion() > QtVersionNumber(4, 8, 4) && qtVersion() < QtVersionNumber(5, 0, 0))
|| qtVersion() >= QtVersionNumber(5, 1, 0));
}
bool BaseQtVersion::needsQmlDump() const
{
return qtVersion() < QtVersionNumber(4, 8, 0);
}
QString BaseQtVersion::qmlDumpTool(bool debugVersion) const
{
const QString qtInstallBins = binPath().toString();
return QmlDumpTool::toolForQtPaths(qtInstallBins, debugVersion);
}
Tasks BaseQtVersion::reportIssuesImpl(const QString &proFile, const QString &buildDir) const
{
Q_UNUSED(proFile)

View File

@@ -138,6 +138,7 @@ public:
QString linguistCommand() const;
QString qscxmlcCommand() const;
QString qmlsceneCommand() const;
QString qmlplugindumpCommand() const;
QString qtVersionString() const;
QtVersionNumber qtVersion() const;
@@ -181,11 +182,7 @@ public:
static bool isQtQuickCompilerSupported(const ProjectExplorer::Kit *k, QString *reason = nullptr);
bool isQtQuickCompilerSupported(QString *reason = nullptr) const;
QString qmlDumpTool(bool debugVersion) const;
bool hasQmlDump() const;
bool hasQmlDumpWithRelocatableFlag() const;
bool needsQmlDump() const;
virtual QtConfigWidget *createConfigurationWidget() const;

View File

@@ -1,116 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "qmldumptool.h"
#include "qtkitinformation.h"
#include "qtsupportconstants.h"
#include "qtversionmanager.h"
#include <coreplugin/icore.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <projectexplorer/project.h>
#include <utils/runextensions.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
#include <QCoreApplication>
#include <QDir>
#include <QDebug>
#include <QHash>
#include <QStandardPaths>
namespace QtSupport {
static inline QStringList validPrebuiltFilenames(bool debugBuild)
{
QStringList list = QStringList(QLatin1String("qmlplugindump"));
list.append(QLatin1String("qmlplugindump.app/Contents/MacOS/qmlplugindump"));
if (debugBuild)
list.prepend(QLatin1String("qmlplugindumpd.exe"));
else
list.prepend(QLatin1String("qmlplugindump.exe"));
return list;
}
QString QmlDumpTool::toolForVersion(const BaseQtVersion *version, bool debugDump)
{
if (version) {
const QString qtInstallBins = version->binPath().toString();
return toolForQtPaths(qtInstallBins, debugDump);
}
return QString();
}
QString QmlDumpTool::toolForQtPaths(const QString &qtInstallBins,
bool debugDump)
{
if (!Core::ICore::instance())
return QString();
// check for prebuilt binary first
QFileInfo fileInfo;
if (getHelperFileInfoFor(validPrebuiltFilenames(debugDump), qtInstallBins + QLatin1Char('/'), &fileInfo))
return fileInfo.absoluteFilePath();
return QString();
}
void QmlDumpTool::pathAndEnvironment(const ProjectExplorer::Kit *k, bool preferDebug,
QString *dumperPath, Utils::Environment *env)
{
if (!k)
return;
const BaseQtVersion *version = QtSupport::QtKitAspect::qtVersion(k);
if (version && !version->hasQmlDump())
return;
QString path;
path = toolForVersion(version, preferDebug);
if (path.isEmpty())
path = toolForVersion(version, !preferDebug);
if (!path.isEmpty()) {
QFileInfo qmldumpFileInfo(path);
if (!qmldumpFileInfo.exists()) {
qWarning() << "QmlDumpTool::qmlDumpPath: qmldump executable does not exist at" << path;
path.clear();
} else if (!qmldumpFileInfo.isFile()) {
qWarning() << "QmlDumpTool::qmlDumpPath: " << path << " is not a file";
path.clear();
}
}
if (!path.isEmpty() && version && dumperPath && env) {
*dumperPath = path;
k->addToEnvironment(*env);
}
}
} // namespace QtSupport

View File

@@ -1,54 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "qtsupport_global.h"
#include <utils/buildablehelperlibrary.h>
namespace ProjectExplorer { class Kit; }
namespace Utils { class Environment; }
namespace ProjectExplorer {
class Project;
class ToolChain;
}
namespace QtSupport {
class BaseQtVersion;
class QTSUPPORT_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary
{
public:
static QString toolForVersion(const BaseQtVersion *version, bool debugDump);
static QString toolForQtPaths(const QString &qtInstallBins,
bool debugDump);
static void pathAndEnvironment(const ProjectExplorer::Kit *k, bool preferDebug,
QString *path, Utils::Environment *env);
};
} // namespace

View File

@@ -22,7 +22,6 @@ HEADERS += \
qtversionmanager.h \
qtversionfactory.h \
baseqtversion.h \
qmldumptool.h \
qtoptionspage.h \
qtsupportconstants.h \
profilereader.h \
@@ -49,7 +48,6 @@ SOURCES += \
qttestparser.cpp \
qtversionmanager.cpp \
baseqtversion.cpp \
qmldumptool.cpp \
qtoptionspage.cpp \
profilereader.cpp \
qtparser.cpp \

View File

@@ -78,8 +78,6 @@ Project {
"exampleslistmodel.h",
"profilereader.cpp",
"profilereader.h",
"qmldumptool.cpp",
"qmldumptool.h",
"qscxmlcgenerator.cpp",
"qscxmlcgenerator.h",
"qtkitinformation.cpp",