forked from qt-creator/qt-creator
Use QUuids to identify tool chains
Save/Restore has been updated to reflect this: We now save manual as well as auto-detected tool chains into the user toolChains.xml file. When loading we load the SDK as well as the user toolChains.xml files. We then do a autodetection run. All the tool chains restored that are marked up as auto-detected are then checked again: * the tool chain was autodetected again: Throw away the newly auto- detected tool chain and reuse the saved one. This makes sure we keep the QUuid that is now part of the tool chains id. * the tool chain was not autodetected again: Throw away the saved tool chain. * the tool chain was newly autodetected: Add the new tool chain We keep the old id around in the legacyId() method. It is used when loading old .user files only. So there is no need to implement this method for new tool chains. Task-number: QTCREATORBUG-6702 Change-Id: Ifc0a216e5351a8a57db03615ba329e355e7d5f59 Reviewed-by: Daniel Teske <daniel.teske@nokia.com>
This commit is contained in:
@@ -61,9 +61,7 @@ static const char *const MAEMO_QT_VERSION_KEY = "Qt4ProjectManager.Maemo.QtVersi
|
||||
MaemoToolChain::MaemoToolChain(bool autodetected) :
|
||||
ProjectExplorer::GccToolChain(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID), autodetected),
|
||||
m_qtVersionId(-1)
|
||||
{
|
||||
updateId();
|
||||
}
|
||||
{ }
|
||||
|
||||
MaemoToolChain::MaemoToolChain(const MaemoToolChain &tc) :
|
||||
ProjectExplorer::GccToolChain(tc),
|
||||
@@ -78,11 +76,6 @@ QString MaemoToolChain::typeName() const
|
||||
return MaemoToolChainFactory::tr("Maemo GCC");
|
||||
}
|
||||
|
||||
ProjectExplorer::Abi MaemoToolChain::targetAbi() const
|
||||
{
|
||||
return m_targetAbi;
|
||||
}
|
||||
|
||||
Utils::FileName MaemoToolChain::mkspec() const
|
||||
{
|
||||
return Utils::FileName(); // always use default
|
||||
@@ -90,7 +83,7 @@ Utils::FileName MaemoToolChain::mkspec() const
|
||||
|
||||
bool MaemoToolChain::isValid() const
|
||||
{
|
||||
return GccToolChain::isValid() && m_qtVersionId >= 0 && m_targetAbi.isValid();
|
||||
return GccToolChain::isValid() && m_qtVersionId >= 0 && targetAbi().isValid();
|
||||
}
|
||||
|
||||
bool MaemoToolChain::canClone() const
|
||||
@@ -144,9 +137,9 @@ bool MaemoToolChain::fromMap(const QVariantMap &data)
|
||||
void MaemoToolChain::setQtVersionId(int id)
|
||||
{
|
||||
if (id < 0) {
|
||||
m_targetAbi = ProjectExplorer::Abi();
|
||||
setTargetAbi(ProjectExplorer::Abi());
|
||||
m_qtVersionId = -1;
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
toolChainUpdated();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -157,9 +150,10 @@ void MaemoToolChain::setQtVersionId(int id)
|
||||
Q_ASSERT(version->qtAbis().count() == 1);
|
||||
|
||||
m_qtVersionId = id;
|
||||
m_targetAbi = version->qtAbis().at(0);
|
||||
setTargetAbi(version->qtAbis().at(0));
|
||||
|
||||
toolChainUpdated();
|
||||
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
setDisplayName(MaemoToolChainFactory::tr("Maemo GCC for %1").arg(version->displayName()));
|
||||
}
|
||||
|
||||
@@ -168,10 +162,11 @@ int MaemoToolChain::qtVersionId() const
|
||||
return m_qtVersionId;
|
||||
}
|
||||
|
||||
void MaemoToolChain::updateId()
|
||||
QString MaemoToolChain::legacyId() const
|
||||
{
|
||||
setId(QString::fromLatin1("%1:%2.%3").arg(Constants::MAEMO_TOOLCHAIN_ID)
|
||||
.arg(m_qtVersionId).arg(debuggerCommand().toString()));
|
||||
return QString::fromLatin1("%1:%2.%3").arg(Constants::MAEMO_TOOLCHAIN_ID)
|
||||
.arg(m_qtVersionId)
|
||||
.arg(debuggerCommand().toString());
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
@@ -241,6 +236,21 @@ QList<ProjectExplorer::ToolChain *> MaemoToolChainFactory::autoDetect()
|
||||
return createToolChainList(versionList);
|
||||
}
|
||||
|
||||
bool MaemoToolChainFactory::canRestore(const QVariantMap &data)
|
||||
{
|
||||
return idFromMap(data).startsWith(QLatin1String(Constants::MAEMO_TOOLCHAIN_ID) + QLatin1Char(':'));
|
||||
}
|
||||
|
||||
ProjectExplorer::ToolChain *MaemoToolChainFactory::restore(const QVariantMap &data)
|
||||
{
|
||||
MaemoToolChain *tc = new MaemoToolChain(false);
|
||||
if (tc->fromMap(data))
|
||||
return tc;
|
||||
|
||||
delete tc;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MaemoToolChainFactory::handleQtVersionChanges(const QList<int> &changes)
|
||||
{
|
||||
ProjectExplorer::ToolChainManager *tcm = ProjectExplorer::ToolChainManager::instance();
|
||||
|
@@ -49,7 +49,6 @@ public:
|
||||
~MaemoToolChain();
|
||||
|
||||
QString typeName() const;
|
||||
ProjectExplorer::Abi targetAbi() const;
|
||||
Utils::FileName mkspec() const;
|
||||
|
||||
bool isValid() const;
|
||||
@@ -67,15 +66,14 @@ public:
|
||||
void setQtVersionId(int);
|
||||
int qtVersionId() const;
|
||||
|
||||
private:
|
||||
void updateId();
|
||||
QString legacyId() const;
|
||||
|
||||
private:
|
||||
explicit MaemoToolChain(bool);
|
||||
MaemoToolChain(const MaemoToolChain &);
|
||||
|
||||
int m_qtVersionId;
|
||||
mutable QString m_sysroot;
|
||||
ProjectExplorer::Abi m_targetAbi;
|
||||
|
||||
friend class MaemoToolChainFactory;
|
||||
};
|
||||
@@ -112,6 +110,9 @@ public:
|
||||
|
||||
QList<ProjectExplorer::ToolChain *> autoDetect();
|
||||
|
||||
bool canRestore(const QVariantMap &data);
|
||||
ProjectExplorer::ToolChain *restore(const QVariantMap &data);
|
||||
|
||||
private slots:
|
||||
void handleQtVersionChanges(const QList<int> &);
|
||||
QList<ProjectExplorer::ToolChain *> createToolChainList(const QList<int> &);
|
||||
|
@@ -132,7 +132,6 @@ void AbstractMsvcToolChain::setDebuggerCommand(const Utils::FileName &d)
|
||||
if (m_debuggerCommand == d)
|
||||
return;
|
||||
m_debuggerCommand = d;
|
||||
updateId();
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
|
@@ -68,7 +68,6 @@ public:
|
||||
protected:
|
||||
virtual Utils::Environment readEnvironmentSetting(Utils::Environment& env) const = 0;
|
||||
virtual QByteArray msvcPredefinedMacros(const Utils::Environment& env) const;
|
||||
virtual void updateId() = 0;
|
||||
|
||||
bool generateEnvironmentSettings(Utils::Environment &env,
|
||||
const QString& batchFile,
|
||||
|
@@ -43,6 +43,7 @@
|
||||
|
||||
#include <coreplugin/variablemanager.h>
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QtCore/QProcess>
|
||||
@@ -194,12 +195,13 @@ bool BuildConfiguration::fromMap(const QVariantMap &map)
|
||||
m_stepLists.append(list);
|
||||
}
|
||||
|
||||
QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
|
||||
m_toolChain = ToolChainManager::instance()->findToolChain(id);
|
||||
const QString id = map.value(QLatin1String(TOOLCHAIN_KEY)).toString();
|
||||
setToolChain(ToolChainManager::instance()->findToolChain(id)); // Do not validate the tool chain as
|
||||
// the BC is not completely set up yet!
|
||||
|
||||
// TODO: We currently assume there to be at least a clean and build list!
|
||||
Q_ASSERT(knownStepLists().contains(QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
|
||||
Q_ASSERT(knownStepLists().contains(QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
|
||||
QTC_CHECK(knownStepLists().contains(QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_BUILD)));
|
||||
QTC_CHECK(knownStepLists().contains(QLatin1String(ProjectExplorer::Constants::BUILDSTEPS_CLEAN)));
|
||||
|
||||
return ProjectConfiguration::fromMap(map);
|
||||
}
|
||||
|
@@ -308,13 +308,13 @@ QString GccToolChain::defaultDisplayName() const
|
||||
ProjectExplorer::Abi::toString(m_targetAbi.wordWidth()));
|
||||
}
|
||||
|
||||
void GccToolChain::updateId()
|
||||
QString GccToolChain::legacyId() const
|
||||
{
|
||||
QString i = id();
|
||||
i = i.left(i.indexOf(QLatin1Char(':')));
|
||||
setId(QString::fromLatin1("%1:%2.%3.%4")
|
||||
return QString::fromLatin1("%1:%2.%3.%4")
|
||||
.arg(i).arg(m_compilerPath)
|
||||
.arg(m_targetAbi.toString()).arg(m_debuggerCommand.toString()));
|
||||
.arg(m_targetAbi.toString()).arg(m_debuggerCommand.toString());
|
||||
}
|
||||
|
||||
QString GccToolChain::typeName() const
|
||||
@@ -341,7 +341,6 @@ void GccToolChain::setTargetAbi(const Abi &abi)
|
||||
|
||||
updateSupportedAbis();
|
||||
m_targetAbi = abi;
|
||||
updateId();
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
@@ -389,7 +388,6 @@ void GccToolChain::setDebuggerCommand(const Utils::FileName &d)
|
||||
if (m_debuggerCommand == d)
|
||||
return;
|
||||
m_debuggerCommand = d;
|
||||
updateId();
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
@@ -469,7 +467,7 @@ void GccToolChain::setCompilerPath(const QString &path)
|
||||
if (resetDisplayName)
|
||||
setDisplayName(defaultDisplayName());
|
||||
}
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString GccToolChain::compilerPath() const
|
||||
@@ -511,7 +509,6 @@ bool GccToolChain::fromMap(const QVariantMap &data)
|
||||
m_supportedAbis.append(abi);
|
||||
}
|
||||
m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
|
||||
updateId();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@@ -54,6 +54,8 @@ class LinuxIccToolChainFactory;
|
||||
class PROJECTEXPLORER_EXPORT GccToolChain : public ToolChain
|
||||
{
|
||||
public:
|
||||
QString legacyId() const;
|
||||
|
||||
QString typeName() const;
|
||||
Abi targetAbi() const;
|
||||
QString version() const;
|
||||
@@ -89,8 +91,6 @@ protected:
|
||||
|
||||
QString defaultDisplayName() const;
|
||||
|
||||
void updateId();
|
||||
|
||||
virtual QList<Abi> detectSupportedAbis() const;
|
||||
virtual QString detectVersion() const;
|
||||
|
||||
|
@@ -288,7 +288,6 @@ MsvcToolChain::MsvcToolChain(const QString &name, const Abi &abi,
|
||||
{
|
||||
Q_ASSERT(!name.isEmpty());
|
||||
|
||||
updateId();
|
||||
setDisplayName(name);
|
||||
}
|
||||
|
||||
@@ -306,7 +305,7 @@ MsvcToolChain *MsvcToolChain::readFromMap(const QVariantMap &data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void MsvcToolChain::updateId()
|
||||
QString MsvcToolChain::legacyId() const
|
||||
{
|
||||
const QChar colon = QLatin1Char(':');
|
||||
QString id = QLatin1String(Constants::MSVC_TOOLCHAIN_ID);
|
||||
@@ -316,7 +315,7 @@ void MsvcToolChain::updateId()
|
||||
id += m_varsBatArg;
|
||||
id += colon;
|
||||
id += m_debuggerCommand.toString();
|
||||
setId(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
QString MsvcToolChain::typeName() const
|
||||
@@ -356,7 +355,6 @@ bool MsvcToolChain::fromMap(const QVariantMap &data)
|
||||
m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
|
||||
const QString abiString = data.value(QLatin1String(supportedAbiKeyC)).toString();
|
||||
m_abi = Abi(abiString);
|
||||
updateId();
|
||||
|
||||
return !m_vcvarsBat.isEmpty() && m_abi.isValid();
|
||||
}
|
||||
|
@@ -56,6 +56,7 @@ public:
|
||||
|
||||
MsvcToolChain(const QString &name, const Abi &abi,
|
||||
const QString &varsBat, const QString &varsBatArg, bool autodetect = false);
|
||||
QString legacyId() const;
|
||||
|
||||
static MsvcToolChain *readFromMap(const QVariantMap &data);
|
||||
|
||||
@@ -79,7 +80,6 @@ protected:
|
||||
|
||||
private:
|
||||
MsvcToolChain();
|
||||
void updateId();
|
||||
|
||||
QString m_varsBatArg; // Argument
|
||||
};
|
||||
|
@@ -38,9 +38,11 @@
|
||||
#include <utils/environment.h>
|
||||
|
||||
#include <QtCore/QCoreApplication>
|
||||
#include <QtCore/QUuid>
|
||||
|
||||
static const char ID_KEY[] = "ProjectExplorer.ToolChain.Id";
|
||||
static const char DISPLAY_NAME_KEY[] = "ProjectExplorer.ToolChain.DisplayName";
|
||||
static const char AUTODETECT_KEY[] = "ProjectExplorer.ToolChain.Autodetect";
|
||||
|
||||
namespace ProjectExplorer {
|
||||
namespace Internal {
|
||||
@@ -53,9 +55,22 @@ class ToolChainPrivate
|
||||
{
|
||||
public:
|
||||
ToolChainPrivate(const QString &id, bool autodetect) :
|
||||
m_id(id),
|
||||
m_autodetect(autodetect)
|
||||
{ Q_ASSERT(!id.isEmpty()); }
|
||||
{
|
||||
m_id = createId(id);
|
||||
}
|
||||
|
||||
static QString createId(const QString &id)
|
||||
{
|
||||
QString newId = id;
|
||||
|
||||
QUuid uuid(id.mid(id.indexOf(":") + 1));
|
||||
if (uuid.isNull()) {
|
||||
newId = id.left(id.indexOf(':'));
|
||||
newId.append(QLatin1Char(':') + QUuid::createUuid().toString());
|
||||
}
|
||||
return newId;
|
||||
}
|
||||
|
||||
QString m_id;
|
||||
bool m_autodetect;
|
||||
@@ -141,7 +156,11 @@ bool ToolChain::operator == (const ToolChain &tc) const
|
||||
if (this == &tc)
|
||||
return true;
|
||||
|
||||
return id() == tc.id();
|
||||
const QString thisId = id().left(id().indexOf(QLatin1Char(':')));
|
||||
const QString tcId = tc.id().left(tc.id().indexOf(QLatin1Char(':')));
|
||||
|
||||
// We ignore displayname
|
||||
return thisId == tcId && isAutoDetected() == tc.isAutoDetected();
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -153,25 +172,13 @@ bool ToolChain::operator == (const ToolChain &tc) const
|
||||
QVariantMap ToolChain::toMap() const
|
||||
{
|
||||
QVariantMap result;
|
||||
if (isAutoDetected())
|
||||
return result;
|
||||
|
||||
result.insert(QLatin1String(ID_KEY), id());
|
||||
result.insert(QLatin1String(DISPLAY_NAME_KEY), displayName());
|
||||
result.insert(QLatin1String(AUTODETECT_KEY), isAutoDetected());
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
void ToolChain::setId(const QString &id)
|
||||
{
|
||||
Q_ASSERT(!id.isEmpty());
|
||||
if (d->m_id == id)
|
||||
return;
|
||||
|
||||
d->m_id = id;
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
void ToolChain::toolChainUpdated()
|
||||
{
|
||||
ToolChainManager::instance()->notifyAboutUpdate(this);
|
||||
@@ -193,9 +200,10 @@ void ToolChain::setAutoDetected(bool autodetect)
|
||||
|
||||
bool ToolChain::fromMap(const QVariantMap &data)
|
||||
{
|
||||
Q_ASSERT(!isAutoDetected());
|
||||
// do not read the id: That is already set anyway.
|
||||
d->m_displayName = data.value(QLatin1String(DISPLAY_NAME_KEY)).toString();
|
||||
// make sure we have new style ids:
|
||||
d->m_id = Internal::ToolChainPrivate::createId(data.value(QLatin1String(ID_KEY)).toString());
|
||||
d->m_autodetect = data.value(QLatin1String(AUTODETECT_KEY), false).toBool();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@@ -72,6 +72,8 @@ public:
|
||||
|
||||
bool isAutoDetected() const;
|
||||
QString id() const;
|
||||
// No need to implement this for new tool chains:
|
||||
virtual QString legacyId() const { return QString(); }
|
||||
|
||||
virtual QString typeName() const = 0;
|
||||
virtual Abi targetAbi() const = 0;
|
||||
@@ -105,8 +107,6 @@ protected:
|
||||
ToolChain(const QString &id, bool autoDetect);
|
||||
explicit ToolChain(const ToolChain &);
|
||||
|
||||
void setId(const QString &id);
|
||||
|
||||
void toolChainUpdated();
|
||||
|
||||
// Make sure to call this method when deriving!
|
||||
|
@@ -110,22 +110,61 @@ ToolChainManager::ToolChainManager(QObject *parent) :
|
||||
|
||||
void ToolChainManager::restoreToolChains()
|
||||
{
|
||||
// Restore SDK settings first
|
||||
QList<ToolChain *> tcsToRegister;
|
||||
QList<ToolChain *> tcsToCheck;
|
||||
|
||||
// read all tool chains from SDK
|
||||
QFileInfo systemSettingsFile(Core::ICore::settings(QSettings::SystemScope)->fileName());
|
||||
restoreToolChains(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME), true);
|
||||
QList<ToolChain *> readTcs =
|
||||
restoreToolChains(systemSettingsFile.absolutePath() + QLatin1String(TOOLCHAIN_FILENAME));
|
||||
// make sure we mark these as autodetected!
|
||||
foreach (ToolChain *tc, readTcs)
|
||||
tc->setAutoDetected(true);
|
||||
|
||||
tcsToRegister = readTcs; // SDK TCs are always considered to be up-to-date, so no need to
|
||||
// recheck them.
|
||||
|
||||
// read all tool chains from user file
|
||||
readTcs = restoreToolChains(settingsFileName());
|
||||
|
||||
foreach (ToolChain *tc, readTcs) {
|
||||
if (tc->isAutoDetected())
|
||||
tcsToCheck.append(tc);
|
||||
else
|
||||
tcsToRegister.append(tc);
|
||||
}
|
||||
readTcs.clear();
|
||||
|
||||
// Then auto detect
|
||||
QList<ToolChain *> detectedTcs;
|
||||
ExtensionSystem::PluginManager *pm = ExtensionSystem::PluginManager::instance();
|
||||
QList<ToolChainFactory *> factories = pm->getObjects<ToolChainFactory>();
|
||||
// Autodetect tool chains:
|
||||
foreach (ToolChainFactory *f, factories) {
|
||||
QList<ToolChain *> tcs = f->autoDetect();
|
||||
foreach (ToolChain *tc, tcs)
|
||||
registerToolChain(tc);
|
||||
foreach (ToolChainFactory *f, factories)
|
||||
detectedTcs.append(f->autoDetect());
|
||||
|
||||
// Find/update autodetected tool chains:
|
||||
ToolChain *toStore = 0;
|
||||
foreach (ToolChain *currentDetected, detectedTcs) {
|
||||
toStore = currentDetected;
|
||||
|
||||
// Check whether we had this TC stored and prefer the old one with the old id:
|
||||
for (int i = 0; i < tcsToCheck.count(); ++i) {
|
||||
if (*(tcsToCheck.at(i)) == *currentDetected) {
|
||||
toStore = tcsToCheck.at(i);
|
||||
tcsToCheck.removeAt(i);
|
||||
delete currentDetected;
|
||||
break;
|
||||
}
|
||||
}
|
||||
registerToolChain(toStore);
|
||||
}
|
||||
|
||||
// Then restore user settings
|
||||
restoreToolChains(settingsFileName(), false);
|
||||
// Delete all loaded autodetected tool chains that were not rediscovered:
|
||||
qDeleteAll(tcsToCheck);
|
||||
|
||||
// Store manual tool chains
|
||||
foreach (ToolChain *tc, tcsToRegister)
|
||||
registerToolChain(tc);
|
||||
}
|
||||
|
||||
ToolChainManager::~ToolChainManager()
|
||||
@@ -146,7 +185,7 @@ void ToolChainManager::saveToolChains()
|
||||
|
||||
int count = 0;
|
||||
foreach (ToolChain *tc, d->m_toolChains) {
|
||||
if (!tc->isAutoDetected() && tc->isValid()) {
|
||||
if (tc->isValid()) {
|
||||
QVariantMap tmp = tc->toMap();
|
||||
if (tmp.isEmpty())
|
||||
continue;
|
||||
@@ -160,17 +199,19 @@ void ToolChainManager::saveToolChains()
|
||||
// Do not save default debuggers! Those are set by the SDK!
|
||||
}
|
||||
|
||||
void ToolChainManager::restoreToolChains(const QString &fileName, bool autoDetected)
|
||||
QList<ToolChain *> ToolChainManager::restoreToolChains(const QString &fileName)
|
||||
{
|
||||
QList<ToolChain *> result;
|
||||
|
||||
PersistentSettingsReader reader;
|
||||
if (!reader.load(fileName))
|
||||
return;
|
||||
return result;
|
||||
QVariantMap data = reader.restoreValues();
|
||||
|
||||
// Check version:
|
||||
int version = data.value(QLatin1String(TOOLCHAIN_FILE_VERSION_KEY), 0).toInt();
|
||||
if (version < 1)
|
||||
return;
|
||||
return result;
|
||||
|
||||
// Read default debugger settings (if any)
|
||||
int count = data.value(QLatin1String(DEFAULT_DEBUGGER_COUNT_KEY)).toInt();
|
||||
@@ -200,19 +241,18 @@ void ToolChainManager::restoreToolChains(const QString &fileName, bool autoDetec
|
||||
foreach (ToolChainFactory *f, factories) {
|
||||
if (f->canRestore(tcMap)) {
|
||||
if (ToolChain *tc = f->restore(tcMap)) {
|
||||
tc->setAutoDetected(autoDetected);
|
||||
|
||||
registerToolChain(tc);
|
||||
result.append(tc);
|
||||
restored = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!restored)
|
||||
qWarning("Warning: Unable to restore manual tool chain '%s' stored in %s.",
|
||||
qWarning("Warning: Unable to restore tool chain '%s' stored in %s.",
|
||||
qPrintable(ToolChainFactory::idFromMap(tcMap)),
|
||||
qPrintable(QDir::toNativeSeparators(fileName)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
QList<ToolChain *> ToolChainManager::toolChains() const
|
||||
@@ -233,8 +273,11 @@ QList<ToolChain *> ToolChainManager::findToolChains(const Abi &abi) const
|
||||
|
||||
ToolChain *ToolChainManager::findToolChain(const QString &id) const
|
||||
{
|
||||
if (id.isEmpty())
|
||||
return 0;
|
||||
|
||||
foreach (ToolChain *tc, d->m_toolChains) {
|
||||
if (tc->id() == id)
|
||||
if (tc->id() == id || (!tc->legacyId().isEmpty() && tc->legacyId() == id))
|
||||
return tc;
|
||||
}
|
||||
return 0;
|
||||
|
@@ -90,7 +90,7 @@ private:
|
||||
// Make sure the this is only called after all
|
||||
// Tool chain Factories are registered!
|
||||
void restoreToolChains();
|
||||
void restoreToolChains(const QString &fileName, bool autoDetected = false);
|
||||
QList<ToolChain *> restoreToolChains(const QString &fileName);
|
||||
|
||||
void notifyAboutUpdate(ProjectExplorer::ToolChain *);
|
||||
|
||||
|
@@ -261,7 +261,6 @@ WinCEToolChain::WinCEToolChain(const QString &name,
|
||||
Q_ASSERT(!m_includePath.isEmpty());
|
||||
Q_ASSERT(!m_libPath.isEmpty());
|
||||
|
||||
updateId();
|
||||
setDisplayName(name);
|
||||
}
|
||||
|
||||
@@ -279,7 +278,7 @@ WinCEToolChain *WinCEToolChain::readFromMap(const QVariantMap &data)
|
||||
return 0;
|
||||
}
|
||||
|
||||
void WinCEToolChain::updateId()
|
||||
QString WinCEToolChain::legacyId() const
|
||||
{
|
||||
const QChar colon = QLatin1Char(':');
|
||||
QString id = QLatin1String(Constants::WINCE_TOOLCHAIN_ID);
|
||||
@@ -293,7 +292,7 @@ void WinCEToolChain::updateId()
|
||||
id += m_libPath;
|
||||
id += colon;
|
||||
id += m_debuggerCommand.toString();
|
||||
setId(id);
|
||||
return id;
|
||||
}
|
||||
|
||||
QString WinCEToolChain::typeName() const
|
||||
@@ -355,7 +354,6 @@ bool WinCEToolChain::fromMap(const QVariantMap &data)
|
||||
m_debuggerCommand = Utils::FileName::fromString(data.value(QLatin1String(debuggerCommandKeyC)).toString());
|
||||
const QString abiString = data.value(QLatin1String(supportedAbiKeyC)).toString();
|
||||
m_abi = Abi(abiString);
|
||||
updateId();
|
||||
|
||||
return isValid();
|
||||
}
|
||||
|
@@ -57,6 +57,8 @@ public:
|
||||
const QString &libPath,
|
||||
bool autodetect = false);
|
||||
|
||||
QString legacyId() const;
|
||||
|
||||
static WinCEToolChain *readFromMap(const QVariantMap &data);
|
||||
|
||||
QString typeName() const;
|
||||
@@ -79,7 +81,6 @@ protected:
|
||||
|
||||
private:
|
||||
WinCEToolChain();
|
||||
void updateId();
|
||||
|
||||
QString m_msvcVer;
|
||||
QString m_ceVer;
|
||||
|
@@ -91,19 +91,6 @@ static Utils::Environment baseEnvironment(RvctToolChain *tc)
|
||||
return result;
|
||||
}
|
||||
|
||||
static QString toString(const RvctToolChain::ArmVersion &v)
|
||||
{
|
||||
switch (v)
|
||||
{
|
||||
case RvctToolChain::ARMv5:
|
||||
return QString::fromAscii("armv5");
|
||||
case RvctToolChain::ARMv6:
|
||||
return QString::fromAscii("armv6");
|
||||
default:
|
||||
return QString::fromAscii("unknown");
|
||||
}
|
||||
}
|
||||
|
||||
// ==========================================================================
|
||||
// RvctToolChain
|
||||
// ==========================================================================
|
||||
@@ -284,7 +271,7 @@ void RvctToolChain::setCompilerPath(const QString &path)
|
||||
|
||||
m_compilerPath = path;
|
||||
m_version.reset();
|
||||
updateId(); // Will trigger toolChainUpdated()!
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString RvctToolChain::compilerPath() const
|
||||
@@ -365,11 +352,11 @@ bool RvctToolChain::fromMap(const QVariantMap &data)
|
||||
return isValid();
|
||||
}
|
||||
|
||||
void RvctToolChain::updateId()
|
||||
QString RvctToolChain::legacyId() const
|
||||
{
|
||||
const QChar dot = QLatin1Char('.');
|
||||
setId(QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':')
|
||||
+ m_compilerPath + dot + toString(m_armVersion) + dot + m_debuggerCommand.toString());
|
||||
return QLatin1String(Constants::RVCT_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath + dot
|
||||
+ armVersionString(m_armVersion) + dot + m_debuggerCommand.toString();
|
||||
}
|
||||
|
||||
QString RvctToolChain::varName(const QString &postFix) const
|
||||
|
@@ -84,6 +84,8 @@ public:
|
||||
QString typeName() const;
|
||||
ProjectExplorer::Abi targetAbi() const;
|
||||
|
||||
QString legacyId() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
QByteArray predefinedMacros() const;
|
||||
@@ -115,7 +117,6 @@ public:
|
||||
bool fromMap(const QVariantMap &data);
|
||||
|
||||
private:
|
||||
void updateId();
|
||||
void setVersion(const RvctVersion &v) const;
|
||||
|
||||
explicit RvctToolChain(bool autodetected = false);
|
||||
|
@@ -147,6 +147,11 @@ ProjectExplorer::Abi WinscwToolChain::targetAbi() const
|
||||
ProjectExplorer::Abi::ElfFormat, 32);
|
||||
}
|
||||
|
||||
QString WinscwToolChain::legacyId() const
|
||||
{
|
||||
return QLatin1String(Constants::WINSCW_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath;
|
||||
}
|
||||
|
||||
bool WinscwToolChain::isValid() const
|
||||
{
|
||||
if (m_compilerPath.isEmpty())
|
||||
@@ -286,7 +291,7 @@ void WinscwToolChain::setCompilerPath(const QString &path)
|
||||
return;
|
||||
|
||||
m_compilerPath = path;
|
||||
updateId(); // Will trigger topolChainUpdated()!
|
||||
toolChainUpdated();
|
||||
}
|
||||
|
||||
QString WinscwToolChain::compilerPath() const
|
||||
@@ -294,11 +299,6 @@ QString WinscwToolChain::compilerPath() const
|
||||
return m_compilerPath;
|
||||
}
|
||||
|
||||
void WinscwToolChain::updateId()
|
||||
{
|
||||
setId(QLatin1String(Constants::WINSCW_TOOLCHAIN_ID) + QLatin1Char(':') + m_compilerPath);
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
// ToolChainConfigWidget
|
||||
// --------------------------------------------------------------------------
|
||||
|
@@ -54,6 +54,7 @@ public:
|
||||
|
||||
QString typeName() const;
|
||||
ProjectExplorer::Abi targetAbi() const;
|
||||
QString legacyId() const;
|
||||
|
||||
bool isValid() const;
|
||||
|
||||
@@ -84,8 +85,6 @@ public:
|
||||
QString compilerPath() const;
|
||||
|
||||
private:
|
||||
void updateId();
|
||||
|
||||
explicit WinscwToolChain(bool);
|
||||
|
||||
QStringList m_systemIncludePathes;
|
||||
|
@@ -133,7 +133,6 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
m_shadowBuild = map.value(QLatin1String(USE_SHADOW_BUILD_KEY), true).toBool();
|
||||
m_qtVersionId = map.value(QLatin1String(QT_VERSION_ID_KEY)).toInt();
|
||||
ProjectExplorer::ToolChain *tc = toolChain();
|
||||
m_qmakeBuildConfiguration = QtSupport::BaseQtVersion::QmakeBuildConfigs(map.value(QLatin1String(BUILD_CONFIGURATION_KEY)).toInt());
|
||||
m_buildDirectory = map.value(QLatin1String(BUILD_DIRECTORY_KEY), defaultShadowBuildDirectory()).toString();
|
||||
|
||||
@@ -160,6 +159,7 @@ bool Qt4BuildConfiguration::fromMap(const QVariantMap &map)
|
||||
|
||||
m_lastEmmitedBuildDirectory = buildDirectory();
|
||||
|
||||
ProjectExplorer::ToolChain *tc = toolChain();
|
||||
if (version && version->isValid()) {
|
||||
if (tc && !qt4Target()->possibleToolChains(this).contains(tc))
|
||||
setToolChain(0);
|
||||
@@ -377,7 +377,7 @@ void Qt4BuildConfiguration::setQtVersion(QtSupport::BaseQtVersion *version)
|
||||
|
||||
void Qt4BuildConfiguration::setToolChain(ProjectExplorer::ToolChain *tc)
|
||||
{
|
||||
if (tc != 0 && !qt4Target()->possibleToolChains(this).contains(tc))
|
||||
if (tc != 0 && m_qtVersionId > 0 && !qt4Target()->possibleToolChains(this).contains(tc))
|
||||
return;
|
||||
|
||||
if (toolChain() == tc)
|
||||
|
Reference in New Issue
Block a user