forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.0'
Change-Id: Ied609608f6b12aa923c67777bc5a273c4d8fbcbb
This commit is contained in:
@@ -607,6 +607,9 @@ void BuildDirManager::maybeForceReparse()
|
||||
const QByteArray EXTRA_GENERATOR_KEY = "CMAKE_EXTRA_GENERATOR";
|
||||
const QByteArray CMAKE_COMMAND_KEY = "CMAKE_COMMAND";
|
||||
|
||||
const QByteArrayList criticalKeys
|
||||
= QByteArrayList() << GENERATOR_KEY << CMAKE_COMMAND_KEY;
|
||||
|
||||
if (!m_hasData) {
|
||||
forceReparse();
|
||||
return;
|
||||
@@ -614,46 +617,53 @@ void BuildDirManager::maybeForceReparse()
|
||||
|
||||
const CMakeConfig currentConfig = parsedConfiguration();
|
||||
|
||||
const CMakeTool *tool = CMakeKitInformation::cmakeTool(kit());
|
||||
QTC_ASSERT(tool, return); // No cmake... we should not have ended up here in the first place
|
||||
const QString kitGenerator = CMakeGeneratorKitInformation::generator(kit());
|
||||
int pos = kitGenerator.lastIndexOf(QLatin1String(" - "));
|
||||
const QString extraKitGenerator = (pos > 0) ? kitGenerator.left(pos) : QString();
|
||||
const QString mainKitGenerator = (pos > 0) ? kitGenerator.mid(pos + 3) : kitGenerator;
|
||||
CMakeConfig targetConfig = m_buildConfiguration->cmakeConfiguration();
|
||||
targetConfig.append(CMakeConfigItem(GENERATOR_KEY, CMakeConfigItem::INTERNAL,
|
||||
QByteArray(), mainKitGenerator.toUtf8()));
|
||||
QByteArray(), mainKitGenerator.toUtf8()));
|
||||
if (!extraKitGenerator.isEmpty())
|
||||
targetConfig.append(CMakeConfigItem(EXTRA_GENERATOR_KEY, CMakeConfigItem::INTERNAL,
|
||||
QByteArray(), extraKitGenerator.toUtf8()));
|
||||
const CMakeTool *tool = CMakeKitInformation::cmakeTool(kit());
|
||||
if (tool)
|
||||
targetConfig.append(CMakeConfigItem(CMAKE_COMMAND_KEY, CMakeConfigItem::INTERNAL,
|
||||
QByteArray(), tool->cmakeExecutable().toUserOutput().toUtf8()));
|
||||
QByteArray(), extraKitGenerator.toUtf8()));
|
||||
targetConfig.append(CMakeConfigItem(CMAKE_COMMAND_KEY, CMakeConfigItem::INTERNAL,
|
||||
QByteArray(), tool->cmakeExecutable().toUserOutput().toUtf8()));
|
||||
Utils::sort(targetConfig, CMakeConfigItem::sortOperator());
|
||||
|
||||
bool mustReparse = false;
|
||||
auto ccit = currentConfig.constBegin();
|
||||
auto kcit = targetConfig.constBegin();
|
||||
|
||||
while (ccit != currentConfig.constEnd() && kcit != targetConfig.constEnd()) {
|
||||
if (ccit->key == kcit->key) {
|
||||
if (ccit->value != kcit->value)
|
||||
break;
|
||||
if (ccit->value != kcit->value) {
|
||||
if (criticalKeys.contains(kcit->key)) {
|
||||
clearCache();
|
||||
return;
|
||||
}
|
||||
mustReparse = true;
|
||||
}
|
||||
++ccit;
|
||||
++kcit;
|
||||
} else {
|
||||
if (ccit->key < kcit->key)
|
||||
if (ccit->key < kcit->key) {
|
||||
++ccit;
|
||||
else
|
||||
break;
|
||||
} else {
|
||||
++kcit;
|
||||
mustReparse = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (kcit != targetConfig.end()) {
|
||||
if (kcit->key == GENERATOR_KEY
|
||||
|| kcit->key == EXTRA_GENERATOR_KEY
|
||||
|| kcit->key == CMAKE_COMMAND_KEY)
|
||||
clearCache();
|
||||
else
|
||||
forceReparse();
|
||||
}
|
||||
// If we have keys that do not exist yet, then reparse.
|
||||
//
|
||||
// The critical keys *must* be set in cmake configuration, so those were already
|
||||
// handled above.
|
||||
if (mustReparse || kcit != targetConfig.constEnd())
|
||||
forceReparse();
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
|
||||
@@ -105,8 +105,9 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
|
||||
return false;
|
||||
|
||||
const CMakeConfig conf
|
||||
= Utils::transform(map.value(QLatin1String(CONFIGURATION_KEY)).toStringList(),
|
||||
[](const QString &v) { return CMakeConfigItem::fromString(v); });
|
||||
= Utils::filtered(Utils::transform(map.value(QLatin1String(CONFIGURATION_KEY)).toStringList(),
|
||||
[](const QString &v) { return CMakeConfigItem::fromString(v); }),
|
||||
[](const CMakeConfigItem &c) { return !c.isNull(); });
|
||||
|
||||
// Legacy (pre QtC 3.7):
|
||||
const QStringList args = QtcProcess::splitArgs(map.value(QLatin1String(INITIAL_ARGUMENTS)).toString());
|
||||
|
||||
@@ -30,6 +30,7 @@
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
#include <coreplugin/variablechooser.h>
|
||||
#include <projectexplorer/kit.h>
|
||||
#include <projectexplorer/projectexplorerconstants.h>
|
||||
|
||||
@@ -336,7 +337,7 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges()
|
||||
|
||||
QTC_ASSERT(!m_editor, return);
|
||||
|
||||
m_dialog = new QDialog(m_summaryLabel);
|
||||
m_dialog = new QDialog(m_summaryLabel->window());
|
||||
m_dialog->setWindowTitle(tr("Edit CMake Configuration"));
|
||||
QVBoxLayout *layout = new QVBoxLayout(m_dialog);
|
||||
m_editor = new QPlainTextEdit;
|
||||
@@ -344,6 +345,10 @@ void CMakeConfigurationKitConfigWidget::editConfigurationChanges()
|
||||
"separated from the variable value by \"=\".<br>"
|
||||
"You may provide a type hint by adding \":TYPE\" before the \"=\"."));
|
||||
|
||||
auto chooser = new Core::VariableChooser(m_dialog);
|
||||
chooser->addSupportedWidget(m_editor);
|
||||
chooser->addMacroExpanderProvider([this]() { return kit()->macroExpander(); });
|
||||
|
||||
auto buttons = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Apply
|
||||
|QDialogButtonBox::Reset|QDialogButtonBox::Cancel);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user