Merge remote-tracking branch 'origin/4.0'

Change-Id: Ied9fbfc655aac9e04df16f2ad9b4f22fe05a1ba9
This commit is contained in:
Eike Ziller
2016-02-26 13:58:15 +01:00
114 changed files with 719 additions and 736 deletions

View File

@@ -228,6 +228,7 @@ struct DummyReduce {
};
template <>
struct DummyReduce<void> {
void operator()() const { } // needed for resultType<DummyReduce> with MSVC2013
};
template <typename ReduceResult>
@@ -242,7 +243,13 @@ QFuture<ReduceResult>
mapReduce(Iterator begin, Iterator end, const InitFunction &init, const MapFunction &map,
const ReduceFunction &reduce, const CleanUpFunction &cleanup, int size = -1)
{
return runAsync(Internal::blockingIteratorMapReduce<Iterator, InitFunction, MapFunction, ReduceResult, ReduceFunction, CleanUpFunction>,
return runAsync(Internal::blockingIteratorMapReduce<
Iterator,
typename std::decay<InitFunction>::type,
typename std::decay<MapFunction>::type,
typename std::decay<ReduceResult>::type,
typename std::decay<ReduceFunction>::type,
typename std::decay<CleanUpFunction>::type>,
begin, end, init, map, reduce, cleanup, size);
}
@@ -285,7 +292,13 @@ QFuture<ReduceResult>
mapReduce(const Container &container, const InitFunction &init, const MapFunction &map,
const ReduceFunction &reduce, const CleanUpFunction &cleanup)
{
return runAsync(Internal::blockingContainerMapReduce<Container, InitFunction, MapFunction, ReduceResult, ReduceFunction, CleanUpFunction>,
return runAsync(Internal::blockingContainerMapReduce<
typename std::decay<Container>::type,
typename std::decay<InitFunction>::type,
typename std::decay<MapFunction>::type,
typename std::decay<ReduceResult>::type,
typename std::decay<ReduceFunction>::type,
typename std::decay<CleanUpFunction>::type>,
container, init, map, reduce, cleanup);
}
@@ -296,10 +309,10 @@ QFuture<MapResult>
map(const Container &container, const MapFunction &map)
{
return mapReduce(container,
&Internal::dummyInit<MapResult>,
Internal::dummyInit<MapResult>,
map,
Internal::DummyReduce<MapResult>(),
&Internal::dummyCleanup<MapResult>);
Internal::dummyCleanup<MapResult>);
}
} // Utils

View File

@@ -1,19 +0,0 @@
{
\"Name\" : \"AnalyzerBase\",
\"Version\" : \"$$QTCREATOR_VERSION\",
\"CompatVersion\" : \"$$QTCREATOR_COMPAT_VERSION\",
\"Vendor\" : \"The Qt Company Ltd\",
\"Copyright\" : \"(C) 2016 The Qt Company Ltd\",
\"License\" : [ \"Commercial Usage\",
\"\",
\"Licensees holding valid Qt Commercial licenses may use this plugin in accordance with the Qt Commercial License Agreement provided with the Software or, alternatively, in accordance with the terms contained in a written agreement between you and The Qt Company.\",
\"\",
\"GNU General Public License Usage\",
\"\",
\"Alternatively, this plugin may be used under the terms of the GNU General Public License version 3 as published by the Free Software Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT included in the packaging of this plugin. Please review the following information to ensure the GNU General Public License requirements will be met: https://www.gnu.org/licenses/gpl-3.0.html.\"
],
\"Category\" : \"Code Analyzer\",
\"Description\" : \"Code Analyzer Base Plugin.\",
\"Url\" : \"http://www.qt.io\",
$$dependencyList
}

View File

@@ -1,36 +0,0 @@
DEFINES += ANALYZERBASE_LIBRARY
include(../../qtcreatorplugin.pri)
QT += network
# AnalyzerBase files
SOURCES += \
ianalyzertool.cpp \
analyzerplugin.cpp \
analyzerruncontrol.cpp \
analyzermanager.cpp \
analyzerrunconfigwidget.cpp \
analyzerutils.cpp \
detailederrorview.cpp \
diagnosticlocation.cpp \
startremotedialog.cpp
HEADERS += \
ianalyzertool.h \
analyzerbase_global.h \
analyzerconstants.h \
analyzerplugin.h \
analyzerruncontrol.h \
analyzermanager.h \
analyzerstartparameters.h \
analyzerrunconfigwidget.h \
analyzerutils.h \
detailederrorview.h \
diagnosticlocation.h \
startremotedialog.h \
analyzericons.h
RESOURCES += \
analyzerbase.qrc

View File

@@ -1,50 +0,0 @@
import qbs 1.0
QtcPlugin {
name: "AnalyzerBase"
Depends { name: "Qt.widgets" }
Depends { name: "Utils" }
Depends { name: "QtcSsh" }
Depends { name: "Core" }
Depends { name: "CppTools" }
Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" }
files: [
"analyzerbase.qrc",
"analyzerbase_global.h",
"analyzerconstants.h",
"analyzericons.h",
"analyzermanager.cpp",
"analyzermanager.h",
"analyzerplugin.cpp",
"analyzerplugin.h",
"analyzerrunconfigwidget.cpp",
"analyzerrunconfigwidget.h",
"analyzerruncontrol.cpp",
"analyzerruncontrol.h",
"analyzerstartparameters.h",
"analyzerutils.cpp",
"analyzerutils.h",
"detailederrorview.cpp",
"detailederrorview.h",
"diagnosticlocation.cpp",
"diagnosticlocation.h",
"ianalyzertool.cpp",
"ianalyzertool.h",
"startremotedialog.cpp",
"startremotedialog.h",
]
Group {
name: "Images"
prefix: "images/"
files: ["*.png"]
}
Export {
Depends { name: "CPlusPlus" }
}
}

View File

@@ -1,11 +0,0 @@
QTC_PLUGIN_NAME = AnalyzerBase
QTC_LIB_DEPENDS += \
cplusplus \
extensionsystem \
ssh \
utils
QTC_PLUGIN_DEPENDS += \
coreplugin \
projectexplorer \
texteditor \
cpptools

View File

@@ -1,80 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "analyzerplugin.h"
#include "analyzerconstants.h"
#include "analyzermanager.h"
#include <projectexplorer/projectexplorer.h>
#include <projectexplorer/taskhub.h>
#include <QtPlugin>
using namespace Analyzer;
using namespace Analyzer::Internal;
static AnalyzerPlugin *m_instance = 0;
////////////////////////////////////////////////////////////////////////
//
// AnalyzerPlugin
//
////////////////////////////////////////////////////////////////////////
AnalyzerPlugin::AnalyzerPlugin()
{
m_instance = this;
}
AnalyzerPlugin::~AnalyzerPlugin()
{
m_instance = 0;
}
bool AnalyzerPlugin::initialize(const QStringList &arguments, QString *errorString)
{
Q_UNUSED(arguments)
Q_UNUSED(errorString)
(void) new AnalyzerManager(this);
// Task integration.
//: Category under which Analyzer tasks are listed in Issues view
ProjectExplorer::TaskHub::addCategory(Constants::ANALYZERTASK_ID, tr("Analyzer"));
return true;
}
ExtensionSystem::IPlugin::ShutdownFlag AnalyzerPlugin::aboutToShutdown()
{
AnalyzerManager::shutdown();
return SynchronousShutdown;
}
AnalyzerPlugin *AnalyzerPlugin::instance()
{
return m_instance;
}

View File

@@ -1,55 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Author: Nicolas Arnaud-Cormos, KDAB (nicolas.arnaud-cormos@kdab.com)
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#ifndef ANALYZERPLUGIN_H
#define ANALYZERPLUGIN_H
#include <extensionsystem/iplugin.h>
namespace Analyzer {
namespace Internal {
class AnalyzerPlugin : public ExtensionSystem::IPlugin
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "AnalyzerBase.json")
public:
static AnalyzerPlugin *instance();
AnalyzerPlugin();
virtual ~AnalyzerPlugin();
bool initialize(const QStringList &arguments, QString *errorString);
void extensionsInitialized() {}
ShutdownFlag aboutToShutdown();
};
} // namespace Internal
} // namespace Analyzer
#endif // ANALYZERPLUGIN_H

View File

@@ -4,7 +4,6 @@ QtcPlugin {
name: "Android"
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }
Depends { name: "AnalyzerBase" }
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }

View File

@@ -4,8 +4,7 @@ QTC_PLUGIN_DEPENDS += \
debugger \
projectexplorer \
qtsupport \
texteditor \
analyzerbase
texteditor
QTC_LIB_DEPENDS += \
extensionsystem \

View File

@@ -28,10 +28,10 @@
#include "androidrunner.h"
#include "androidmanager.h"
#include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <projectexplorer/target.h>
#include <projectexplorer/project.h>

View File

@@ -40,9 +40,9 @@
#include <projectexplorer/toolchain.h>
#include <projectexplorer/project.h>
#include <projectexplorer/buildconfiguration.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>
#include <utils/portlist.h>

View File

