Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

port to Qt Creator 4.14 #417

Merged
merged 5 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions src/project_manager/ros_build_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,49 @@ void ROSBuildSystem::triggerParsing()
guardParsingRun().markAsSuccess();
}

bool ROSBuildSystem::addFiles(ProjectExplorer::Node *context, const QStringList &filePaths, QStringList *notAdded)
{
return true;
}

ProjectExplorer::RemovedFilesFromProject ROSBuildSystem::removeFiles(ProjectExplorer::Node *context, const QStringList &filePaths, QStringList *notRemoved)
{
return ProjectExplorer::RemovedFilesFromProject::Ok;
}

bool ROSBuildSystem::deleteFiles(ProjectExplorer::Node *context, const QStringList &filePaths)
{
return true;
}

bool ROSBuildSystem::canRenameFile(ProjectExplorer::Node *context, const QString &filePath, const QString &newFilePath)
{
return true;
}

bool ROSBuildSystem::renameFile(ProjectExplorer::Node *context, const QString &filePath, const QString &newFilePath)
{
return true;
}

bool ROSBuildSystem::addDependencies(ProjectExplorer::Node *context, const QStringList &dependencies)
{
return true;
}

bool ROSBuildSystem::supportsAction(ProjectExplorer::Node *context, ProjectExplorer::ProjectAction action, const ProjectExplorer::Node *node) const
{
static const std::set<ProjectAction> possible_actions = {
ProjectAction::AddNewFile,
ProjectAction::AddExistingFile,
ProjectAction::AddExistingDirectory,
ProjectAction::RemoveFile,
ProjectAction::EraseFile,
ProjectAction::Rename,
};

return possible_actions.count(action);
}

} // namespace Internal
} // namespace ROSProjectManager
10 changes: 10 additions & 0 deletions src/project_manager/ros_build_system.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <projectexplorer/buildsystem.h>
#include <projectexplorer/projectnodes.h>

namespace ROSProjectManager {
namespace Internal {
Expand All @@ -19,6 +20,15 @@ class ROSBuildSystem : public ProjectExplorer::BuildSystem
explicit ROSBuildSystem(ROSBuildConfiguration *bc);

void triggerParsing() final;

virtual bool addFiles(ProjectExplorer::Node *context, const QStringList &filePaths, QStringList *notAdded = nullptr) final;
virtual ProjectExplorer::RemovedFilesFromProject removeFiles(ProjectExplorer::Node *context, const QStringList &filePaths,
QStringList *notRemoved = nullptr) final;
virtual bool deleteFiles(ProjectExplorer::Node *context, const QStringList &filePaths) final;
virtual bool canRenameFile(ProjectExplorer::Node *context, const QString &filePath, const QString &newFilePath) final;
virtual bool renameFile(ProjectExplorer::Node *context, const QString &filePath, const QString &newFilePath) final;
virtual bool addDependencies(ProjectExplorer::Node *context, const QStringList &dependencies) final;
virtual bool supportsAction(ProjectExplorer::Node *context, ProjectExplorer::ProjectAction action, const ProjectExplorer::Node *node) const final;
};

} // namespace Internal
Expand Down
10 changes: 1 addition & 9 deletions src/project_manager/ros_catkin_make_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ bool ROSCatkinMakeStep::init()
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommandLine(makeCommand(allArguments(bc->cmakeBuildType())));
pp->resolveAll();

// If we are cleaning, then make can fail with an error code, but that doesn't mean
// we should stop the clean queue
Expand Down Expand Up @@ -212,11 +211,6 @@ void ROSCatkinMakeStep::stdOutput(const QString &line)
}
}

BuildStepConfigWidget *ROSCatkinMakeStep::createConfigWidget()
{
return new ROSCatkinMakeStepWidget(this);
}

