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.11 #418

Merged
merged 16 commits into from
Jan 18, 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
39 changes: 12 additions & 27 deletions src/project_manager/ros_build_configuration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,21 @@ ROSBuildConfiguration::ROSBuildConfiguration(Target *parent, Core::Id id)
{
}

void ROSBuildConfiguration::initialize(const ProjectExplorer::BuildInfo &info)
void ROSBuildConfiguration::initialize()
{
BuildConfiguration::initialize(info);
BuildConfiguration::initialize();

auto extraInfo = info.extraInfo.value<ROSExtraBuildInfo>();
const ROSExtraBuildInfo extra_info = extraInfo().value<ROSExtraBuildInfo>();

setDisplayName(info.displayName);
setDefaultDisplayName(info.displayName);
setBuildDirectory(info.buildDirectory);
setBuildSystem(extraInfo.buildSystem);
setCMakeBuildType(extraInfo.cmakeBuildType);
setBuildSystem(extra_info.buildSystem);
setCMakeBuildType(extra_info.cmakeBuildType);

BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
BuildStepList *cleanSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_CLEAN);
Q_ASSERT(buildSteps);
Q_ASSERT(cleanSteps);

switch (extraInfo.buildSystem)
switch (extra_info.buildSystem)
{
case ROSUtils::CatkinMake:
{
Expand Down Expand Up @@ -169,7 +166,7 @@ ROSProject *ROSBuildConfiguration::project()

void ROSBuildConfiguration::updateQtEnvironment(const Utils::Environment &env)
{
QList<Utils::EnvironmentItem> diff = baseEnvironment().diff(env);
const Utils::NameValueItems diff = baseEnvironment().diff(env);
if (!diff.isEmpty())
setUserEnvironmentChanges(diff);
}
Expand Down Expand Up @@ -201,29 +198,17 @@ ROSBuildConfigurationFactory::~ROSBuildConfigurationFactory()
{
}

QList<BuildInfo> ROSBuildConfigurationFactory::availableBuilds(const Target *parent) const
QList<BuildInfo> ROSBuildConfigurationFactory::availableBuilds(const Kit *k,
const Utils::FilePath &projectPath,
bool forSetup) const
{
QList<BuildInfo> result;

// Need to create a ROS Setting widget where the user sets the default build system to use here.
ROSUtils::BuildSystem buildSystem = static_cast<ROSProject *>(parent->project())->defaultBuildSystem();
Q_UNUSED(forSetup);

for (int type = ROSUtils::BuildTypeDebug; type <= ROSUtils::BuildTypeUserDefined; ++type)
{
ProjectExplorer::BuildInfo info = createBuildInfo(parent->kit(), buildSystem, ROSUtils::BuildType(type));
result << info;
}

return result;
}

QList<BuildInfo> ROSBuildConfigurationFactory::availableSetups(const Kit *k, const QString &projectPath) const
{
QList<BuildInfo> result;

// Need to create a ROS Setting widget where the user sets the default build system to use here.
ROSUtils::ROSProjectFileContent projectFileContent;
ROSUtils::parseQtCreatorWorkspaceFile(Utils::FilePath::fromString(projectPath), projectFileContent);
ROSUtils::parseQtCreatorWorkspaceFile(projectPath, projectFileContent);

for (int type = ROSUtils::BuildTypeDebug; type <= ROSUtils::BuildTypeUserDefined; ++type) {
ProjectExplorer::BuildInfo info = createBuildInfo(k, projectFileContent.defaultBuildSystem, ROSUtils::BuildType(type));
Expand Down
8 changes: 4 additions & 4 deletions src/project_manager/ros_build_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class ROSBuildConfiguration : public ProjectExplorer::BuildConfiguration
public:
ROSBuildConfiguration(ProjectExplorer::Target *parent, Core::Id id);

void initialize(const ProjectExplorer::BuildInfo &info) override;
void initialize() override;

ProjectExplorer::NamedWidget *createConfigWidget() override;
QList<ProjectExplorer::NamedWidget *> createSubConfigWidgets() override;
Expand Down Expand Up @@ -100,9 +100,9 @@ class ROSBuildConfigurationFactory : public ProjectExplorer::BuildConfigurationF
explicit ROSBuildConfigurationFactory();
~ROSBuildConfigurationFactory();

QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Target *parent) const override;
QList<ProjectExplorer::BuildInfo> availableSetups(const ProjectExplorer::Kit *k,
const QString &projectPath) const override;
QList<ProjectExplorer::BuildInfo> availableBuilds(const ProjectExplorer::Kit *k,
const Utils::FilePath &projectPath,
bool forSetup) const override;

private:
ProjectExplorer::BuildInfo createBuildInfo(const ProjectExplorer::Kit *k, const ROSUtils::BuildSystem &build_system, const ROSUtils::BuildType &type) const;
Expand Down
31 changes: 31 additions & 0 deletions src/project_manager/ros_build_system.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include "ros_build_system.h"

#include "ros_build_configuration.h"

using namespace ProjectExplorer;

namespace ROSProjectManager {
namespace Internal {

// --------------------------------------------------------------------
// ROSBuildSystem:
// --------------------------------------------------------------------

ROSBuildSystem::ROSBuildSystem(ROSProject *p)
: BuildSystem(p)
{
//
}

bool ROSBuildSystem::validateParsingContext(const ParsingContext &ctx)
{
return ctx.project && qobject_cast<ROSBuildConfiguration *>(ctx.buildConfiguration);
}

void ROSBuildSystem::parseProject(ParsingContext &&ctx)
{
ctx.guard.markAsSuccess();
}

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

#include <projectexplorer/buildsystem.h>

namespace ROSProjectManager {
namespace Internal {

class ROSProject;

// --------------------------------------------------------------------
// ROSBuildSystem:
// --------------------------------------------------------------------

class ROSBuildSystem : public ProjectExplorer::BuildSystem
{
Q_OBJECT

public:
explicit ROSBuildSystem(ROSProject *project);

protected:
bool validateParsingContext(const ParsingContext &ctx) final;
void parseProject(ParsingContext &&ctx) final;
};

} // namespace Internal
} // namespace ROSProjectManager
12 changes: 6 additions & 6 deletions src/project_manager/ros_catkin_make_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ bool ROSCatkinMakeStep::init()
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(Utils::FilePath::fromString(makeCommand()));
pp->setArguments(allArguments(bc->cmakeBuildType()));
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
Expand Down Expand Up @@ -202,9 +201,11 @@ QString ROSCatkinMakeStep::allArguments(ROSUtils::BuildType buildType, bool incl
return args;
}

QString ROSCatkinMakeStep::makeCommand() const
Utils::CommandLine ROSCatkinMakeStep::makeCommand(const QString &args) const
{
return QLatin1String("catkin_make");
Utils::CommandLine cmd(QLatin1String("catkin_make"));
cmd.addArgs(args, Utils::CommandLine::RawType::Raw);
return cmd;
}

void ROSCatkinMakeStep::stdOutput(const QString &line)
Expand Down Expand Up @@ -302,8 +303,7 @@ void ROSCatkinMakeStepWidget::updateDetails()
param.setMacroExpander(bc->macroExpander());
param.setWorkingDirectory(workspaceInfo.buildPath);
param.setEnvironment(bc->environment());
param.setCommand(Utils::FilePath::fromString(m_makeStep->makeCommand()));
param.setArguments(m_makeStep->allArguments(bc->cmakeBuildType(), false));
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}
Expand Down
2 changes: 1 addition & 1 deletion src/project_manager/ros_catkin_make_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class ROSCatkinMakeStep : public ProjectExplorer::AbstractProcessStep
BuildTargets buildTarget() const;
void setBuildTarget(const BuildTargets &target);
QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const;
QString makeCommand() const;
Utils::CommandLine makeCommand(const QString &args) const;
void stdOutput(const QString &line) override;

QVariantMap toMap() const override;
Expand Down
12 changes: 6 additions & 6 deletions src/project_manager/ros_catkin_tools_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,7 @@ bool ROSCatkinToolsStep::init()
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(Utils::FilePath::fromString(makeCommand()));
pp->setArguments(allArguments(bc->cmakeBuildType()));
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
Expand Down Expand Up @@ -229,9 +228,11 @@ QString ROSCatkinToolsStep::allArguments(ROSUtils::BuildType buildType, bool inc
return args;
}

QString ROSCatkinToolsStep::makeCommand() const
Utils::CommandLine ROSCatkinToolsStep::makeCommand(const QString &args) const
{
return QLatin1String("catkin");
Utils::CommandLine cmd(QLatin1String("catkin"));
cmd.addArgs(args, Utils::CommandLine::RawType::Raw);
return cmd;
}

void ROSCatkinToolsStep::stdOutput(const QString &line)
Expand Down Expand Up @@ -383,8 +384,7 @@ void ROSCatkinToolsStepWidget::updateDetails()
param.setMacroExpander(bc->macroExpander());
param.setEnvironment(bc->environment());
param.setWorkingDirectory(Utils::FilePath::fromString(m_makeStep->m_catkinToolsWorkingDir));
param.setCommand(Utils::FilePath::fromString(m_makeStep->makeCommand()));
param.setArguments(m_makeStep->allArguments(bc->cmakeBuildType(), false));
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}
Expand Down
2 changes: 1 addition & 1 deletion src/project_manager/ros_catkin_tools_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class ROSCatkinToolsStep : public ProjectExplorer::AbstractProcessStep
void setActiveProfile(const QString &profileName);

QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const;
QString makeCommand() const;
Utils::CommandLine makeCommand(const QString &args) const;
void stdOutput(const QString &line) override;

QVariantMap toMap() const override;
Expand Down
22 changes: 14 additions & 8 deletions src/project_manager/ros_colcon_step.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ bool ROSColconStep::init()
// addToEnvironment() to not screw up the users run environment.
env.set(QLatin1String("LC_ALL"), QLatin1String("C"));
pp->setEnvironment(env);
pp->setCommand(Utils::FilePath::fromString(makeCommand()));
pp->setArguments(allArguments(bc->cmakeBuildType()));
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
Expand Down Expand Up @@ -200,16 +199,24 @@ QString ROSColconStep::allArguments(ROSUtils::BuildType buildType, bool includeD
return args;
}

QString ROSColconStep::makeCommand() const
Utils::CommandLine ROSColconStep::makeCommand(const QString &args) const
{
QLatin1String exec;
switch(m_target) {
case BUILD:
return QLatin1String("colcon");
exec = QLatin1String("colcon");
break;
case CLEAN:
return QLatin1String("rm");
exec = QLatin1String("rm");
break;
default:
return QLatin1String("colcon");
exec = QLatin1String("colcon");
break;
}

Utils::CommandLine cmd(exec);
cmd.addArgs(args, Utils::CommandLine::RawType::Raw);
return cmd;
}

void ROSColconStep::stdOutput(const QString &line)
Expand Down Expand Up @@ -305,8 +312,7 @@ void ROSColconStepWidget::updateDetails()
param.setMacroExpander(bc->macroExpander());
param.setWorkingDirectory(workspaceInfo.buildPath);
param.setEnvironment(bc->environment());
param.setCommand(Utils::FilePath::fromString(m_makeStep->makeCommand()));
param.setArguments(m_makeStep->allArguments(bc->cmakeBuildType(), false));
param.setCommandLine(m_makeStep->makeCommand(m_makeStep->allArguments(bc->cmakeBuildType(), false)));
m_summaryText = param.summary(displayName());
emit updateSummary();
}
Expand Down
2 changes: 1 addition & 1 deletion src/project_manager/ros_colcon_step.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class ROSColconStep : public ProjectExplorer::AbstractProcessStep
void setBuildTarget(const BuildTargets &target);

QString allArguments(ROSUtils::BuildType buildType, bool includeDefault = true) const;
QString makeCommand() const;
Utils::CommandLine makeCommand(const QString &args) const;
void stdOutput(const QString &line) override;

QVariantMap toMap() const override;
Expand Down
Loading