forked from qt-creator/qt-creator
QtSupport: Move qmake existence check out of *QtVersionFactory::create
Test globally in advance instead. For two factories that means a stricter check on the qmake executable but with qmake being a host tool the additional exists/executable check should be in order. Change-Id: Ib07ef19aeee2d0a19d4c38e178f3e20d22867c2c Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -30,8 +30,6 @@
|
||||
#include <utils/qtcassert.h>
|
||||
#include <proparser/profileevaluator.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace Android {
|
||||
namespace Internal {
|
||||
|
||||
@@ -45,9 +43,6 @@ AndroidQtVersionFactory::AndroidQtVersionFactory(QObject *parent)
|
||||
|
||||
QtSupport::BaseQtVersion *AndroidQtVersionFactory::create(const Utils::FileName &qmakePath, ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
||||
{
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
if (!evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android"))
|
||||
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
|
||||
return nullptr;
|
||||
|
@@ -29,8 +29,6 @@
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
#include <proparser/profileevaluator.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace Ios {
|
||||
namespace Internal {
|
||||
|
||||
|
@@ -26,13 +26,10 @@
|
||||
#include "qnxqtversionfactory.h"
|
||||
|
||||
#include "qnxconstants.h"
|
||||
#include "qnxutils.h"
|
||||
#include "qnxqtversion.h"
|
||||
|
||||
#include <qtsupport/profilereader.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace Qnx;
|
||||
using namespace Qnx::Internal;
|
||||
|
||||
@@ -49,10 +46,6 @@ QtSupport::BaseQtVersion *QnxQtVersionFactory::create(const Utils::FileName &qma
|
||||
bool isAutoDetected,
|
||||
const QString &autoDetectionSource)
|
||||
{
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
|
||||
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
|
||||
return new QnxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
}
|
||||
|
@@ -27,8 +27,6 @@
|
||||
#include "desktopqtversion.h"
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace QtSupport;
|
||||
using namespace QtSupport::Internal;
|
||||
|
||||
@@ -44,8 +42,5 @@ BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||
{
|
||||
Q_UNUSED(evaluator);
|
||||
// we are the fallback :) so we don't care what kind of qt it is
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (fi.exists() && fi.isExecutable() && fi.isFile())
|
||||
return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
return nullptr;
|
||||
return new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
}
|
||||
|
@@ -35,6 +35,8 @@
|
||||
#include <utils/environment.h>
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace QtSupport;
|
||||
using namespace QtSupport::Internal;
|
||||
|
||||
@@ -92,6 +94,10 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
||||
return l->priority() > r->priority();
|
||||
});
|
||||
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
|
||||
foreach (QtVersionFactory *factory, factories) {
|
||||
BaseQtVersion *ver = factory->create(qmakePath, &evaluator, isAutoDetected, autoDetectionSource);
|
||||
if (ver) {
|
||||
|
@@ -48,10 +48,6 @@ QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::Fil
|
||||
{
|
||||
Q_UNUSED(evaluator);
|
||||
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
|
||||
auto version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
|
||||
QList<ProjectExplorer::Abi> abis = version->qtAbis();
|
||||
|
@@ -30,8 +30,6 @@
|
||||
|
||||
#include <proparser/profileevaluator.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
namespace WinRt {
|
||||
namespace Internal {
|
||||
|
||||
@@ -46,10 +44,6 @@ WinRtQtVersionFactory::WinRtQtVersionFactory(QObject *parent)
|
||||
QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||
ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
||||
{
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
|
||||
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||
if (value == QStringLiteral("winrt"))
|
||||
return new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
@@ -71,10 +65,6 @@ WinRtPhoneQtVersionFactory::WinRtPhoneQtVersionFactory(QObject *parent)
|
||||
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||
ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
||||
{
|
||||
QFileInfo fi = qmakePath.toFileInfo();
|
||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||
return nullptr;
|
||||
|
||||
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||
if (value == QStringLiteral("winphone"))
|
||||
return new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||
|
Reference in New Issue
Block a user