ROSCatkinMakeStep::BuildTargets ROSCatkinMakeStep::buildTarget() const
{
return m_target;
Expand All @@ -232,8 +226,7 @@ void ROSCatkinMakeStep::setBuildTarget(const BuildTargets &target)
//

ROSCatkinMakeStepWidget::ROSCatkinMakeStepWidget(ROSCatkinMakeStep *makeStep)
: ProjectExplorer::BuildStepConfigWidget(makeStep)
, m_makeStep(makeStep)
: m_makeStep(makeStep)
{
m_ui = new Ui::ROSCatkinMakeStep;
m_ui->setupUi(this);
Expand Down Expand Up @@ -295,7 +288,6 @@ void ROSCatkinMakeStepWidget::updateDetails()
param.setEnvironment(bc->environment());
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}

void ROSCatkinMakeStepWidget::updateBuildSystem(const ROSUtils::BuildSystem &buildSystem)
Expand Down
3 changes: 1 addition & 2 deletions src/project_manager/ros_catkin_make_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class ROSCatkinMakeStep : public ProjectExplorer::AbstractProcessStep

bool init() override;
void setupOutputFormatter(Utils::OutputFormatter *formatter) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;

ROSBuildConfiguration *rosBuildConfiguration() const;
BuildTargets buildTarget() const;
Expand All @@ -77,7 +76,7 @@ class ROSCatkinMakeStep : public ProjectExplorer::AbstractProcessStep
QRegExp m_percentProgress;
};

class ROSCatkinMakeStepWidget : public ProjectExplorer::BuildStepConfigWidget
class ROSCatkinMakeStepWidget : public QWidget
{
Q_OBJECT

Expand Down
14 changes: 3 additions & 11 deletions src/project_manager/ros_catkin_tools_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
#include <utils/qtcassert.h>
#include <utils/qtcprocess.h>
#include <cmakeprojectmanager/cmakeparser.h>
#include <coreplugin/variablechooser.h>
#include <utils/variablechooser.h>
#include <coreplugin/messagemanager.h>

#include <fstream>
Expand Down Expand Up @@ -126,7 +126,6 @@ bool ROSCatkinToolsStep::init()
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommandLine(makeCommand(allArguments(bc->cmakeBuildType())));
pp->resolveAll();

// If we are cleaning, then make can fail with an error code, but that doesn't mean
// we should stop the clean queue
Expand Down Expand Up @@ -238,11 +237,6 @@ void ROSCatkinToolsStep::stdOutput(const QString &line)
}
}

BuildStepConfigWidget *ROSCatkinToolsStep::createConfigWidget()
{
return new ROSCatkinToolsStepWidget(this);
}

ROSCatkinToolsStep::BuildTargets ROSCatkinToolsStep::buildTarget() const
{
return m_target;
Expand All @@ -268,8 +262,7 @@ void ROSCatkinToolsStep::setActiveProfile(const QString &profileName)
//

ROSCatkinToolsStepWidget::ROSCatkinToolsStepWidget(ROSCatkinToolsStep *makeStep)
: ProjectExplorer::BuildStepConfigWidget(makeStep)
, m_makeStep(makeStep)
: m_makeStep(makeStep)
{
m_ui = new Ui::ROSCatkinToolsStep;
m_ui->setupUi(this);
Expand Down Expand Up @@ -345,7 +338,7 @@ ROSCatkinToolsStepWidget::ROSCatkinToolsStepWidget(ROSCatkinToolsStep *makeStep)
connect(ProjectExplorerPlugin::instance(), SIGNAL(settingsChanged()),
this, SLOT(updateDetails()));

Core::VariableChooser::addSupportForChildWidgets(this, makeStep->rosBuildConfiguration()->macroExpander());
Utils::VariableChooser::addSupportForChildWidgets(this, makeStep->rosBuildConfiguration()->macroExpander());
}

ROSCatkinToolsStepWidget::~ROSCatkinToolsStepWidget()
Expand Down Expand Up @@ -377,7 +370,6 @@ void ROSCatkinToolsStepWidget::updateDetails()
param.setWorkingDirectory(Utils::FilePath::fromString(m_makeStep->m_catkinToolsWorkingDir));
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}

void ROSCatkinToolsStepWidget::updateBuildSystem(const ROSUtils::BuildSystem &buildSystem)
Expand Down
3 changes: 1 addition & 2 deletions src/project_manager/ros_catkin_tools_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ class ROSCatkinToolsStep : public ProjectExplorer::AbstractProcessStep

