forked from qt-creator/qt-creator
ProjectExplorer: Add a central ToolChainFactory::createToolChain(type)
This is meant to be the only function directly creating tool chain objects in the long run (and also the only one setting ids, removing the need to spell them out in the individual constructors). Change-Id: Idef242612a5a3f7012628b4080a03d6ee70e5ba0 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -575,7 +575,7 @@ ProvisioningProfilePtr IosConfigurations::provisioningProfile(const QString &pro
|
|||||||
Utils::equal(&ProvisioningProfile::identifier, profileID));
|
Utils::equal(&ProvisioningProfile::identifier, profileID));
|
||||||
}
|
}
|
||||||
|
|
||||||
static ClangToolChain *createToolChain(const XcodePlatform &platform,
|
static ClangToolChain *createIosToolChain(const XcodePlatform &platform,
|
||||||
const XcodePlatform::ToolchainTarget &target,
|
const XcodePlatform::ToolchainTarget &target,
|
||||||
Core::Id l)
|
Core::Id l)
|
||||||
{
|
{
|
||||||
@@ -616,7 +616,7 @@ QList<ToolChain *> IosToolChainFactory::autoDetect(const QList<ToolChain *> &exi
|
|||||||
existingClangToolChains);
|
existingClangToolChains);
|
||||||
auto createOrAdd = [&](ClangToolChain* toolChain, Core::Id l) {
|
auto createOrAdd = [&](ClangToolChain* toolChain, Core::Id l) {
|
||||||
if (!toolChain) {
|
if (!toolChain) {
|
||||||
toolChain = createToolChain(platform, target, l);
|
toolChain = createIosToolChain(platform, target, l);
|
||||||
existingClangToolChains.append(toolChain);
|
existingClangToolChains.append(toolChain);
|
||||||
}
|
}
|
||||||
toolChains.append(toolChain);
|
toolChains.append(toolChain);
|
||||||
|
@@ -486,6 +486,19 @@ void ToolChainFactory::autoDetectionToMap(QVariantMap &data, bool detected)
|
|||||||
data.insert(QLatin1String(AUTODETECT_KEY), detected);
|
data.insert(QLatin1String(AUTODETECT_KEY), detected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ToolChain *ToolChainFactory::createToolChain(Core::Id toolChainType)
|
||||||
|
{
|
||||||
|
for (ToolChainFactory *factory : qAsConst(Internal::g_toolChainFactories)) {
|
||||||
|
if (factory->m_supportedToolChainType == toolChainType) {
|
||||||
|
if (ToolChain *tc = factory->create()) {
|
||||||
|
tc->d->m_typeId = toolChainType;
|
||||||
|
return tc;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
QSet<Core::Id> ToolChainFactory::supportedLanguages() const
|
QSet<Core::Id> ToolChainFactory::supportedLanguages() const
|
||||||
{
|
{
|
||||||
return m_supportsAllLanguages ? ToolChainManager::allLanguages() : m_supportedLanguages;
|
return m_supportsAllLanguages ? ToolChainManager::allLanguages() : m_supportedLanguages;
|
||||||
|
@@ -206,6 +206,8 @@ public:
|
|||||||
static Core::Id typeIdFromMap(const QVariantMap &data);
|
static Core::Id typeIdFromMap(const QVariantMap &data);
|
||||||
static void autoDetectionToMap(QVariantMap &data, bool detected);
|
static void autoDetectionToMap(QVariantMap &data, bool detected);
|
||||||
|
|
||||||
|
static ToolChain *createToolChain(Core::Id toolChainType);
|
||||||
|
|
||||||
QSet<Core::Id> supportedLanguages() const;
|
QSet<Core::Id> supportedLanguages() const;
|
||||||
|
|
||||||
void setUserCreatable(bool userCreatable);
|
void setUserCreatable(bool userCreatable);
|
||||||
|
Reference in New Issue
Block a user