QtSupport: Pass kit to QmlDumpTool::pathAndEnvironment

Pass the complete kit to QmlDumpTool::pathAndEnvironment instead
of just the Qt Version. That removes the need to guess at the toolchain
used and makes sure we have a better environment set up.

This also removes the need for BaseQtVersion::qmlToolsEnvironment() which
played the toolchain guessing game.

Change-Id: I4f4b9bb14b3ceb3892652901b459b53fcc4cb1ac
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Tobias Hunger
2017-01-11 14:19:02 +01:00
committed by Tim Jenssen
parent e4e6572661
commit 6871f31b4e
5 changed files with 14 additions and 27 deletions

View File

@@ -118,7 +118,7 @@ ModelManagerInterface::ProjectInfo ModelManager::defaultProjectInfoForProject(
} }
if (projectInfo.tryQmlDump) { if (projectInfo.tryQmlDump) {
QtSupport::QmlDumpTool::pathAndEnvironment(qtVersion, QtSupport::QmlDumpTool::pathAndEnvironment(activeKit,
preferDebugDump, &projectInfo.qmlDumpPath, preferDebugDump, &projectInfo.qmlDumpPath,
&projectInfo.qmlDumpEnvironment); &projectInfo.qmlDumpEnvironment);
projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag(); projectInfo.qmlDumpHasRelocatableFlag = qtVersion->hasQmlDumpWithRelocatableFlag();

View File

@@ -1302,24 +1302,6 @@ bool BaseQtVersion::needsQmlDump() const
return qtVersion() < QtVersionNumber(4, 8, 0); return qtVersion() < QtVersionNumber(4, 8, 0);
} }
Environment BaseQtVersion::qmlToolsEnvironment() const
{
// FIXME: This seems broken!
Environment environment = Environment::systemEnvironment();
#if 0 // FIXME: Fix this!
addToEnvironment(environment);
#endif
// add preferred tool chain, as that is how the tools are built, compare QtVersion::buildDebuggingHelperLibrary
if (!qtAbis().isEmpty()) {
QList<ToolChain *> alltc = ToolChainManager::findToolChains(qtAbis().at(0));
if (!alltc.isEmpty())
alltc.first()->addToEnvironment(environment);
}
return environment;
}
QString BaseQtVersion::qmlDumpTool(bool debugVersion) const QString BaseQtVersion::qmlDumpTool(bool debugVersion) const
{ {
const QString qtInstallBins = qmakeProperty("QT_INSTALL_BINS"); const QString qtInstallBins = qmakeProperty("QT_INSTALL_BINS");

View File

@@ -194,7 +194,6 @@ public:
virtual bool hasQmlDump() const; virtual bool hasQmlDump() const;
virtual bool hasQmlDumpWithRelocatableFlag() const; virtual bool hasQmlDumpWithRelocatableFlag() const;
virtual bool needsQmlDump() const; virtual bool needsQmlDump() const;
Utils::Environment qmlToolsEnvironment() const;
virtual QtConfigWidget *createConfigurationWidget() const; virtual QtConfigWidget *createConfigurationWidget() const;

View File

@@ -24,6 +24,7 @@
****************************************************************************/ ****************************************************************************/
#include "qmldumptool.h" #include "qmldumptool.h"
#include "qtkitinformation.h"
#include "qtsupportconstants.h" #include "qtsupportconstants.h"
#include "qtversionmanager.h" #include "qtversionmanager.h"
@@ -55,7 +56,7 @@ static inline QStringList validPrebuiltFilenames(bool debugBuild)
return list; return list;
} }
QString QmlDumpTool::toolForVersion(BaseQtVersion *version, bool debugDump) QString QmlDumpTool::toolForVersion(const BaseQtVersion *version, bool debugDump)
{ {
if (version) { if (version) {
const QString qtInstallBins = version->qmakeProperty("QT_INSTALL_BINS"); const QString qtInstallBins = version->qmakeProperty("QT_INSTALL_BINS");
@@ -79,9 +80,13 @@ QString QmlDumpTool::toolForQtPaths(const QString &qtInstallBins,
return QString(); return QString();
} }
void QmlDumpTool::pathAndEnvironment(BaseQtVersion *version, void QmlDumpTool::pathAndEnvironment(const ProjectExplorer::Kit *k, bool preferDebug,
bool preferDebug, QString *dumperPath, Utils::Environment *env) QString *dumperPath, Utils::Environment *env)
{ {
if (!k)
return;
const BaseQtVersion *version = QtSupport::QtKitInformation::qtVersion(k);
if (version && !version->hasQmlDump()) if (version && !version->hasQmlDump())
return; return;
@@ -104,7 +109,7 @@ void QmlDumpTool::pathAndEnvironment(BaseQtVersion *version,
if (!path.isEmpty() && version && dumperPath && env) { if (!path.isEmpty() && version && dumperPath && env) {
*dumperPath = path; *dumperPath = path;
*env = version->qmlToolsEnvironment(); k->addToEnvironment(*env);
} }
} }

View File

@@ -29,6 +29,7 @@
#include <utils/buildablehelperlibrary.h> #include <utils/buildablehelperlibrary.h>
namespace ProjectExplorer { class Kit; }
namespace Utils { class Environment; } namespace Utils { class Environment; }
namespace ProjectExplorer { namespace ProjectExplorer {
@@ -42,12 +43,12 @@ class BaseQtVersion;
class QTSUPPORT_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary class QTSUPPORT_EXPORT QmlDumpTool : public Utils::BuildableHelperLibrary
{ {
public: public:
static QString toolForVersion(BaseQtVersion *version, bool debugDump); static QString toolForVersion(const BaseQtVersion *version, bool debugDump);
static QString toolForQtPaths(const QString &qtInstallBins, static QString toolForQtPaths(const QString &qtInstallBins,
bool debugDump); bool debugDump);
static void pathAndEnvironment(BaseQtVersion *version, static void pathAndEnvironment(const ProjectExplorer::Kit *k, bool preferDebug,
bool preferDebug, QString *path, Utils::Environment *env); QString *path, Utils::Environment *env);
}; };
} // namespace } // namespace