bool init() override;
void setupOutputFormatter(Utils::OutputFormatter *formatter) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;

ROSBuildConfiguration *rosBuildConfiguration() const;
BuildTargets buildTarget() const;
Expand Down Expand Up @@ -92,7 +91,7 @@ class ROSCatkinToolsStep : public ProjectExplorer::AbstractProcessStep
QRegExp m_percentProgress;
};

class ROSCatkinToolsStepWidget : public ProjectExplorer::BuildStepConfigWidget
class ROSCatkinToolsStepWidget : public QWidget
{
Q_OBJECT

Expand Down
10 changes: 1 addition & 9 deletions src/project_manager/ros_colcon_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ bool ROSColconStep::init()
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommandLine(makeCommand(allArguments(bc->cmakeBuildType())));
pp->resolveAll();

// If we are cleaning, then make can fail with an error code, but that doesn't mean
// we should stop the clean queue
Expand Down Expand Up @@ -221,11 +220,6 @@ void ROSColconStep::stdOutput(const QString &line)
}
}

BuildStepConfigWidget *ROSColconStep::createConfigWidget()
{
return new ROSColconStepWidget(this);
}

ROSColconStep::BuildTargets ROSColconStep::buildTarget() const
{
return m_target;
Expand All @@ -241,8 +235,7 @@ void ROSColconStep::setBuildTarget(const BuildTargets &target)
//

ROSColconStepWidget::ROSColconStepWidget(ROSColconStep *makeStep)
: ProjectExplorer::BuildStepConfigWidget(makeStep)
, m_makeStep(makeStep)
: m_makeStep(makeStep)
{
m_ui = new Ui::ROSColconStep;
m_ui->setupUi(this);
Expand Down Expand Up @@ -304,7 +297,6 @@ void ROSColconStepWidget::updateDetails()
param.setEnvironment(bc->environment());
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}

void ROSColconStepWidget::updateBuildSystem(const ROSUtils::BuildSystem &buildSystem)
Expand Down
3 changes: 1 addition & 2 deletions src/project_manager/ros_colcon_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ class ROSColconStep : public ProjectExplorer::AbstractProcessStep

bool init() override;
void setupOutputFormatter(Utils::OutputFormatter *formatter) override;
ProjectExplorer::BuildStepConfigWidget *createConfigWidget() override;

ROSBuildConfiguration *rosBuildConfiguration() const;
BuildTargets buildTarget() const;
Expand All @@ -78,7 +77,7 @@ class ROSColconStep : public ProjectExplorer::AbstractProcessStep
QRegExp m_percentProgress;
};

class ROSColconStepWidget : public ProjectExplorer::BuildStepConfigWidget
class ROSColconStepWidget : public QWidget
{
Q_OBJECT

Expand Down
7 changes: 5 additions & 2 deletions src/project_manager/ros_project.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ void ROSProject::buildCppCodeModel(const ROSUtils::WorkspaceInfo workspaceInfo,

ProjectExplorer::RawProjectParts rpps;

ToolChain *cxxToolChain = ToolChainKitAspect::toolChain(k, ProjectExplorer::Constants::CXX_LANGUAGE_ID);
const ToolChain *cxxToolChain = ToolChainKitAspect::cxxToolChain(k);

QString pattern = "^.*\\.(" + QRegularExpression::escape("c") +
"|" + QRegularExpression::escape("cc") +
Expand Down Expand Up @@ -520,7 +520,10 @@ void ROSProject::buildCppCodeModel(const ROSUtils::WorkspaceInfo workspaceInfo,
rpp.setMacros(ProjectExplorer::Macro::toMacros(defineArg.toUtf8()));

QSet<QString> toolChainIncludes;
for (const HeaderPath &hp : cxxToolChain->builtInHeaderPaths(targetInfo.flags, sysRoot, env)) {
const HeaderPaths header_paths = \
cxxToolChain->createBuiltInHeaderPathsRunner(env)\
(targetInfo.flags, sysRoot.toString(), QString());
for (const HeaderPath &hp : header_paths) {
toolChainIncludes.insert(hp.path);
}

Expand Down