forked from qt-creator/qt-creator
Revert "QtSupport: Add support to register Qt versions via qtpaths"
The patch breaks several plugin unit tests; at the very least QtSupport,
AutoTest and ClangCodeModel.
This reverts commit 72aa77ced7.
Change-Id: Iaa7f452d0f43d0072b0bbcf8934fa0dcd6f9b240
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -265,8 +265,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
|
||||
if (log().isDebugEnabled()) {
|
||||
qCDebug(log) << "======= Existing Qt versions =======";
|
||||
for (QtVersion *version : qAsConst(m_versions)) {
|
||||
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
||||
<< "id:" <<version->uniqueId();
|
||||
qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:"<<version->uniqueId();
|
||||
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
||||
qCDebug(log) << "";
|
||||
}
|
||||
@@ -342,8 +341,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
|
||||
if (log().isDebugEnabled()) {
|
||||
qCDebug(log) << "======= Before removing outdated sdk versions =======";
|
||||
for (QtVersion *version : qAsConst(m_versions)) {
|
||||
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
||||
<< "id:" << version->uniqueId();
|
||||
qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId();
|
||||
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
||||
qCDebug(log) << "";
|
||||
}
|
||||
@@ -362,8 +360,7 @@ void QtVersionManager::updateFromInstaller(bool emitSignal)
|
||||
if (log().isDebugEnabled()) {
|
||||
qCDebug(log)<< "======= End result =======";
|
||||
for (QtVersion *version : qAsConst(m_versions)) {
|
||||
qCDebug(log) << version->queryToolFilePath().toUserOutput()
|
||||
<< "id:" << version->uniqueId();
|
||||
qCDebug(log) << version->qmakeFilePath().toUserOutput() << "id:" << version->uniqueId();
|
||||
qCDebug(log) << " autodetection source:" << version->detectionSource();
|
||||
qCDebug(log) << "";
|
||||
}
|
||||
@@ -404,20 +401,14 @@ static QList<QByteArray> runQtChooser(const QString &qtchooser, const QStringLis
|
||||
}
|
||||
|
||||
// Asks qtchooser for the qmake path of a given version
|
||||
// TODO: Extend to qtpaths if qtchooser is also used for Qt 6
|
||||
static QString qmakePath(const QString &qtchooser, const QString &version)
|
||||
{
|
||||
const QList<QByteArray> outputs = runQtChooser(qtchooser,
|
||||
{QStringLiteral("-qt=%1").arg(version),
|
||||
QStringLiteral("-print-env")});
|
||||
// Exemplary output of "qtchooser -qt=qt5-x86_64-linux-gnu -print-env":
|
||||
// QT_SELECT="qt5-x86_64-linux-gnu"
|
||||
// QTTOOLDIR="/usr/lib/qt5/bin"
|
||||
// QTLIBDIR="/usr/lib/x86_64-linux-gnu"
|
||||
const QByteArray qtToolDirPrefix("QTTOOLDIR=\"");
|
||||
for (const QByteArray &output : outputs) {
|
||||
if (output.startsWith(qtToolDirPrefix)) {
|
||||
QByteArray withoutVarName = output.mid(qtToolDirPrefix.size()); // remove QTTOOLDIR="
|
||||
if (output.startsWith("QTTOOLDIR=\"")) {
|
||||
QByteArray withoutVarName = output.mid(11); // remove QTTOOLDIR="
|
||||
withoutVarName.chop(1); // remove trailing quote
|
||||
return QStandardPaths::findExecutable(QStringLiteral("qmake"), QStringList()
|
||||
<< QString::fromLocal8Bit(withoutVarName));
|
||||
@@ -433,15 +424,6 @@ static FilePaths gatherQmakePathsFromQtChooser()
|
||||
return FilePaths();
|
||||
|
||||
const QList<QByteArray> versions = runQtChooser(qtchooser, QStringList("-l"));
|
||||
// Exemplary output of "qtchooser -l":
|
||||
// 4
|
||||
// 5
|
||||
// default
|
||||
// qt4-x86_64-linux-gnu
|
||||
// qt4
|
||||
// qt5-x86_64-linux-gnu
|
||||
// qt5
|
||||
// ""
|
||||
QSet<FilePath> foundQMakes;
|
||||
for (const QByteArray &version : versions) {
|
||||
FilePath possibleQMake = FilePath::fromString(
|
||||
@@ -454,20 +436,19 @@ static FilePaths gatherQmakePathsFromQtChooser()
|
||||
|
||||
static void findSystemQt()
|
||||
{
|
||||
FilePaths systemQueryTools
|
||||
FilePaths systemQMakes
|
||||
= BuildableHelperLibrary::findQtsInEnvironment(Environment::systemEnvironment());
|
||||
systemQueryTools.append(gatherQmakePathsFromQtChooser());
|
||||
for (const FilePath &queryToolPath : qAsConst(systemQueryTools)) {
|
||||
if (BuildableHelperLibrary::isQtChooser(queryToolPath))
|
||||
systemQMakes.append(gatherQmakePathsFromQtChooser());
|
||||
for (const FilePath &qmakePath : qAsConst(systemQMakes)) {
|
||||
if (BuildableHelperLibrary::isQtChooser(qmakePath))
|
||||
continue;
|
||||
const auto isSameQueryTool = [queryToolPath](const QtVersion *version) {
|
||||
const auto isSameQmake = [qmakePath](const QtVersion *version) {
|
||||
return Environment::systemEnvironment().
|
||||
isSameExecutable(queryToolPath.toString(),
|
||||
version->queryToolFilePath().toString());
|
||||
isSameExecutable(qmakePath.toString(), version->qmakeFilePath().toString());
|
||||
};
|
||||
if (contains(m_versions, isSameQueryTool))
|
||||
if (contains(m_versions, isSameQmake))
|
||||
continue;
|
||||
QtVersion *version = QtVersionFactory::createQtVersionFromQueryToolPath(queryToolPath,
|
||||
QtVersion *version = QtVersionFactory::createQtVersionFromQMakePath(qmakePath,
|
||||
false,
|
||||
"PATH");
|
||||
if (version)
|
||||
|
||||
Reference in New Issue
Block a user