forked from qt-creator/qt-creator
Merge remote-tracking branch 'origin/4.15'
Conflicts: src/plugins/cmakeprojectmanager/cmakebuildsystem.cpp src/plugins/ios/iosprobe.cpp src/plugins/mcusupport/mcusupportsdk.cpp Change-Id: I6c2136b576c44fc35def397191db97069599f183
This commit is contained in:
@@ -286,6 +286,10 @@ void CMakeBuildSystem::triggerParsing()
|
||||
reparseParameters |= REPARSE_FORCE_CMAKE_RUN | REPARSE_FORCE_EXTRA_CONFIGURATION;
|
||||
}
|
||||
|
||||
// The code model will be updated after the CMake run. There is no need to have an
|
||||
// active code model updater when the next one will be triggered.
|
||||
m_cppCodeModelUpdater->cancel();
|
||||
|
||||
qCDebug(cmakeBuildSystemLog) << "Asking reader to parse";
|
||||
m_reader.parse(reparseParameters & REPARSE_FORCE_CMAKE_RUN,
|
||||
reparseParameters & REPARSE_FORCE_INITIAL_CONFIGURATION,
|
||||
@@ -370,27 +374,6 @@ QString CMakeBuildSystem::reparseParametersString(int reparseFlags)
|
||||
return result.trimmed();
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::writeConfigurationIntoBuildDirectory()
|
||||
{
|
||||
const MacroExpander *expander = cmakeBuildConfiguration()->macroExpander();
|
||||
const FilePath buildDir = workDirectory(m_parameters);
|
||||
QTC_ASSERT(buildDir.exists(), return );
|
||||
|
||||
const FilePath settingsFile = buildDir.pathAppended("qtcsettings.cmake");
|
||||
|
||||
QByteArray contents;
|
||||
contents.append("# This file is managed by Qt Creator, do not edit!\n\n");
|
||||
contents.append(
|
||||
transform(cmakeBuildConfiguration()->configurationChanges(),
|
||||
[expander](const CMakeConfigItem &item) { return item.toCMakeSetLine(expander); })
|
||||
.join('\n')
|
||||
.toUtf8());
|
||||
|
||||
QFile file(settingsFile.toString());
|
||||
QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return );
|
||||
file.write(contents);
|
||||
}
|
||||
|
||||
void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters ¶meters,
|
||||
const int reparseParameters)
|
||||
{
|
||||
@@ -424,8 +407,6 @@ void CMakeBuildSystem::setParametersAndRequestParse(const BuildDirParameters &pa
|
||||
|
||||
m_reader.setParameters(m_parameters);
|
||||
|
||||
writeConfigurationIntoBuildDirectory();
|
||||
|
||||
if (reparseParameters & REPARSE_URGENT) {
|
||||
qCDebug(cmakeBuildSystemLog) << "calling requestReparse";
|
||||
requestParse();
|
||||
|
@@ -158,8 +158,6 @@ private:
|
||||
|
||||
void runCTest();
|
||||
|
||||
void writeConfigurationIntoBuildDirectory();
|
||||
|
||||
ProjectExplorer::TreeScanner m_treeScanner;
|
||||
QHash<QString, bool> m_mimeBinaryCache;
|
||||
QList<const ProjectExplorer::FileNode *> m_allFiles;
|
||||
|
@@ -200,7 +200,7 @@ QString CMakeConfigItem::expandedValue(const ProjectExplorer::Kit *k) const
|
||||
|
||||
QString CMakeConfigItem::expandedValue(const Utils::MacroExpander *expander) const
|
||||
{
|
||||
return expander->expand(QString::fromUtf8(value));
|
||||
return expander ? expander->expand(QString::fromUtf8(value)) : QString::fromUtf8(value);
|
||||
}
|
||||
|
||||
std::function<bool (const CMakeConfigItem &a, const CMakeConfigItem &b)> CMakeConfigItem::sortOperator()
|
||||
|
@@ -870,7 +870,9 @@ static QStringList uniqueTargetFiles(const Configuration &config)
|
||||
return files;
|
||||
}
|
||||
|
||||
FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QString &cmakeBuildType,
|
||||
FileApiData FileApiParser::parseData(QFutureInterface<std::shared_ptr<FileApiQtcData>> &fi,
|
||||
const QFileInfo &replyFileInfo,
|
||||
const QString &cmakeBuildType,
|
||||
QString &errorMessage)
|
||||
{
|
||||
QTC_CHECK(errorMessage.isEmpty());
|
||||
@@ -878,16 +880,29 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri
|
||||
|
||||
FileApiData result;
|
||||
|
||||
const auto cancelCheck = [&fi, &errorMessage]() -> bool {
|
||||
if (fi.isCanceled()) {
|
||||
errorMessage = FileApiParser::tr("CMake parsing was cancelled.");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
result.replyFile = readReplyFile(replyFileInfo, errorMessage);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
result.cache = readCacheFile(result.replyFile.jsonFile("cache", replyDir), errorMessage);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
result.cmakeFiles = readCMakeFilesFile(result.replyFile.jsonFile("cmakeFiles", replyDir),
|
||||
errorMessage);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
auto codeModels = readCodemodelFile(result.replyFile.jsonFile("codemodel", replyDir),
|
||||
errorMessage);
|
||||
|
||||
if (codeModels.size() == 0) {
|
||||
errorMessage = "No CMake configuration found!";
|
||||
qWarning() << errorMessage;
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -911,14 +926,17 @@ FileApiData FileApiParser::parseData(const QFileInfo &replyFileInfo, const QStri
|
||||
.arg(cmakeBuildType)
|
||||
.arg(buildTypes.join(", "));
|
||||
}
|
||||
qWarning() << errorMessage;
|
||||
return result;
|
||||
}
|
||||
result.codemodel = std::move(*it);
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
|
||||
const QStringList targetFiles = uniqueTargetFiles(result.codemodel);
|
||||
|
||||
for (const QString &targetFile : targetFiles) {
|
||||
if (cancelCheck())
|
||||
return {};
|
||||
QString targetErrorMessage;
|
||||
TargetDetails td = readTargetFile(replyDir.absoluteFilePath(targetFile), targetErrorMessage);
|
||||
if (targetErrorMessage.isEmpty()) {
|
||||
|
@@ -27,6 +27,8 @@
|
||||
|
||||
#include "cmakeconfigitem.h"
|
||||
|
||||
#include "fileapidataextractor.h"
|
||||
|
||||
#include <projectexplorer/headerpath.h>
|
||||
#include <projectexplorer/projectmacro.h>
|
||||
|
||||
@@ -34,6 +36,7 @@
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFutureInterface>
|
||||
#include <QString>
|
||||
#include <QVector>
|
||||
|
||||
@@ -247,7 +250,9 @@ class FileApiParser
|
||||
{
|
||||
Q_DECLARE_TR_FUNCTIONS(FileApiParser)
|
||||
public:
|
||||
static FileApiData parseData(const QFileInfo &replyFileInfo, const QString& cmakeBuildType,
|
||||
static FileApiData parseData(QFutureInterface<std::shared_ptr<FileApiQtcData>> &fi,
|
||||
const QFileInfo &replyFileInfo,
|
||||
const QString &cmakeBuildType,
|
||||
QString &errorMessage);
|
||||
|
||||
static bool setupCMakeFileApi(const Utils::FilePath &buildDirectory,
|
||||
|
@@ -265,11 +265,14 @@ void FileApiReader::endState(const QFileInfo &replyFi)
|
||||
m_lastReplyTimestamp = replyFi.lastModified();
|
||||
|
||||
m_future = runAsync(ProjectExplorerPlugin::sharedThreadPool(),
|
||||
[replyFi, sourceDirectory, buildDirectory, topCmakeFile, cmakeBuildType]() {
|
||||
[replyFi, sourceDirectory, buildDirectory, topCmakeFile, cmakeBuildType](
|
||||
QFutureInterface<std::shared_ptr<FileApiQtcData>> &fi) {
|
||||
auto result = std::make_shared<FileApiQtcData>();
|
||||
FileApiData data = FileApiParser::parseData(replyFi, cmakeBuildType, result->errorMessage);
|
||||
FileApiData data = FileApiParser::parseData(fi,
|
||||
replyFi,
|
||||
cmakeBuildType,
|
||||
result->errorMessage);
|
||||
if (!result->errorMessage.isEmpty()) {
|
||||
qWarning() << result->errorMessage;
|
||||
*result = generateFallbackData(topCmakeFile,
|
||||
sourceDirectory,
|
||||
buildDirectory,
|
||||
@@ -281,7 +284,7 @@ void FileApiReader::endState(const QFileInfo &replyFi)
|
||||
qWarning() << result->errorMessage;
|
||||
}
|
||||
|
||||
return result;
|
||||
fi.reportResult(result);
|
||||
});
|
||||
onResultReady(m_future.value(),
|
||||
this,
|
||||
@@ -336,6 +339,28 @@ void FileApiReader::makeBackupConfiguration(bool store)
|
||||
|
||||
}
|
||||
|
||||
void FileApiReader::writeConfigurationIntoBuildDirectory(const QStringList &configurationArguments)
|
||||
{
|
||||
const FilePath buildDir = m_parameters.workDirectory;
|
||||
QTC_ASSERT(buildDir.exists(), return );
|
||||
|
||||
const FilePath settingsFile = buildDir.pathAppended("qtcsettings.cmake");
|
||||
|
||||
QByteArray contents;
|
||||
contents.append("# This file is managed by Qt Creator, do not edit!\n\n");
|
||||
contents.append(
|
||||
transform(CMakeConfigItem::itemsFromArguments(configurationArguments),
|
||||
[](const CMakeConfigItem &item) {
|
||||
return item.toCMakeSetLine(nullptr);
|
||||
})
|
||||
.join('\n')
|
||||
.toUtf8());
|
||||
|
||||
QFile file(settingsFile.toString());
|
||||
QTC_ASSERT(file.open(QFile::WriteOnly | QFile::Truncate), return );
|
||||
file.write(contents);
|
||||
}
|
||||
|
||||
void FileApiReader::startCMakeState(const QStringList &configurationArguments)
|
||||
{
|
||||
qCDebug(cmakeFileApiMode) << "FileApiReader: START CMAKE STATE.";
|
||||
@@ -347,6 +372,7 @@ void FileApiReader::startCMakeState(const QStringList &configurationArguments)
|
||||
|
||||
qCDebug(cmakeFileApiMode) << ">>>>>> Running cmake with arguments:" << configurationArguments;
|
||||
makeBackupConfiguration(true);
|
||||
writeConfigurationIntoBuildDirectory(configurationArguments);
|
||||
m_cmakeProcess->run(m_parameters, configurationArguments);
|
||||
}
|
||||
|
||||
|
@@ -93,6 +93,8 @@ private:
|
||||
void replyDirectoryHasChanged(const QString &directory) const;
|
||||
void makeBackupConfiguration(bool store);
|
||||
|
||||
void writeConfigurationIntoBuildDirectory(const QStringList &configuration);
|
||||
|
||||
std::unique_ptr<CMakeProcess> m_cmakeProcess;
|
||||
|
||||
// cmake data:
|
||||
|
@@ -86,6 +86,42 @@ bool FancyToolButton::event(QEvent *e)
|
||||
return QToolButton::event(e);
|
||||
}
|
||||
|
||||
static int findSplitPos(const QString &text, const QFontMetrics &fontMetrics, qreal availableWidth)
|
||||
{
|
||||
if (text.length() == 0)
|
||||
return -1;
|
||||
int splitPos = -1;
|
||||
int lastWhiteSpace;
|
||||
int firstWhiteSpace = text.length();
|
||||
do {
|
||||
// search backwards for ranges of whitespaces
|
||||
// search first whitespace (backwards)
|
||||
lastWhiteSpace = firstWhiteSpace - 1; // start before last blob (or at end of text)
|
||||
while (lastWhiteSpace >= 0) {
|
||||
if (text.at(lastWhiteSpace).isSpace())
|
||||
break;
|
||||
--lastWhiteSpace;
|
||||
}
|
||||
// search last whitespace (backwards)
|
||||
firstWhiteSpace = lastWhiteSpace;
|
||||
while (firstWhiteSpace > 0) {
|
||||
if (!text.at(firstWhiteSpace - 1).isSpace())
|
||||
break;
|
||||
--firstWhiteSpace;
|
||||
}
|
||||
// if the text after the whitespace range fits into the available width, that's a great
|
||||
// position for splitting, but look if we can fit more
|
||||
if (firstWhiteSpace != -1) {
|
||||
if (fontMetrics.horizontalAdvance(text.mid(lastWhiteSpace + 1)) <= availableWidth)
|
||||
splitPos = lastWhiteSpace + 1;
|
||||
else
|
||||
break;
|
||||
}
|
||||
} while (firstWhiteSpace > 0
|
||||
&& fontMetrics.horizontalAdvance(text.left(firstWhiteSpace)) > availableWidth);
|
||||
return splitPos;
|
||||
}
|
||||
|
||||
static QVector<QString> splitInTwoLines(const QString &text,
|
||||
const QFontMetrics &fontMetrics,
|
||||
qreal availableWidth)
|
||||
@@ -95,21 +131,7 @@ static QVector<QString> splitInTwoLines(const QString &text,
|
||||
// to put them in the second line. First line is drawn with ellipsis,
|
||||
// second line gets ellipsis if it couldn't split off full words.
|
||||
QVector<QString> splitLines(2);
|
||||
const QRegularExpression rx(QLatin1String("\\s+"));
|
||||
int splitPos = -1;
|
||||
int nextSplitPos = text.length();
|
||||
do {
|
||||
int offset = nextSplitPos - text.length() - 1;
|
||||
nextSplitPos = text.lastIndexOf(rx, offset);
|
||||
if (nextSplitPos != -1) {
|
||||
const QRegularExpressionMatch match = rx.match(text, offset);
|
||||
int splitCandidate = nextSplitPos + match.capturedLength();
|
||||
if (fontMetrics.horizontalAdvance(text.mid(splitCandidate)) <= availableWidth)
|
||||
splitPos = splitCandidate;
|
||||
else
|
||||
break;
|
||||
}
|
||||
} while (nextSplitPos > 0 && fontMetrics.horizontalAdvance(text.left(nextSplitPos)) > availableWidth);
|
||||
const int splitPos = findSplitPos(text, fontMetrics, availableWidth);
|
||||
// check if we could split at white space at all
|
||||
if (splitPos < 0) {
|
||||
splitLines[0] = fontMetrics.elidedText(text, Qt::ElideRight, int(availableWidth));
|
||||
|
@@ -436,6 +436,9 @@ QList<Declaration *> SymbolFinder::findMatchingDeclaration(const LookupContext &
|
||||
Function *functionType)
|
||||
{
|
||||
QList<Declaration *> result;
|
||||
if (!functionType)
|
||||
return result;
|
||||
|
||||
QList<Declaration *> nameMatch, argumentCountMatch, typeMatch;
|
||||
findMatchingDeclaration(context, functionType, &typeMatch, &argumentCountMatch, &nameMatch);
|
||||
result.append(typeMatch);
|
||||
|
@@ -68,7 +68,6 @@ void XcodeProbe::detectDeveloperPaths()
|
||||
Utils::SynchronousProcess selectedXcode;
|
||||
selectedXcode.setTimeoutS(5);
|
||||
selectedXcode.setCommand({"/usr/bin/xcode-select", {"--print-path"}});
|
||||
selectedXcode.setProcessUserEventWhileRunning();
|
||||
selectedXcode.runBlocking();
|
||||
if (selectedXcode.result() != QtcProcess::FinishedWithSuccess)
|
||||
qCWarning(probeLog)
|
||||
|
@@ -24,14 +24,18 @@
|
||||
****************************************************************************/
|
||||
|
||||
import QtQuick 2.0
|
||||
import QtGraphicalEffects 1.0
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
property real desaturation: 1.0
|
||||
layer.enabled: true
|
||||
layer.effect: Desaturate {
|
||||
desaturation: root.desaturation
|
||||
|
||||
Rectangle {
|
||||
z: 10
|
||||
anchors.fill: parent
|
||||
color: "#2d2e30"
|
||||
anchors.margins: -16
|
||||
|
||||
opacity: root.desaturation * 0.6
|
||||
}
|
||||
}
|
||||
|
@@ -273,7 +273,7 @@ void TextEditorActionHandlerPrivate::createActions()
|
||||
QKeySequence(tr("Ctrl+Shift+V")), G_EDIT_COPYPASTE, editMenu);
|
||||
m_modifyingActions << registerAction(NO_FORMAT_PASTE,
|
||||
[] (TextEditorWidget *w) { w->pasteWithoutFormat(); }, false, tr("Paste Without Formatting"),
|
||||
QKeySequence(Core::useMacShortcuts ? tr("Cmd+Opt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu);
|
||||
QKeySequence(Core::useMacShortcuts ? tr("Ctrl+Alt+Shift+V") : QString()), G_EDIT_COPYPASTE, editMenu);
|
||||
|
||||
// register "Edit -> Advanced" Menu Actions
|
||||
Core::ActionContainer *advancedEditMenu = Core::ActionManager::actionContainer(M_EDIT_ADVANCED);
|
||||
|
Submodule src/shared/qbs updated: 86eb697412...f002b866e7
Reference in New Issue
Block a user