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 <utils/qtcassert.h>
|
||||||
#include <proparser/profileevaluator.h>
|
#include <proparser/profileevaluator.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
namespace Android {
|
namespace Android {
|
||||||
namespace Internal {
|
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)
|
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"))
|
if (!evaluator->values(QLatin1String("CONFIG")).contains(QLatin1String("android"))
|
||||||
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
|
&& evaluator->value(QLatin1String("QMAKE_PLATFORM")) != QLatin1String("android"))
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
@@ -29,8 +29,6 @@
|
|||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
#include <proparser/profileevaluator.h>
|
#include <proparser/profileevaluator.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
namespace Ios {
|
namespace Ios {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
|
@@ -26,13 +26,10 @@
|
|||||||
#include "qnxqtversionfactory.h"
|
#include "qnxqtversionfactory.h"
|
||||||
|
|
||||||
#include "qnxconstants.h"
|
#include "qnxconstants.h"
|
||||||
#include "qnxutils.h"
|
|
||||||
#include "qnxqtversion.h"
|
#include "qnxqtversion.h"
|
||||||
|
|
||||||
#include <qtsupport/profilereader.h>
|
#include <qtsupport/profilereader.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
using namespace Qnx;
|
using namespace Qnx;
|
||||||
using namespace Qnx::Internal;
|
using namespace Qnx::Internal;
|
||||||
|
|
||||||
@@ -49,10 +46,6 @@ QtSupport::BaseQtVersion *QnxQtVersionFactory::create(const Utils::FileName &qma
|
|||||||
bool isAutoDetected,
|
bool isAutoDetected,
|
||||||
const QString &autoDetectionSource)
|
const QString &autoDetectionSource)
|
||||||
{
|
{
|
||||||
QFileInfo fi = qmakePath.toFileInfo();
|
|
||||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
|
if (evaluator->contains(QLatin1String("QNX_CPUDIR"))) {
|
||||||
return new QnxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
return new QnxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
}
|
}
|
||||||
|
@@ -27,8 +27,6 @@
|
|||||||
#include "desktopqtversion.h"
|
#include "desktopqtversion.h"
|
||||||
#include <qtsupport/qtsupportconstants.h>
|
#include <qtsupport/qtsupportconstants.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
using namespace QtSupport::Internal;
|
using namespace QtSupport::Internal;
|
||||||
|
|
||||||
@@ -44,8 +42,5 @@ BaseQtVersion *DesktopQtVersionFactory::create(const Utils::FileName &qmakePath,
|
|||||||
{
|
{
|
||||||
Q_UNUSED(evaluator);
|
Q_UNUSED(evaluator);
|
||||||
// we are the fallback :) so we don't care what kind of qt it is
|
// 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 new DesktopQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
return nullptr;
|
|
||||||
}
|
}
|
||||||
|
@@ -35,6 +35,8 @@
|
|||||||
#include <utils/environment.h>
|
#include <utils/environment.h>
|
||||||
#include <utils/qtcassert.h>
|
#include <utils/qtcassert.h>
|
||||||
|
|
||||||
|
#include <QFileInfo>
|
||||||
|
|
||||||
using namespace QtSupport;
|
using namespace QtSupport;
|
||||||
using namespace QtSupport::Internal;
|
using namespace QtSupport::Internal;
|
||||||
|
|
||||||
@@ -92,6 +94,10 @@ BaseQtVersion *QtVersionFactory::createQtVersionFromQMakePath(const Utils::FileN
|
|||||||
return l->priority() > r->priority();
|
return l->priority() > r->priority();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
QFileInfo fi = qmakePath.toFileInfo();
|
||||||
|
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
foreach (QtVersionFactory *factory, factories) {
|
foreach (QtVersionFactory *factory, factories) {
|
||||||
BaseQtVersion *ver = factory->create(qmakePath, &evaluator, isAutoDetected, autoDetectionSource);
|
BaseQtVersion *ver = factory->create(qmakePath, &evaluator, isAutoDetected, autoDetectionSource);
|
||||||
if (ver) {
|
if (ver) {
|
||||||
|
@@ -48,10 +48,6 @@ QtSupport::BaseQtVersion *EmbeddedLinuxQtVersionFactory::create(const Utils::Fil
|
|||||||
{
|
{
|
||||||
Q_UNUSED(evaluator);
|
Q_UNUSED(evaluator);
|
||||||
|
|
||||||
QFileInfo fi = qmakePath.toFileInfo();
|
|
||||||
if (!fi.exists() || !fi.isExecutable() || !fi.isFile())
|
|
||||||
return nullptr;
|
|
||||||
|
|
||||||
auto version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
auto version = new EmbeddedLinuxQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
|
|
||||||
QList<ProjectExplorer::Abi> abis = version->qtAbis();
|
QList<ProjectExplorer::Abi> abis = version->qtAbis();
|
||||||
|
@@ -30,8 +30,6 @@
|
|||||||
|
|
||||||
#include <proparser/profileevaluator.h>
|
#include <proparser/profileevaluator.h>
|
||||||
|
|
||||||
#include <QFileInfo>
|
|
||||||
|
|
||||||
namespace WinRt {
|
namespace WinRt {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
@@ -46,10 +44,6 @@ WinRtQtVersionFactory::WinRtQtVersionFactory(QObject *parent)
|
|||||||
QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &qmakePath,
|
QtSupport::BaseQtVersion *WinRtQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||||
ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
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"))) {
|
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||||
if (value == QStringLiteral("winrt"))
|
if (value == QStringLiteral("winrt"))
|
||||||
return new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
return new WinRtQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
@@ -71,10 +65,6 @@ WinRtPhoneQtVersionFactory::WinRtPhoneQtVersionFactory(QObject *parent)
|
|||||||
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(const Utils::FileName &qmakePath,
|
QtSupport::BaseQtVersion *WinRtPhoneQtVersionFactory::create(const Utils::FileName &qmakePath,
|
||||||
ProFileEvaluator *evaluator, bool isAutoDetected, const QString &autoDetectionSource)
|
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"))) {
|
foreach (const QString &value, evaluator->values(QLatin1String("QMAKE_PLATFORM"))) {
|
||||||
if (value == QStringLiteral("winphone"))
|
if (value == QStringLiteral("winphone"))
|
||||||
return new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
return new WinRtPhoneQtVersion(qmakePath, isAutoDetected, autoDetectionSource);
|
||||||
|
Reference in New Issue
Block a user