@@ -3,7 +3,7 @@ import qbs
QtcPlugin {
name: "ClangStaticAnalyzer"
Depends { name: "AnalyzerBase" }
Depends { name: "Debugger" }
Depends { name: "Core" }
Depends { name: "CppTools" }
Depends { name: "ExtensionSystem" }

View File

@@ -3,7 +3,7 @@ QTC_LIB_DEPENDS += \
extensionsystem \
utils
QTC_PLUGIN_DEPENDS += \
analyzerbase \
debugger \
cpptools
QTC_TEST_DEPENDS += \
qbsprojectmanager \

View File

@@ -26,7 +26,7 @@
#ifndef CLANGSTATICANALZYERDIAGNOSTIC_H
#define CLANGSTATICANALZYERDIAGNOSTIC_H
#include <analyzerbase/diagnosticlocation.h>
#include <debugger/analyzer/diagnosticlocation.h>
#include <QList>
#include <QMetaType>

View File

@@ -29,7 +29,7 @@
#include "clangstaticanalyzerdiagnostic.h"
#include "clangstaticanalyzerprojectsettings.h"
#include <analyzerbase/detailederrorview.h>
#include <debugger/analyzer/detailederrorview.h>
#include <utils/fileutils.h>
#include <utils/treemodel.h>

View File

@@ -26,7 +26,7 @@
#ifndef CLANGSTATICANALYZERDIAGNOSTICVIEW_H
#define CLANGSTATICANALYZERDIAGNOSTICVIEW_H
#include <analyzerbase/detailederrorview.h>
#include <debugger/analyzer/detailederrorview.h>
namespace ClangStaticAnalyzer {
namespace Internal {

View File

@@ -35,7 +35,7 @@
#include "clangstaticanalyzerunittests.h"
#endif
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <coreplugin/icore.h>
#include <coreplugin/icontext.h>
#include <coreplugin/actionmanager/actionmanager.h>

View File

@@ -30,8 +30,8 @@
#include "clangstaticanalyzersettings.h"
#include "clangstaticanalyzerutils.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerutils.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerutils.h>
#include <clangcodemodel/clangutils.h>

View File

@@ -26,7 +26,7 @@
#ifndef CLANGSTATICANALYZERRUNCONTROL_H
#define CLANGSTATICANALYZERRUNCONTROL_H
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <cpptools/projectinfo.h>
#include <utils/environment.h>

View File

@@ -27,9 +27,9 @@
#include "clangstaticanalyzerconstants.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <coreplugin/icontext.h>

View File

@@ -31,7 +31,7 @@
#include "clangstaticanalyzerdiagnosticview.h"
#include "clangstaticanalyzerruncontrol.h"
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <coreplugin/coreconstants.h>
#include <coreplugin/coreicons.h>
#include <coreplugin/icore.h>

View File

@@ -26,7 +26,7 @@
#ifndef CLANGSTATICANALYZERTOOL_H
#define CLANGSTATICANALYZERTOOL_H
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <cpptools/projectinfo.h>
#include <QHash>

View File

@@ -29,7 +29,7 @@
#include "clangstaticanalyzertool.h"
#include "clangstaticanalyzerutils.h"
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <cpptools/cppmodelmanager.h>
#include <cpptools/cpptoolstestcase.h>
#include <projectexplorer/kitinformation.h>

View File

@@ -24,6 +24,7 @@
****************************************************************************/
#include "builddirmanager.h"
#include "cmakebuildconfiguration.h"
#include "cmakekitinformation.h"
#include "cmakeparser.h"
#include "cmakeprojectmanager.h"
@@ -32,8 +33,10 @@
#include <coreplugin/messagemanager.h>
#include <coreplugin/progressmanager/progressmanager.h>
#include <projectexplorer/kit.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/projectnodes.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <utils/algorithm.h>
@@ -88,43 +91,60 @@ static QStringList toArguments(const CMakeConfig &config) {
// BuildDirManager:
// --------------------------------------------------------------------
BuildDirManager::BuildDirManager(const Utils::FileName &sourceDir, const ProjectExplorer::Kit *k,
const CMakeConfig &inputConfig, const Utils::Environment &env,
const Utils::FileName &buildDir) :
m_sourceDir(sourceDir),
m_buildDir(buildDir),
m_kit(k),
m_environment(env),
m_inputConfig(inputConfig),
BuildDirManager::BuildDirManager(const CMakeBuildConfiguration *bc) :
m_buildConfiguration(bc),
m_watcher(new QFileSystemWatcher(this))
{
QTC_CHECK(!sourceDir.isEmpty());
m_projectName = m_sourceDir.fileName();
if (m_buildDir.isEmpty()) {
m_tempDir = new QTemporaryDir(QLatin1String("cmake-tmp-XXXXXX"));
m_buildDir = Utils::FileName::fromString(m_tempDir->path());
}
QTC_CHECK(!m_buildDir.isEmpty());
QTC_CHECK(k);
QTC_ASSERT(bc, return);
m_projectName = sourceDirectory().fileName();
m_reparseTimer.setSingleShot(true);
m_reparseTimer.setInterval(500);
connect(&m_reparseTimer, &QTimer::timeout, this, &BuildDirManager::forceReparse);
connect(&m_reparseTimer, &QTimer::timeout, this, &BuildDirManager::parse);
connect(m_watcher, &QFileSystemWatcher::fileChanged, this, [this]() {
if (!isBusy())
if (!isParsing())
m_reparseTimer.start();
});
QTimer::singleShot(0, this, &BuildDirManager::parse);
}
BuildDirManager::~BuildDirManager()
{
resetData();
delete m_tempDir;
}
bool BuildDirManager::isBusy() const
const ProjectExplorer::Kit *BuildDirManager::kit() const
{
return m_buildConfiguration->target()->kit();
}
const Utils::FileName BuildDirManager::buildDirectory() const
{
return m_buildConfiguration->buildDirectory();
}
const Utils::FileName BuildDirManager::workDirectory() const
{
const Utils::FileName bdir = buildDirectory();
if (bdir.exists())
return bdir;
if (m_tempDir)
return Utils::FileName::fromString(m_tempDir->path());
return bdir;
}
const Utils::FileName BuildDirManager::sourceDirectory() const
{
return m_buildConfiguration->target()->project()->projectDirectory();
}
const CMakeConfig BuildDirManager::cmakeConfiguration() const
{
return m_buildConfiguration->cmakeConfiguration();
}
bool BuildDirManager::isParsing() const
{
if (m_cmakeProcess)
return m_cmakeProcess->state() != QProcess::NotRunning;
@@ -133,53 +153,74 @@ bool BuildDirManager::isBusy() const
void BuildDirManager::forceReparse()
{
if (isBusy()) {
m_cmakeProcess->disconnect();
m_cmakeProcess->deleteLater();
m_cmakeProcess = nullptr;
}
stopProcess();
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
const QString generator = CMakeGeneratorKitInformation::generator(m_kit);
CMakeTool *tool = CMakeKitInformation::cmakeTool(kit());
const QString generator = CMakeGeneratorKitInformation::generator(kit());
QTC_ASSERT(tool, return);
QTC_ASSERT(!generator.isEmpty(), return);
startCMake(tool, generator, m_inputConfig);
startCMake(tool, generator, cmakeConfiguration());
}
void BuildDirManager::setInputConfiguration(const CMakeConfig &config)
void BuildDirManager::resetData()
{
m_inputConfig = config;
forceReparse();
m_hasData = false;
m_projectName.clear();
m_buildTargets.clear();
m_watchedFiles.clear();
qDeleteAll(m_files);
m_files.clear();
const QStringList watchedFiles = m_watcher->files();
if (!watchedFiles.isEmpty())
m_watcher->removePaths(watchedFiles);
}
bool BuildDirManager::persistCMakeState()
{
if (!m_tempDir)
return false;
QDir dir(buildDirectory().toString());
dir.mkpath(buildDirectory().toString());
delete m_tempDir;
m_tempDir = nullptr;
parse();
return true;
}
void BuildDirManager::parse()
{
CMakeTool *tool = CMakeKitInformation::cmakeTool(m_kit);
const QString generator = CMakeGeneratorKitInformation::generator(m_kit);
CMakeTool *tool = CMakeKitInformation::cmakeTool(kit());
const QString generator = CMakeGeneratorKitInformation::generator(kit());
QTC_ASSERT(tool, return);
QTC_ASSERT(!generator.isEmpty(), return);
// Pop up a dialog asking the user to rerun cmake
QString cbpFile = CMakeManager::findCbpFile(QDir(m_buildDir.toString()));
QString cbpFile = CMakeManager::findCbpFile(QDir(workDirectory().toString()));
QFileInfo cbpFileFi(cbpFile);
if (!cbpFileFi.exists()) {
// Initial create:
startCMake(tool, generator, m_inputConfig);
startCMake(tool, generator, cmakeConfiguration());
return;
}
const bool mustUpdate
= Utils::anyOf(m_watchedFiles, [&cbpFileFi](const Utils::FileName &f) {
const bool mustUpdate = m_watchedFiles.isEmpty()
|| Utils::anyOf(m_watchedFiles, [&cbpFileFi](const Utils::FileName &f) {
return f.toFileInfo().lastModified() > cbpFileFi.lastModified();
});
if (mustUpdate) {
startCMake(tool, generator, CMakeConfig());
} else {
extractData();
m_hasData = true;
emit dataAvailable();
}
}
@@ -199,7 +240,7 @@ QList<CMakeBuildTarget> BuildDirManager::buildTargets() const
return m_buildTargets;
}
QList<ProjectExplorer::FileNode *> BuildDirManager::files() const
QList<ProjectExplorer::FileNode *> BuildDirManager::files()
{
return m_files;
}
@@ -211,25 +252,69 @@ void BuildDirManager::clearFiles()
CMakeConfig BuildDirManager::configuration() const
{
if (!m_hasData)
return CMakeConfig();
return parseConfiguration();
}
void BuildDirManager::stopProcess()
{
if (!m_cmakeProcess)
return;
m_cmakeProcess->disconnect();
if (m_cmakeProcess->state() == QProcess::Running) {
m_cmakeProcess->terminate();
if (!m_cmakeProcess->waitForFinished(500))
m_cmakeProcess->kill();
}
cleanUpProcess();
m_future->reportCanceled();
m_future->reportFinished();
delete m_future;
m_future = nullptr;
}
void BuildDirManager::cleanUpProcess()
{
if (!m_cmakeProcess)
return;
QTC_ASSERT(m_cmakeProcess->state() == QProcess::NotRunning, return);
m_cmakeProcess->disconnect();
if (m_cmakeProcess->state() == QProcess::Running) {
m_cmakeProcess->terminate();
if (!m_cmakeProcess->waitForFinished(500))
m_cmakeProcess->kill();
}
delete m_cmakeProcess;
m_cmakeProcess = nullptr;
// Delete issue parser:
m_parser->flush();
delete m_parser;
m_parser = nullptr;
}
void BuildDirManager::extractData()
{
const Utils::FileName topCMake
= Utils::FileName::fromString(m_sourceDir.toString() + QLatin1String("/CMakeLists.txt"));
= Utils::FileName::fromString(sourceDirectory().toString() + QLatin1String("/CMakeLists.txt"));
m_projectName = m_sourceDir.fileName();
m_buildTargets.clear();
m_watchedFiles.clear();
m_files.clear();
resetData();
m_projectName = sourceDirectory().fileName();
m_files.append(new ProjectExplorer::FileNode(topCMake, ProjectExplorer::ProjectFileType, false));
m_watchedFiles.insert(topCMake);
m_watcher->removePaths(m_watcher->files());
// Find cbp file
QString cbpFile = CMakeManager::findCbpFile(m_buildDir.toString());
QString cbpFile = CMakeManager::findCbpFile(workDirectory().toString());
if (cbpFile.isEmpty())
return;
@@ -238,7 +323,7 @@ void BuildDirManager::extractData()
// setFolderName
CMakeCbpParser cbpparser;
// Parsing
if (!cbpparser.parseCbpFile(m_kit, cbpFile, m_sourceDir.toString()))
if (!cbpparser.parseCbpFile(kit(), cbpFile, sourceDirectory().toString()))
return;
m_projectName = cbpparser.projectName();
@@ -266,17 +351,23 @@ void BuildDirManager::startCMake(CMakeTool *tool, const QString &generator,
const CMakeConfig &config)
{
QTC_ASSERT(tool && tool->isValid(), return);
QTC_ASSERT(!m_cmakeProcess, return);
QTC_ASSERT(!m_parser, return);
QTC_ASSERT(!m_future, return);
// Make sure m_buildDir exists:
const QString buildDirStr = m_buildDir.toString();
QDir bDir = QDir(buildDirStr);
bDir.mkpath(buildDirStr);
// Find a directory to set up into:
if (!buildDirectory().exists()) {
if (!m_tempDir)
m_tempDir = new QTemporaryDir(QDir::tempPath() + QLatin1String("/qtc-cmake-XXXXXX"));
QTC_ASSERT(m_tempDir->isValid(), return);
}
// Make sure work directory exists:
QTC_ASSERT(workDirectory().exists(), return);
m_parser = new CMakeParser;
QDir source = QDir(m_sourceDir.toString());
QDir source = QDir(sourceDirectory().toString());
connect(m_parser, &ProjectExplorer::IOutputParser::addTask, m_parser,
[source](const ProjectExplorer::Task &task) {
if (task.file.isEmpty() || task.file.toFileInfo().isAbsolute()) {
@@ -290,11 +381,11 @@ void BuildDirManager::startCMake(CMakeTool *tool, const QString &generator,
// Always use the sourceDir: If we are triggered because the build directory is getting deleted
// then we are racing against CMakeCache.txt also getting deleted.
const QString srcDir = m_sourceDir.toString();
const QString srcDir = sourceDirectory().toString();
m_cmakeProcess = new Utils::QtcProcess(this);
m_cmakeProcess->setWorkingDirectory(buildDirStr);
m_cmakeProcess->setEnvironment(m_environment);
m_cmakeProcess->setWorkingDirectory(workDirectory().toString());
m_cmakeProcess->setEnvironment(m_buildConfiguration->environment());
connect(m_cmakeProcess, &QProcess::readyReadStandardOutput,
this, &BuildDirManager::processCMakeOutput);
@@ -314,17 +405,17 @@ void BuildDirManager::startCMake(CMakeTool *tool, const QString &generator,
Core::MessageManager::write(tr("Running '%1 %2' in %3.")
.arg(tool->cmakeExecutable().toUserOutput())
.arg(args)
.arg(m_buildDir.toUserOutput()));
.arg(workDirectory().toUserOutput()));
m_future = new QFutureInterface<void>();
m_future->setProgressRange(0, 1);
Core::ProgressManager::addTask(m_future->future(),
tr("Configuring \"%1\"").arg(projectName()),
tr("Configuring \"%1\"").arg(m_buildConfiguration->target()->project()->displayName()),
"CMake.Configure");
m_cmakeProcess->setCommand(tool->cmakeExecutable().toString(), args);
m_cmakeProcess->start();
emit parsingStarted();
emit configurationStarted();
}
void BuildDirManager::cmakeFinished(int code, QProcess::ExitStatus status)
@@ -335,12 +426,7 @@ void BuildDirManager::cmakeFinished(int code, QProcess::ExitStatus status)
processCMakeOutput();
processCMakeError();
m_parser->flush();
delete m_parser;
m_parser = nullptr;
m_cmakeProcess->deleteLater();
m_cmakeProcess = nullptr;
cleanUpProcess();
extractData(); // try even if cmake failed...
@@ -361,8 +447,9 @@ void BuildDirManager::cmakeFinished(int code, QProcess::ExitStatus status)
m_future->reportFinished();
delete m_future;
m_future = 0;
m_future = nullptr;
m_hasData = true;
emit dataAvailable();
}
@@ -433,7 +520,7 @@ static CMakeConfigItem::Type fromByteArray(const QByteArray &type) {
CMakeConfig BuildDirManager::parseConfiguration() const
{
CMakeConfig result;
const QString cacheFile = QDir(m_buildDir.toString()).absoluteFilePath(QLatin1String("CMakeCache.txt"));
const QString cacheFile = QDir(workDirectory().toString()).absoluteFilePath(QLatin1String("CMakeCache.txt"));
QFile cache(cacheFile);
if (!cache.open(QIODevice::ReadOnly | QIODevice::Text))
return CMakeConfig();
@@ -470,7 +557,7 @@ CMakeConfig BuildDirManager::parseConfiguration() const
// Sanity checks:
if (key == "CMAKE_HOME_DIRECTORY") {
const Utils::FileName actualSourceDir = Utils::FileName::fromUserInput(QString::fromUtf8(value));
if (actualSourceDir != m_sourceDir)
if (actualSourceDir != sourceDirectory())
emit errorOccured(tr("Build directory contains a build of the wrong project (%1).")
.arg(actualSourceDir.toUserOutput()));
}

View File

@@ -57,39 +57,43 @@ class CMakeTool;
namespace Internal {
class CMakeBuildConfiguration;
class BuildDirManager : public QObject
{
Q_OBJECT
public:
BuildDirManager(const Utils::FileName &sourceDir, const ProjectExplorer::Kit *k,
const CMakeConfig &inputConfig, const Utils::Environment &env,
const Utils::FileName &buildDir);
BuildDirManager(const CMakeBuildConfiguration *bc);
~BuildDirManager() override;
const ProjectExplorer::Kit *kit() const { return m_kit; }
const Utils::FileName buildDirectory() const { return m_buildDir; }
const Utils::FileName sourceDirectory() const { return m_sourceDir; }
bool isBusy() const;
const ProjectExplorer::Kit *kit() const;
const Utils::FileName buildDirectory() const;
const Utils::FileName workDirectory() const;
const Utils::FileName sourceDirectory() const;
const CMakeConfig cmakeConfiguration() const;
bool isParsing() const;
void parse();
void forceReparse();
void setInputConfiguration(const CMakeConfig &config);
void resetData();
bool persistCMakeState();
bool isProjectFile(const Utils::FileName &fileName) const;
QString projectName() const;
QList<CMakeBuildTarget> buildTargets() const;
QList<ProjectExplorer::FileNode *> files() const;
QList<ProjectExplorer::FileNode *> files();
void clearFiles();
CMakeConfig configuration() const;
signals:
void parsingStarted() const;
void configurationStarted() const;
void dataAvailable() const;
void errorOccured(const QString &err) const;
private:
void stopProcess();
void cleanUpProcess();
void extractData();
void startCMake(CMakeTool *tool, const QString &generator, const CMakeConfig &config);
@@ -100,15 +104,11 @@ private:
CMakeConfig parseConfiguration() const;
const Utils::FileName m_sourceDir;
Utils::FileName m_buildDir;
Utils::FileName m_parsedSourceDir;
const ProjectExplorer::Kit *const m_kit;
Utils::Environment m_environment;
CMakeConfig m_inputConfig;
bool m_hasData = false;
QTemporaryDir *m_tempDir = nullptr;
const CMakeBuildConfiguration *m_buildConfiguration = nullptr;
Utils::QtcProcess *m_cmakeProcess = nullptr;
QTemporaryDir *m_tempDir = nullptr;
QSet<Utils::FileName> m_watchedFiles;
QString m_projectName;

View File

@@ -25,6 +25,7 @@
#include "cmakebuildconfiguration.h"
#include "builddirmanager.h"
#include "cmakebuildinfo.h"
#include "cmakebuildstep.h"
#include "cmakekitinformation.h"
@@ -75,10 +76,32 @@ static FileName shadowBuildDirectory(const FileName &projectFilePath, const Kit
CMakeBuildConfiguration::CMakeBuildConfiguration(ProjectExplorer::Target *parent) :
BuildConfiguration(parent, Core::Id(Constants::CMAKE_BC_ID))
{
CMakeProject *project = static_cast<CMakeProject *>(parent->project());
auto project = static_cast<CMakeProject *>(parent->project());
setBuildDirectory(shadowBuildDirectory(project->projectFilePath(),
parent->kit(),
displayName(), BuildConfiguration::Unknown));
m_buildDirManager = new BuildDirManager(this);
connect(m_buildDirManager, &BuildDirManager::dataAvailable,
this, &CMakeBuildConfiguration::dataAvailable);
connect(m_buildDirManager, &BuildDirManager::errorOccured,
this, &CMakeBuildConfiguration::setError);
connect(m_buildDirManager, &BuildDirManager::configurationStarted,
this, [this]() { m_completeConfigurationCache.clear(); emit parsingStarted(); });
connect(this, &CMakeBuildConfiguration::environmentChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(this, &CMakeBuildConfiguration::buildDirectoryChanged,
m_buildDirManager, &BuildDirManager::forceReparse);
connect(target(), &Target::kitChanged, m_buildDirManager, &BuildDirManager::forceReparse);
connect(this, &CMakeBuildConfiguration::parsingStarted, project, &CMakeProject::handleParsingStarted);
connect(this, &CMakeBuildConfiguration::dataAvailable, project, &CMakeProject::parseCMakeOutput);
}
CMakeBuildConfiguration::~CMakeBuildConfiguration()
{
m_buildDirManager->deleteLater(); // Do not block while waiting for cmake...
}
bool CMakeBuildConfiguration::isEnabled() const
@@ -139,6 +162,107 @@ bool CMakeBuildConfiguration::fromMap(const QVariantMap &map)
return true;
}
BuildDirManager *CMakeBuildConfiguration::buildDirManager() const
{
return m_buildDirManager;
}
bool CMakeBuildConfiguration::isParsing() const
{
return m_buildDirManager && m_buildDirManager->isParsing();
}
void CMakeBuildConfiguration::parse()
{
m_buildDirManager->parse();
}
void CMakeBuildConfiguration::resetData()
{
m_buildDirManager->resetData();
}
bool CMakeBuildConfiguration::persistCMakeState()
{
return m_buildDirManager->persistCMakeState();
}
QList<ConfigModel::DataItem> CMakeBuildConfiguration::completeCMakeConfiguration() const
{
if (m_buildDirManager->isParsing())
return QList<ConfigModel::DataItem>();
if (m_completeConfigurationCache.isEmpty())
m_completeConfigurationCache = m_buildDirManager->configuration();
return Utils::transform(m_completeConfigurationCache, [](const CMakeConfigItem &i) {
ConfigModel::DataItem j;
j.key = QString::fromUtf8(i.key);
j.value = QString::fromUtf8(i.value);
j.description = QString::fromUtf8(i.documentation);
j.isAdvanced = i.isAdvanced;
switch (i.type) {
case CMakeConfigItem::FILEPATH:
j.type = ConfigModel::DataItem::FILE;
break;
case CMakeConfigItem::PATH:
j.type = ConfigModel::DataItem::DIRECTORY;
break;
case CMakeConfigItem::BOOL:
j.type = ConfigModel::DataItem::BOOLEAN;
break;
case CMakeConfigItem::STRING:
j.type = ConfigModel::DataItem::STRING;
break;
default:
j.type = ConfigModel::DataItem::UNKNOWN;
break;
}
return j;
});
}
void CMakeBuildConfiguration::setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items)
{
if (m_buildDirManager->isParsing())
return;
const CMakeConfig newConfig = Utils::transform(items, [](const ConfigModel::DataItem &i) {
CMakeConfigItem ni;
ni.key = i.key.toUtf8();
ni.value = i.value.toUtf8();
ni.documentation = i.description.toUtf8();
ni.isAdvanced = i.isAdvanced;
switch (i.type) {
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
ni.type = CMakeConfigItem::BOOL;
break;
case CMakeProjectManager::ConfigModel::DataItem::FILE:
ni.type = CMakeConfigItem::FILEPATH;
break;
case CMakeProjectManager::ConfigModel::DataItem::DIRECTORY:
ni.type = CMakeConfigItem::PATH;
break;
case CMakeProjectManager::ConfigModel::DataItem::STRING:
ni.type = CMakeConfigItem::STRING;
break;
case CMakeProjectManager::ConfigModel::DataItem::UNKNOWN:
default:
ni.type = CMakeConfigItem::INTERNAL;
break;
}
return ni;
});
// There is a buildDirManager, so there must also be an active BC:
const CMakeConfig config = cmakeConfiguration() + newConfig;
setCMakeConfiguration(config);
m_buildDirManager->forceReparse();
}
void CMakeBuildConfiguration::emitBuildTypeChanged()
{
emit buildTypeChanged();

View File

@@ -26,6 +26,7 @@
#pragma once
#include "cmakeconfigitem.h"
#include "configmodel.h"
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/abi.h>
@@ -38,7 +39,9 @@ class CMakeProject;
namespace Internal {
class BuildDirManager;
class CMakeBuildConfigurationFactory;
class CMakeBuildSettingsWidget;
class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
{
@@ -47,6 +50,7 @@ class CMakeBuildConfiguration : public ProjectExplorer::BuildConfiguration
public:
CMakeBuildConfiguration(ProjectExplorer::Target *parent);
~CMakeBuildConfiguration();
bool isEnabled() const override;
QString disabledReason() const override;
@@ -60,24 +64,45 @@ public:
void emitBuildTypeChanged();
void setCMakeConfiguration(const CMakeConfig &config);
bool hasCMakeConfiguration() const;
CMakeConfig cmakeConfiguration() const;
void setError(const QString &message);
QString error() const;
BuildDirManager *buildDirManager() const;
bool isParsing() const;
void parse();
void resetData();
bool persistCMakeState();
signals:
void errorOccured(const QString &message);
void parsingStarted();
void dataAvailable();
protected:
CMakeBuildConfiguration(ProjectExplorer::Target *parent, CMakeBuildConfiguration *source);
bool fromMap(const QVariantMap &map) override;
private:
QList<ConfigModel::DataItem> completeCMakeConfiguration() const;
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
void setError(const QString &message);
QString m_initialArguments;
CMakeConfig m_configuration;
QString m_error;
friend class CMakeProjectManager::CMakeProject;
mutable QList<CMakeConfigItem> m_completeConfigurationCache;
BuildDirManager *m_buildDirManager = nullptr;
friend class CMakeBuildSettingsWidget;
friend class CMakeProject;
};
class CMakeBuildConfigurationFactory : public ProjectExplorer::IBuildConfigurationFactory

View File

@@ -84,9 +84,9 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
buildDirChooser->setBaseFileName(project->projectDirectory());
buildDirChooser->setFileName(bc->buildDirectory());
connect(buildDirChooser, &Utils::PathChooser::rawPathChanged, this,
[this, project](const QString &path) {
[this](const QString &path) {
m_configModel->flush(); // clear out config cache...
project->changeBuildDirectory(m_buildConfiguration, path);
m_buildConfiguration->setBuildDirectory(Utils::FileName::fromString(path));
});
int row = 0;
@@ -123,7 +123,7 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
m_configView->setMinimumHeight(300);
m_configView->setRootIsDecorated(false);
m_configView->setUniformRowHeights(true);
new Utils::HeaderViewStretcher(m_configView->header(), 1);
auto stretcher = new Utils::HeaderViewStretcher(m_configView->header(), 1);
m_configView->setSelectionMode(QAbstractItemView::SingleSelection);
m_configView->setSelectionBehavior(QAbstractItemView::SelectItems);
m_configView->setFrameShape(QFrame::NoFrame);
@@ -166,13 +166,18 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
updateButtonState();
m_showProgressTimer.start();
});
connect(project, &CMakeProject::buildDirectoryDataAvailable,
this, [this, project, buildDirChooser](ProjectExplorer::BuildConfiguration *bc) {
if (m_buildConfiguration->isParsing())
m_showProgressTimer.start();
else
m_configModel->setConfiguration(m_buildConfiguration->completeCMakeConfiguration());
connect(m_buildConfiguration, &CMakeBuildConfiguration::dataAvailable,
this, [this, buildDirChooser, stretcher]() {
updateButtonState();
if (m_buildConfiguration == bc) {
m_configModel->setConfiguration(project->currentCMakeConfiguration());
buildDirChooser->triggerChanged(); // refresh valid state...
}
m_configModel->setConfiguration(m_buildConfiguration->completeCMakeConfiguration());
stretcher->stretch();
buildDirChooser->triggerChanged(); // refresh valid state...
m_showProgressTimer.stop();
m_progressIndicator->hide();
});
@@ -186,8 +191,8 @@ CMakeBuildSettingsWidget::CMakeBuildSettingsWidget(CMakeBuildConfiguration *bc)
this, &CMakeBuildSettingsWidget::updateAdvancedCheckBox);
connect(m_resetButton, &QPushButton::clicked, m_configModel, &ConfigModel::resetAllChanges);
connect(m_reconfigureButton, &QPushButton::clicked, this, [this, project]() {
project->setCurrentCMakeConfiguration(m_configModel->configurationChanges());
connect(m_reconfigureButton, &QPushButton::clicked, this, [this]() {
m_buildConfiguration->setCurrentCMakeConfiguration(m_configModel->configurationChanges());
});
connect(m_editButton, &QPushButton::clicked, this, [this]() {
QModelIndex idx = m_configView->currentIndex();
@@ -218,8 +223,7 @@ void CMakeBuildSettingsWidget::setError(const QString &message)
void CMakeBuildSettingsWidget::updateButtonState()
{
auto project = static_cast<CMakeProject *>(m_buildConfiguration->target()->project());
const bool isParsing = project->isParsing();
const bool isParsing = m_buildConfiguration->isParsing();
const bool hasChanges = m_configModel->hasChanges();
m_resetButton->setEnabled(hasChanges && !isParsing);
m_reconfigureButton->setEnabled((hasChanges || m_configModel->hasCMakeChanges()) && !isParsing);

View File

@@ -72,12 +72,12 @@ const char ADD_RUNCONFIGURATION_TEXT[] = "Current executable";
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl) : AbstractProcessStep(bsl, Core::Id(MS_ID))
{
ctor();
ctor(bsl);
}
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, Core::Id id) : AbstractProcessStep(bsl, id)
{
ctor();
ctor(bsl);
}
CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, CMakeBuildStep *bs) :
@@ -86,10 +86,10 @@ CMakeBuildStep::CMakeBuildStep(BuildStepList *bsl, CMakeBuildStep *bs) :
m_toolArguments(bs->m_toolArguments),
m_addRunConfigurationArgument(bs->m_addRunConfigurationArgument)
{
ctor();
ctor(bsl);
}
void CMakeBuildStep::ctor()
void CMakeBuildStep::ctor(BuildStepList *bsl)
{
m_percentProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)%\\]"));
m_ninjaProgress = QRegExp(QLatin1String("^\\[\\s*(\\d*)/\\s*(\\d*)"));
@@ -97,9 +97,15 @@ void CMakeBuildStep::ctor()
//: Default display name for the cmake make step.
setDefaultDisplayName(tr("Make"));
auto bc = qobject_cast<CMakeBuildConfiguration *>(bsl->parent());
if (!bc) {
auto t = qobject_cast<Target *>(bsl->parent()->parent());
QTC_ASSERT(t, return);
bc = qobject_cast<CMakeBuildConfiguration *>(t->activeBuildConfiguration());
}
connect(target(), &Target::kitChanged, this, &CMakeBuildStep::cmakeCommandChanged);
connect(static_cast<CMakeProject *>(project()), &CMakeProject::buildDirectoryDataAvailable,
this, &CMakeBuildStep::buildTargetsChanged);
connect(bc, &CMakeBuildConfiguration::dataAvailable, this, &CMakeBuildStep::handleBuildTargetChanges);
}
CMakeBuildConfiguration *CMakeBuildStep::cmakeBuildConfiguration() const
@@ -117,12 +123,13 @@ CMakeRunConfiguration *CMakeBuildStep::targetsActiveRunConfiguration() const
return qobject_cast<CMakeRunConfiguration *>(target()->activeRunConfiguration());
}
void CMakeBuildStep::buildTargetsChanged()
void CMakeBuildStep::handleBuildTargetChanges()
{
const QStringList filteredTargets
= Utils::filtered(static_cast<CMakeProject *>(project())->buildTargetTitles(),
[this](const QString &s) { return m_buildTargets.contains(s); });
setBuildTargets(filteredTargets);
emit buildTargetsChanged();
}
QVariantMap CMakeBuildStep::toMap() const
@@ -215,6 +222,37 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
return AbstractProcessStep::init(earlierSteps);
}
void CMakeBuildStep::run(QFutureInterface<bool> &fi)
{
// Make sure CMake state was written to disk before trying to build:
CMakeBuildConfiguration *bc = cmakeBuildConfiguration();
if (!bc)
bc = qobject_cast<CMakeBuildConfiguration *>(target()->activeBuildConfiguration());
QTC_ASSERT(bc, return);
if (bc->persistCMakeState()) {
emit addOutput(tr("Persisting CMake state..."), BuildStep::MessageOutput);
m_runTrigger = connect(bc, &CMakeBuildConfiguration::dataAvailable,
this, [this, &fi]() { runImpl(fi); });
m_errorTrigger = connect(bc, &CMakeBuildConfiguration::errorOccured,
this, [this, &fi]() {
fi.reportResult(false);
});
} else {
runImpl(fi);
}
}
void CMakeBuildStep::runImpl(QFutureInterface<bool> &fi)
{
// Do the actual build:
disconnect(m_runTrigger);
disconnect(m_errorTrigger);
AbstractProcessStep::run(fi);
}
BuildStepConfigWidget *CMakeBuildStep::createConfigWidget()
{
return new CMakeBuildStepConfigWidget(this);
@@ -401,7 +439,7 @@ CMakeBuildStepConfigWidget::CMakeBuildStepConfigWidget(CMakeBuildStep *buildStep
connect(ProjectExplorerPlugin::instance(), &ProjectExplorerPlugin::settingsChanged,
this, &CMakeBuildStepConfigWidget::updateDetails);
connect(pro, &CMakeProject::buildDirectoryDataAvailable, this, &CMakeBuildStepConfigWidget::buildTargetsChanged);
connect(m_buildStep, &CMakeBuildStep::buildTargetsChanged, this, &CMakeBuildStepConfigWidget::buildTargetsChanged);
connect(m_buildStep, &CMakeBuildStep::targetsToBuildChanged, this, &CMakeBuildStepConfigWidget::selectedBuildTargetsChanged);
connect(pro, &CMakeProject::environmentChanged, this, &CMakeBuildStepConfigWidget::updateDetails);
}

View File

@@ -56,6 +56,7 @@ public:
CMakeBuildConfiguration *targetsActiveBuildConfiguration() const;
bool init(QList<const BuildStep *> &earlierSteps) override;
void run(QFutureInterface<bool> &fi) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;
bool immutable() const override;
@@ -83,6 +84,7 @@ public:
signals:
void cmakeCommandChanged();
void targetsToBuildChanged();
void buildTargetsChanged();
protected:
void processStarted() override;
@@ -97,11 +99,16 @@ protected:
void stdOutput(const QString &line) override;
private:
void ctor();
void ctor(ProjectExplorer::BuildStepList *bsl);
void buildTargetsChanged();
void runImpl(QFutureInterface<bool> &fi);
void handleBuildTargetChanges();
CMakeRunConfiguration *targetsActiveRunConfiguration() const;
QMetaObject::Connection m_runTrigger;
QMetaObject::Connection m_errorTrigger;
QRegExp m_percentProgress;
QRegExp m_ninjaProgress;
QString m_ninjaProgressString;

View File

@@ -67,19 +67,18 @@
#include <QFileSystemWatcher>
#include <QTemporaryDir>
using namespace CMakeProjectManager;
using namespace CMakeProjectManager::Internal;
using namespace ProjectExplorer;
using namespace Utils;
namespace CMakeProjectManager {
using namespace Internal;
// QtCreator CMake Generator wishlist:
// Which make targets we need to build to get all executables
// What is the actual compiler executable
// DEFINES
// Open Questions
// Who sets up the environment for cl.exe ? INCLUDEPATH and so on
/*!
\class CMakeProject
*/
@@ -93,19 +92,6 @@ CMakeProject::CMakeProject(CMakeManager *manager, const FileName &fileName)
setProjectLanguages(Core::Context(ProjectExplorer::Constants::LANG_CXX));
rootProjectNode()->setDisplayName(fileName.parentDir().fileName());
connect(this, &CMakeProject::buildDirectoryDataAvailable, this, &CMakeProject::updateRunConfigurations);
connect(this, &Project::activeTargetChanged, this, &CMakeProject::activeTargetHasChanged);
connect(this, &CMakeProject::environmentChanged, this, [this]() {
BuildConfiguration *bc = nullptr;
if (activeTarget())
bc = activeTarget()->activeBuildConfiguration();
changeActiveBuildConfiguration(bc); // Does a clean reset of the builddirmanager
});
connect(this, &Project::addedTarget, this, [this](Target *t) {
connect(t, &Target::kitChanged, this, &CMakeProject::handleKitChanges);
});
}
CMakeProject::~CMakeProject()
@@ -115,71 +101,6 @@ CMakeProject::~CMakeProject()
qDeleteAll(m_extraCompilers);
}
void CMakeProject::changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration *bc)
{
if (m_buildDirManager) {
m_buildDirManager->disconnect();
m_buildDirManager->deleteLater();
}
m_buildDirManager = nullptr;
Kit *k = nullptr;
CMakeConfig config;
Utils::FileName buildDir;
CMakeBuildConfiguration *cmakebc = qobject_cast<CMakeBuildConfiguration *>(bc);
if (!cmakebc) {
k = KitManager::defaultKit();
config = CMakeConfigurationKitInformation::configuration(k);
} else {
k = cmakebc->target()->kit();
config = cmakebc->cmakeConfiguration();
buildDir = cmakebc->buildDirectory();
}
if (k) {
m_buildDirManager = new Internal::BuildDirManager(projectDirectory(), k, config,
cmakebc->environment(), buildDir);
connect(m_buildDirManager, &BuildDirManager::parsingStarted,
this, &CMakeProject::parsingStarted);
connect(m_buildDirManager, &BuildDirManager::dataAvailable,
this, &CMakeProject::parseCMakeOutput);
connect(m_buildDirManager, &BuildDirManager::errorOccured,
cmakebc, &CMakeBuildConfiguration::setError);
}
}
void CMakeProject::activeTargetHasChanged(Target *target)
{
if (m_activeTarget) {
disconnect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
}
m_activeTarget = target;
if (!m_activeTarget)
return;
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
changeActiveBuildConfiguration(m_activeTarget->activeBuildConfiguration());
}
void CMakeProject::changeBuildDirectory(CMakeBuildConfiguration *bc, const QString &newBuildDirectory)
{
bc->setBuildDirectory(FileName::fromString(newBuildDirectory));
if (activeTarget() && activeTarget()->activeBuildConfiguration() == bc)
changeActiveBuildConfiguration(bc);
}
void CMakeProject::handleKitChanges()
{
const Target *t = qobject_cast<Target *>(sender());
if (t && t != activeTarget())
return;
changeActiveBuildConfiguration(t->activeBuildConfiguration()); // force proper refresh
}
QStringList CMakeProject::getCXXFlagsFor(const CMakeBuildTarget &buildTarget,
QHash<QString, QStringList> &cache)
{
@@ -279,23 +200,25 @@ bool CMakeProject::extractCXXFlagsFromNinja(const CMakeBuildTarget &buildTarget,
void CMakeProject::parseCMakeOutput()
{
QTC_ASSERT(m_buildDirManager, return);
QTC_ASSERT(activeTarget() && activeTarget()->activeBuildConfiguration(), return);
auto cmakeBc = qobject_cast<CMakeBuildConfiguration *>(sender());
QTC_ASSERT(cmakeBc, return);
if (!activeTarget() || activeTarget()->activeBuildConfiguration() != cmakeBc)
return;
auto activeBC = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
BuildDirManager *bdm = cmakeBc->buildDirManager();
QTC_ASSERT(bdm, return);
rootProjectNode()->setDisplayName(m_buildDirManager->projectName());
rootProjectNode()->setDisplayName(bdm->projectName());
buildTree(static_cast<CMakeProjectNode *>(rootProjectNode()), m_buildDirManager->files());
m_buildDirManager->clearFiles(); // Some of the FileNodes in files() were deleted!
buildTree(static_cast<CMakeProjectNode *>(rootProjectNode()), bdm->files());
bdm->clearFiles(); // Some of the FileNodes in files() were deleted!
updateApplicationAndDeploymentTargets();
createGeneratedCodeModelSupport();
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(m_buildDirManager->kit());
ToolChain *tc = ProjectExplorer::ToolChainKitInformation::toolChain(cmakeBc->target()->kit());
if (!tc) {
emit buildDirectoryDataAvailable(activeBC);
emit fileListChanged();
return;
}
@@ -305,7 +228,7 @@ void CMakeProject::parseCMakeOutput()
CppTools::ProjectPartBuilder ppBuilder(pinfo);
CppTools::ProjectPart::QtVersion activeQtVersion = CppTools::ProjectPart::NoQt;
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(m_buildDirManager->kit())) {
if (QtSupport::BaseQtVersion *qtVersion = QtSupport::QtKitInformation::qtVersion(cmakeBc->target()->kit())) {
if (qtVersion->qtVersion() < QtSupport::QtVersionNumber(5,0,0))
activeQtVersion = CppTools::ProjectPart::Qt4;
else
@@ -336,10 +259,11 @@ void CMakeProject::parseCMakeOutput()
m_codeModelFuture = modelmanager->updateProjectInfo(pinfo);
emit displayNameChanged();
emit buildDirectoryDataAvailable(activeBC);
emit fileListChanged();
emit activeBC->emitBuildTypeChanged();
emit cmakeBc->emitBuildTypeChanged();
updateRunConfigurations();
}
bool CMakeProject::needsConfiguration() const
@@ -364,105 +288,26 @@ bool CMakeProject::supportsKit(Kit *k, QString *errorMessage) const
void CMakeProject::runCMake()
{
if (m_buildDirManager && !m_buildDirManager->isBusy())
m_buildDirManager->forceReparse();
}
CMakeBuildConfiguration *bc = nullptr;
if (activeTarget())
bc = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
bool CMakeProject::isParsing() const
{
return m_buildDirManager && m_buildDirManager->isBusy();
}
QList<ConfigModel::DataItem> CMakeProject::currentCMakeConfiguration() const
{
if (!m_buildDirManager || m_buildDirManager->isBusy())
return QList<ConfigModel::DataItem>();
const QList<CMakeConfigItem> cmakeItems = m_buildDirManager->configuration();
return Utils::transform(cmakeItems, [](const CMakeConfigItem &i) {
ConfigModel::DataItem j;
j.key = QString::fromUtf8(i.key);
j.value = QString::fromUtf8(i.value);
j.description = QString::fromUtf8(i.documentation);
j.isAdvanced = i.isAdvanced;
switch (i.type) {
case CMakeConfigItem::FILEPATH:
j.type = ConfigModel::DataItem::FILE;
break;
case CMakeConfigItem::PATH:
j.type = ConfigModel::DataItem::DIRECTORY;
break;
case CMakeConfigItem::BOOL:
j.type = ConfigModel::DataItem::BOOLEAN;
break;
case CMakeConfigItem::STRING:
j.type = ConfigModel::DataItem::STRING;
break;
default:
j.type = ConfigModel::DataItem::UNKNOWN;
break;
}
return j;
});
}
void CMakeProject::setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items)
{
if (!m_buildDirManager || m_buildDirManager->isBusy())
if (!bc)
return;
const CMakeConfig newConfig = Utils::transform(items, [](const ConfigModel::DataItem &i) {
CMakeConfigItem ni;
ni.key = i.key.toUtf8();
ni.value = i.value.toUtf8();
ni.documentation = i.description.toUtf8();
ni.isAdvanced = i.isAdvanced;
switch (i.type) {
case CMakeProjectManager::ConfigModel::DataItem::BOOLEAN:
ni.type = CMakeConfigItem::BOOL;
break;
case CMakeProjectManager::ConfigModel::DataItem::FILE:
ni.type = CMakeConfigItem::FILEPATH;
break;
case CMakeProjectManager::ConfigModel::DataItem::DIRECTORY:
ni.type = CMakeConfigItem::PATH;
break;
case CMakeProjectManager::ConfigModel::DataItem::STRING:
ni.type = CMakeConfigItem::STRING;
break;
case CMakeProjectManager::ConfigModel::DataItem::UNKNOWN:
default:
ni.type = CMakeConfigItem::INTERNAL;
break;
}
return ni;
});
// There is a buildDirManager, so there must also be an active BC:
QTC_ASSERT(activeTarget(), return);
QTC_ASSERT(activeTarget()->activeBuildConfiguration(), return);
auto bc = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
QTC_ASSERT(bc, return);
const CMakeConfig config = bc->cmakeConfiguration() + newConfig;
bc->setCMakeConfiguration(config);
m_buildDirManager->setInputConfiguration(config);
}
bool CMakeProject::isProjectFile(const FileName &fileName)
{
if (!m_buildDirManager)
return false;
return m_buildDirManager->isProjectFile(fileName);
BuildDirManager *bdm = bc->buildDirManager();
if (bdm && !bdm->isParsing())
bdm->forceReparse();
}
QList<CMakeBuildTarget> CMakeProject::buildTargets() const
{
if (!m_buildDirManager)
BuildDirManager *bdm = nullptr;
if (activeTarget() && activeTarget()->activeBuildConfiguration())
bdm = static_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration())->buildDirManager();
if (!bdm)
return QList<CMakeBuildTarget>();
return m_buildDirManager->buildTargets();
return bdm->buildTargets();
}
QStringList CMakeProject::buildTargetTitles(bool runnable) const
@@ -571,26 +416,22 @@ QString CMakeProject::displayName() const
QStringList CMakeProject::files(FilesMode fileMode) const
{
QStringList result;
if (m_buildDirManager) {
QList<FileNode *> nodes;
gatherFileNodes(rootProjectNode(), nodes);
nodes = Utils::filtered(nodes, [fileMode](const FileNode *fn) {
const bool isGenerated = fn->isGenerated();
switch (fileMode)
{
case ProjectExplorer::Project::SourceFiles:
return !isGenerated;
case ProjectExplorer::Project::GeneratedFiles:
return isGenerated;
case ProjectExplorer::Project::AllFiles:
default:
return true;
}
});
result = Utils::transform(nodes, [fileMode](const FileNode* fn) { return fn->filePath().toString(); });
}
return result;
QList<FileNode *> nodes;
gatherFileNodes(rootProjectNode(), nodes);
nodes = Utils::filtered(nodes, [fileMode](const FileNode *fn) {
const bool isGenerated = fn->isGenerated();
switch (fileMode)
{
case ProjectExplorer::Project::SourceFiles:
return !isGenerated;
case ProjectExplorer::Project::GeneratedFiles:
return isGenerated;
case ProjectExplorer::Project::AllFiles:
default:
return true;
}
});
return Utils::transform(nodes, [fileMode](const FileNode* fn) { return fn->filePath().toString(); });
}
Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *errorMessage)
@@ -599,13 +440,8 @@ Project::RestoreResult CMakeProject::fromMap(const QVariantMap &map, QString *er
if (result != RestoreResult::Ok)
return result;
m_activeTarget = activeTarget();
if (m_activeTarget) {
connect(m_activeTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::changeActiveBuildConfiguration);
if (BuildConfiguration *bc = m_activeTarget->activeBuildConfiguration())
changeActiveBuildConfiguration(bc);
}
handleActiveTargetChanged();
handleActiveBuildConfigurationChanged();
return RestoreResult::Ok;
}
@@ -620,6 +456,46 @@ bool CMakeProject::setupTarget(Target *t)
return true;
}
void CMakeProject::handleActiveTargetChanged()
{
if (m_connectedTarget) {
disconnect(m_connectedTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged);
}
m_connectedTarget = activeTarget();
if (m_connectedTarget) {
connect(m_connectedTarget, &Target::activeBuildConfigurationChanged,
this, &CMakeProject::handleActiveBuildConfigurationChanged);
}
}
void CMakeProject::handleActiveBuildConfigurationChanged()
{
if (!activeTarget() || !activeTarget()->activeBuildConfiguration())
return;
auto activeBc = qobject_cast<CMakeBuildConfiguration *>(activeTarget()->activeBuildConfiguration());
foreach (Target *t, targets()) {
foreach (BuildConfiguration *bc, t->buildConfigurations()) {
auto i = qobject_cast<CMakeBuildConfiguration *>(bc);
QTC_ASSERT(i, continue);
if (i == activeBc)
i->parse();
else
i->resetData();
}
}
}
void CMakeProject::handleParsingStarted()
{
if (activeTarget() && activeTarget()->activeBuildConfiguration() == sender())
emit parsingStarted();
}
CMakeBuildTarget CMakeProject::buildTargetForTitle(const QString &title)
{
foreach (const CMakeBuildTarget &ct, buildTargets())
@@ -807,3 +683,5 @@ void CMakeBuildTarget::clear()
compilerOptions.clear();
defines.clear();
}
} // namespace CMakeProjectManager

View File

@@ -27,7 +27,6 @@
#include "cmake_global.h"
#include "cmakeprojectnodes.h"
#include "configmodel.h"
#include <projectexplorer/extracompiler.h>
#include <projectexplorer/project.h>
@@ -104,39 +103,27 @@ public:
CMakeBuildTarget buildTargetForTitle(const QString &title);
bool isProjectFile(const Utils::FileName &fileName);
bool needsConfiguration() const override;
bool requiresTargetPanel() const override;
bool supportsKit(ProjectExplorer::Kit *k, QString *errorMessage = 0) const override;
void runCMake();
bool isParsing() const;
QList<ConfigModel::DataItem> currentCMakeConfiguration() const;
void setCurrentCMakeConfiguration(const QList<ConfigModel::DataItem> &items);
signals:
/// emitted when parsing starts:
/// emitted when cmake is running:
void parsingStarted();
/// emitted after parsing
void buildDirectoryDataAvailable(ProjectExplorer::BuildConfiguration *bc);
protected:
RestoreResult fromMap(const QVariantMap &map, QString *errorMessage) override;
bool setupTarget(ProjectExplorer::Target *t) override;
// called by CMakeBuildSettingsWidget
void changeBuildDirectory(Internal::CMakeBuildConfiguration *bc, const QString &newBuildDirectory);
private:
void handleKitChanges();
void handleActiveTargetChanged();
void handleActiveBuildConfigurationChanged();
void handleParsingStarted();
void parseCMakeOutput();
void activeTargetHasChanged(ProjectExplorer::Target *target);
void changeActiveBuildConfiguration(ProjectExplorer::BuildConfiguration*);
void updateRunConfigurations();
void buildTree(Internal::CMakeProjectNode *rootNode, QList<ProjectExplorer::FileNode *> list);
@@ -150,13 +137,14 @@ private:
bool extractCXXFlagsFromMake(const CMakeBuildTarget &buildTarget, QHash<QString, QStringList> &cache);
bool extractCXXFlagsFromNinja(const CMakeBuildTarget &buildTarget, QHash<QString, QStringList> &cache);
ProjectExplorer::Target *m_activeTarget = 0;
Internal::BuildDirManager *m_buildDirManager = 0;
ProjectExplorer::Target *m_connectedTarget = nullptr;
// TODO probably need a CMake specific node structure
QList<CMakeBuildTarget> m_buildTargets;
QFuture<void> m_codeModelFuture;
QList<ProjectExplorer::ExtraCompiler *> m_extraCompilers;
friend class Internal::CMakeBuildConfiguration;
};
} // namespace CMakeProjectManager

View File

@@ -0,0 +1,31 @@
QT += network
# AnalyzerBase files
SOURCES += \
$$PWD/ianalyzertool.cpp \
$$PWD/analyzerruncontrol.cpp \
$$PWD/analyzermanager.cpp \
$$PWD/analyzerrunconfigwidget.cpp \
$$PWD/analyzerutils.cpp \
$$PWD/detailederrorview.cpp \
$$PWD/diagnosticlocation.cpp \
$$PWD/startremotedialog.cpp
HEADERS += \
$$PWD/ianalyzertool.h \
$$PWD/analyzerbase_global.h \
$$PWD/analyzerconstants.h \
$$PWD/analyzerruncontrol.h \
$$PWD/analyzermanager.h \
$$PWD/analyzerstartparameters.h \
$$PWD/analyzerrunconfigwidget.h \
$$PWD/analyzerutils.h \
$$PWD/detailederrorview.h \
$$PWD/diagnosticlocation.h \
$$PWD/startremotedialog.h \
$$PWD/analyzericons.h
RESOURCES += \
$$PWD/analyzerbase.qrc

View File

@@ -27,12 +27,8 @@
#ifndef ANALYZERBASE_GLOBAL_H
#define ANALYZERBASE_GLOBAL_H
#include <qglobal.h>
#include "../debugger_global.h"
#if defined(ANALYZERBASE_LIBRARY)
# define ANALYZER_EXPORT Q_DECL_EXPORT
#else
# define ANALYZER_EXPORT Q_DECL_IMPORT
#endif
#define ANALYZER_EXPORT DEBUGGER_EXPORT
#endif // ANALYZERBASE_GLOBAL_H

View File

@@ -27,10 +27,11 @@
#include "analyzermanager.h"
#include "analyzericons.h"
#include "analyzerplugin.h"
#include "analyzerstartparameters.h"
#include "ianalyzertool.h"
#include "../debuggerplugin.h"
#include <coreplugin/coreicons.h>
#include <coreplugin/findplaceholder.h>
#include <coreplugin/icore.h>
@@ -77,7 +78,6 @@
using namespace Core;
using namespace Utils;
using namespace Core::Constants;
using namespace Analyzer::Internal;
using namespace Analyzer::Constants;
using namespace ProjectExplorer;
@@ -161,14 +161,14 @@ public:
public:
AnalyzerManager *q;
AnalyzerMode *m_mode;
bool m_isRunning;
FancyMainWindow *m_mainWindow;
AnalyzerAction *m_currentAction;
Internal::AnalyzerMode *m_mode = 0;
bool m_isRunning = false;
FancyMainWindow *m_mainWindow = 0;
AnalyzerAction *m_currentAction = 0;
QList<AnalyzerAction *> m_actions;
QAction *m_startAction;
QAction *m_stopAction;
ActionContainer *m_menu;
QAction *m_startAction = 0;
QAction *m_stopAction = 0;
ActionContainer *m_menu = 0;
QComboBox *m_toolBox;
QStackedWidget *m_controlsStackWidget;
QStackedWidget *m_statusLabelsStackWidget;
@@ -188,13 +188,6 @@ private:
AnalyzerManagerPrivate::AnalyzerManagerPrivate(AnalyzerManager *qq):
q(qq),
m_mode(0),
m_isRunning(false),
m_mainWindow(0),
m_currentAction(0),
m_startAction(0),
m_stopAction(0),
m_menu(0),
m_toolBox(new QComboBox),
m_controlsStackWidget(new QStackedWidget),
m_statusLabelsStackWidget(new QStackedWidget)
@@ -259,7 +252,7 @@ void AnalyzerManagerPrivate::delayedInit()
if (m_mode)
return;
m_mode = new AnalyzerMode(q);
m_mode = new Internal::AnalyzerMode(q);
createModeMainWindow();
connect(ModeManager::instance(), &ModeManager::currentModeChanged,
@@ -286,7 +279,7 @@ void AnalyzerManagerPrivate::delayedInit()
ICore::addContextObject(modeContextObject);
m_mode->setWidget(splitter);
AnalyzerPlugin::instance()->addAutoReleasedObject(m_mode);
Debugger::Internal::DebuggerPlugin::instance()->addAutoReleasedObject(m_mode);
// Populate Windows->Views menu with standard actions.
Context analyzerContext(C_ANALYZEMODE);
@@ -444,8 +437,8 @@ void AnalyzerManagerPrivate::selectSavedTool()
{
const QSettings *settings = ICore::settings();
if (settings->contains(QLatin1String(LAST_ACTIVE_TOOL))) {
const Id lastAction = Id::fromSetting(settings->value(QLatin1String(LAST_ACTIVE_TOOL)));
if (settings->contains(QLatin1String(Internal::LAST_ACTIVE_TOOL))) {
const Id lastAction = Id::fromSetting(settings->value(QLatin1String(Internal::LAST_ACTIVE_TOOL)));
foreach (AnalyzerAction *action, m_actions) {
if (action->toolId() == lastAction) {
selectAction(action);
@@ -497,7 +490,7 @@ void AnalyzerManagerPrivate::selectAction(AnalyzerAction *action)
m_statusLabelsStackWidget->addWidget(toolStatusLabel);
}
foreach (QDockWidget *widget, m_toolWidgets.value(toolId))
activateDock(Qt::DockWidgetArea(widget->property(INITIAL_DOCK_AREA).toInt()), widget);
activateDock(Qt::DockWidgetArea(widget->property(Internal::INITIAL_DOCK_AREA).toInt()), widget);
loadToolSettings(action->toolId());
@@ -581,7 +574,7 @@ void AnalyzerManagerPrivate::saveToolSettings(Id toolId)
m_mainWindow->saveSettings(settings);
settings->setValue(QLatin1String("ToolSettingsSaved"), true);
settings->endGroup();
settings->setValue(QLatin1String(LAST_ACTIVE_TOOL), toolId.toString());
settings->setValue(QLatin1String(Internal::LAST_ACTIVE_TOOL), toolId.toString());
}
void AnalyzerManagerPrivate::updateRunActions()
@@ -644,7 +637,7 @@ QDockWidget *AnalyzerManager::createDockWidget(Core::Id toolId,
{
QTC_ASSERT(!widget->objectName().isEmpty(), return 0);
QDockWidget *dockWidget = d->m_mainWindow->addDockForWidget(widget);
dockWidget->setProperty(INITIAL_DOCK_AREA, int(area));
dockWidget->setProperty(Internal::INITIAL_DOCK_AREA, int(area));
d->m_dockWidgets.append(AnalyzerManagerPrivate::DockPtr(dockWidget));
d->m_toolWidgets[toolId].push_back(dockWidget);
return dockWidget;

View File

Before

Width:  |  Height:  |  Size: 957 B

After

Width:  |  Height:  |  Size: 957 B

View File

Before

Width:  |  Height:  |  Size: 109 B

After

Width:  |  Height:  |  Size: 109 B

View File

Before

Width:  |  Height:  |  Size: 118 B

After

Width:  |  Height:  |  Size: 118 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 4.1 KiB

After

Width:  |  Height:  |  Size: 4.1 KiB

View File

Before

Width:  |  Height:  |  Size: 115 B

After

Width:  |  Height:  |  Size: 115 B

View File

Before

Width:  |  Height:  |  Size: 125 B

After

Width:  |  Height:  |  Size: 125 B

View File

@@ -148,5 +148,6 @@ include(lldb/lldb.pri)
include(qml/qml.pri)
include(namedemangler/namedemangler.pri)
include(console/console.pri)
include(analyzer/analyzer.pri)
include(shared/shared.pri)

View File

@@ -195,6 +195,12 @@ QtcPlugin {
files: ["*.png"]
}
Group {
name: "Images/analyzer"
prefix: "analyzer/images/"
files: ["*.png"]
}
Group {
name: "RegistryAccess"
condition: qbs.targetOS.contains("windows")
@@ -223,7 +229,36 @@ QtcPlugin {
]
}
Group {
name: "Analyzer"
files: [
"analyzer/analyzerbase.qrc",
"analyzer/analyzerbase_global.h",
"analyzer/analyzerconstants.h",
"analyzer/analyzericons.h",
"analyzer/analyzermanager.cpp",
"analyzer/analyzermanager.h",
"analyzer/analyzerrunconfigwidget.cpp",
"analyzer/analyzerrunconfigwidget.h",
"analyzer/analyzerruncontrol.cpp",
"analyzer/analyzerruncontrol.h",
"analyzer/analyzerstartparameters.h",
"analyzer/analyzerutils.cpp",
"analyzer/analyzerutils.h",
"analyzer/detailederrorview.cpp",
"analyzer/detailederrorview.h",
"analyzer/diagnosticlocation.cpp",
"analyzer/diagnosticlocation.h",
"analyzer/ianalyzertool.cpp",
"analyzer/ianalyzertool.h",
"analyzer/startremotedialog.cpp",
"analyzer/startremotedialog.h",
]
}
Export {
Depends { name: "QtcSsh" }
Depends { name: "CPlusPlus" }
}
}

View File

@@ -69,6 +69,9 @@
#include "commonoptionspage.h"
#include "gdb/startgdbserverdialog.h"
#include "analyzer/analyzerconstants.h"
#include "analyzer/analyzermanager.h"
#include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/actionmanager/actioncontainer.h>
#include <coreplugin/actionmanager/command.h>
@@ -99,6 +102,7 @@
#include <projectexplorer/project.h>
#include <projectexplorer/runnables.h>
#include <projectexplorer/session.h>
#include <projectexplorer/taskhub.h>
#include <projectexplorer/target.h>
#include <texteditor/texteditor.h>
@@ -386,6 +390,9 @@ using namespace ProjectExplorer;
using namespace TextEditor;
using namespace Utils;
using namespace Analyzer;
//using namespace Analyzer::Internal;
namespace CC = Core::Constants;
namespace PE = ProjectExplorer::Constants;
@@ -3168,16 +3175,25 @@ QSharedPointer<Internal::GlobalDebuggerOptions> globalDebuggerOptions()
is DebuggerCore, implemented in DebuggerPluginPrivate.
*/
static DebuggerPlugin *m_instance = 0;
DebuggerPlugin::DebuggerPlugin()
{
setObjectName(QLatin1String("DebuggerPlugin"));
dd = new DebuggerPluginPrivate(this);
m_instance = this;
}
DebuggerPlugin::~DebuggerPlugin()
{
delete dd;
dd = 0;
m_instance = 0;
}
DebuggerPlugin *DebuggerPlugin::instance()
{
return m_instance;
}
bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMessage)
@@ -3198,6 +3214,13 @@ bool DebuggerPlugin::initialize(const QStringList &arguments, QString *errorMess
KitManager::registerKitInformation(new DebuggerKitInformation);
// Ex-Analyzer stuff
(void) new AnalyzerManager(this);
// Task integration.
//: Category under which Analyzer tasks are listed in Issues view
ProjectExplorer::TaskHub::addCategory(Analyzer::Constants::ANALYZERTASK_ID, tr("Analyzer"));
return dd->initialize(arguments, errorMessage);
}
@@ -3205,6 +3228,7 @@ IPlugin::ShutdownFlag DebuggerPlugin::aboutToShutdown()
{
removeObject(this);
dd->aboutToShutdown();
AnalyzerManager::shutdown();
return SynchronousShutdown;
}

View File

@@ -43,14 +43,16 @@ public:
DebuggerPlugin();
~DebuggerPlugin();
static DebuggerPlugin *instance();
private:
// IPlugin implementation.
bool initialize(const QStringList &arguments, QString *errorMessage);
bool initialize(const QStringList &arguments, QString *errorMessage) override;
QObject *remoteCommand(const QStringList &options,
const QString &workingDirectory,
const QStringList &arguments);
ShutdownFlag aboutToShutdown();
void extensionsInitialized();
const QStringList &arguments) override;
ShutdownFlag aboutToShutdown() override;
void extensionsInitialized() override;
// Called from AppOutputPane::attachToRunControl().
Q_SLOT void attachExternalApplication(ProjectExplorer::RunControl *rc);

View File

@@ -8,7 +8,6 @@ QtcPlugin {
Depends { name: "QmakeProjectManager" }
Depends { name: "Debugger" }
Depends { name: "QtSupport" }
Depends { name: "AnalyzerBase" }
Depends { name: "QmlDebug" }
Depends { name: "Qt"; submodules: ["widgets", "xml", "network"] }

View File

@@ -6,5 +6,4 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
qmakeprojectmanager \
analyzerbase
qmakeprojectmanager

View File

@@ -34,14 +34,14 @@
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <projectexplorer/toolchain.h>
#include <projectexplorer/target.h>
#include <projectexplorer/taskhub.h>
#include <qtsupport/qtkitinformation.h>
#include <utils/fileutils.h>
#include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <utils/outputformat.h>
#include <utils/qtcprocess.h>

View File

@@ -32,9 +32,9 @@
#include "iosmanager.h"
#include "iosanalyzesupport.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectexplorerconstants.h>

View File

@@ -40,7 +40,6 @@ SUBDIRS = \
bazaar \
classview \
tasklist \
analyzerbase \
qmljstools \
macros \
remotelinux \

View File

@@ -4,7 +4,6 @@ Project {
name: "Plugins"
references: [
"analyzerbase/analyzerbase.qbs",
"android/android.qbs",
"autotest/autotest.qbs",
"autotoolsprojectmanager/autotoolsprojectmanager.qbs",

View File

@@ -11,7 +11,7 @@ QtcPlugin {
Depends { name: "Timeline" }
Depends { name: "Core" }
Depends { name: "AnalyzerBase" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "QtSupport" }
Depends { name: "TextEditor" }

View File

@@ -7,7 +7,7 @@ QTC_LIB_DEPENDS += \
timeline \
utils
QTC_PLUGIN_DEPENDS += \
analyzerbase \
debugger \
coreplugin \
projectexplorer \
qtsupport \

View File

@@ -29,7 +29,7 @@
#include "qmlprofilertool.h"
#include "qmlprofilertimelinemodel.h"
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <extensionsystem/pluginmanager.h>
#include <utils/hostosinfo.h>

View File

@@ -28,7 +28,7 @@
#include "qmlprofilerplugin.h"
#include "qmlprofilerconstants.h"
#include <analyzerbase/analyzerrunconfigwidget.h>
#include <debugger/analyzer/analyzerrunconfigwidget.h>
namespace QmlProfiler {
namespace Internal {

View File

@@ -28,8 +28,8 @@
#include "localqmlprofilerrunner.h"
#include "qmlprofilertool.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>

View File

@@ -28,7 +28,7 @@
#include "qmlprofilerstatemanager.h"
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <utils/outputformat.h>
namespace QmlProfiler {

View File

@@ -28,10 +28,10 @@
#include "qmlprofilerruncontrol.h"
#include "qmlprofilerrunconfigurationaspect.h"
#include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/debuggerrunconfigurationaspect.h>

View File

@@ -32,7 +32,7 @@
#include "qmlprofilereventsview.h"
#include <qmldebug/qmlprofilereventtypes.h>
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <utils/itemviews.h>
#include <QStandardItemModel>

View File

@@ -37,9 +37,9 @@
#include "qmlprofilersettings.h"
#include "qmlprofilerplugin.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <utils/fancymainwindow.h>
#include <utils/fileinprojectfinder.h>

View File

@@ -30,8 +30,8 @@
#include "qmlprofilerconstants.h"
#include "qmldebug/qmlprofilereventtypes.h"
#include <analyzerbase/ianalyzertool.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <debugger/analyzer/analyzerruncontrol.h>
QT_BEGIN_NAMESPACE
class QMessageBox;

View File

@@ -42,7 +42,7 @@
#include <aggregation/aggregate.h>
// Needed for the load&save actions in the context menu
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <coreplugin/findplaceholder.h>
#include <utils/styledbar.h>

View File

@@ -35,7 +35,7 @@
#include <coreplugin/icore.h>
#include <utils/qtcassert.h>
#include <utils/fancymainwindow.h>
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <extensionsystem/pluginmanager.h>
#include <QDockWidget>

View File

@@ -8,7 +8,6 @@ QtcPlugin {
Depends { name: "QmlDebug" }
Depends { name: "Utils" }
Depends { name: "AnalyzerBase" }
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }

View File

@@ -5,7 +5,6 @@ QTC_LIB_DEPENDS += \
qmldebug \
utils
QTC_PLUGIN_DEPENDS += \
analyzerbase \
coreplugin \
debugger \
projectexplorer \

View File

@@ -29,7 +29,7 @@
#include "qnxrunconfiguration.h"
#include "slog2inforunner.h"
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <projectexplorer/devicesupport/deviceapplicationrunner.h>
#include <projectexplorer/kitinformation.h>
#include <projectexplorer/target.h>

View File

@@ -37,10 +37,10 @@
#include <debugger/debuggerrunconfigurationaspect.h>
#include <debugger/debuggerstartparameters.h>
#include <debugger/debuggerkitinformation.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <projectexplorer/environmentaspect.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>

View File

@@ -8,7 +8,6 @@ QtcPlugin {
Depends { name: "QmlDebug" }
Depends { name: "Utils" }
Depends { name: "AnalyzerBase" }
Depends { name: "Core" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
@@ -114,7 +113,7 @@ QtcPlugin {
]
Export {
Depends { name: "AnalyzerBase" }
Depends { name: "Debugger" }
Depends { name: "Core" }
Depends { name: "QtcSsh" }
}

View File

@@ -8,5 +8,4 @@ QTC_PLUGIN_DEPENDS += \
coreplugin \
debugger \
projectexplorer \
qtsupport \
analyzerbase
qtsupport

View File

@@ -27,7 +27,7 @@
#include "remotelinuxrunconfiguration.h"
#include <analyzerbase/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/project.h>

View File

@@ -31,10 +31,10 @@
#include "remotelinuxrunconfiguration.h"
#include "remotelinuxruncontrol.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerruncontrol.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerruncontrol.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <debugger/debuggerruncontrol.h>
#include <debugger/debuggerrunconfigurationaspect.h>

View File

@@ -31,7 +31,7 @@
#include <valgrind/callgrind/callgrindcontroller.h>
#include <valgrind/callgrind/callgrindparser.h>
#include <analyzerbase/analyzermanager.h>
#include <debugger/analyzer/analyzermanager.h>
#include <utils/qtcassert.h>

View File

@@ -43,9 +43,9 @@
#include <valgrind/valgrindplugin.h>
#include <valgrind/valgrindsettings.h>
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerutils.h>
#include <analyzerbase/analyzerconstants.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerutils.h>
#include <debugger/analyzer/analyzerconstants.h>
#include <coreplugin/coreicons.h>
#include <coreplugin/icore.h>

View File

@@ -26,7 +26,7 @@
#ifndef CALLGRINDTOOL_H
#define CALLGRINDTOOL_H
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/ianalyzertool.h>
namespace Valgrind {
namespace Internal {

View File

@@ -27,7 +27,7 @@
#ifndef MEMCHECKERRORVIEW_H
#define MEMCHECKERRORVIEW_H
#include <analyzerbase/detailederrorview.h>
#include <debugger/analyzer/detailederrorview.h>
#include <QListView>

View File

@@ -30,9 +30,9 @@
#include "valgrindsettings.h"
#include "valgrindplugin.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerutils.h>
#include <analyzerbase/analyzerconstants.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerutils.h>
#include <debugger/analyzer/analyzerconstants.h>
#include <valgrind/valgrindsettings.h>
#include <valgrind/xmlprotocol/errorlistmodel.h>

View File

@@ -27,7 +27,7 @@
#ifndef MEMCHECKTOOL_H
#define MEMCHECKTOOL_H
#include <analyzerbase/ianalyzertool.h>
#include <debugger/analyzer/ianalyzertool.h>
#include <QSortFilterProxyModel>

View File

@@ -9,7 +9,6 @@ QtcPlugin {
Depends { name: "Utils" }
Depends { name: "Core" }
Depends { name: "AnalyzerBase" }
Depends { name: "Debugger" }
Depends { name: "ProjectExplorer" }
Depends { name: "TextEditor" }

View File

@@ -5,7 +5,6 @@ QTC_LIB_DEPENDS += \
ssh \
utils
QTC_PLUGIN_DEPENDS += \
analyzerbase \
coreplugin \
debugger \
projectexplorer \

View File

@@ -28,8 +28,8 @@
#include "valgrindsettings.h"
#include "valgrindplugin.h"
#include <analyzerbase/analyzermanager.h>
#include <analyzerbase/analyzerstartparameters.h>
#include <debugger/analyzer/analyzermanager.h>
#include <debugger/analyzer/analyzerstartparameters.h>
#include <coreplugin/icore.h>
#include <coreplugin/ioutputpane.h>

Some files were not shown because too many files have changed in this diff Show More