aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-10-23 12:59:45 +0200
committerEike Ziller <eike.ziller@qt.io>2019-10-23 11:12:58 +0000
commit126fe0fa0b58e3d70ca1109336f784d5659c846f (patch)
treee3e709a002e17af626191858e5ceeb628f2f1749 /plugins
parent160059525a52aa43e6ef694dec8a65691d35bd75 (diff)
Adapt to changes in Qt Creator 4.11
Change-Id: Ife586f245ffb60626372701e649b8f1df9e5aea5 Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/haskell/haskellbuildconfiguration.cpp39
-rw-r--r--plugins/haskell/haskellbuildconfiguration.h9
-rw-r--r--plugins/haskell/haskellconstants.h1
-rw-r--r--plugins/haskell/haskellproject.cpp8
-rw-r--r--plugins/haskell/haskellproject.h2
-rw-r--r--plugins/haskell/haskellrunconfiguration.cpp5
-rw-r--r--plugins/haskell/haskellrunconfiguration.h10
-rw-r--r--plugins/haskell/stackbuildstep.cpp22
8 files changed, 45 insertions, 51 deletions
diff --git a/plugins/haskell/haskellbuildconfiguration.cpp b/plugins/haskell/haskellbuildconfiguration.cpp
index 0233e15..ebf5960 100644
--- a/plugins/haskell/haskellbuildconfiguration.cpp
+++ b/plugins/haskell/haskellbuildconfiguration.cpp
@@ -58,35 +58,20 @@ HaskellBuildConfigurationFactory::HaskellBuildConfigurationFactory()
setSupportedProjectMimeTypeName(Constants::C_HASKELL_PROJECT_MIMETYPE);
}
-static QList<BuildInfo> createInfos(const HaskellBuildConfigurationFactory *factory,
- const Kit *k,
- const Utils::FilePath &projectFilePath)
+QList<BuildInfo> HaskellBuildConfigurationFactory::availableBuilds(
+ const Kit *k, const Utils::FilePath &projectPath, bool forSetup) const
{
- BuildInfo info(factory);
+ BuildInfo info(this);
info.typeName = HaskellBuildConfigurationFactory::tr("Release");
- info.displayName = info.typeName;
- info.buildDirectory = projectFilePath.parentDir().pathAppended(".stack-work");
+ if (forSetup) {
+ info.displayName = info.typeName;
+ info.buildDirectory = projectPath.parentDir().pathAppended(".stack-work");
+ }
info.kitId = k->id();
info.buildType = BuildConfiguration::BuildType::Release;
return {info};
}
-QList<BuildInfo> HaskellBuildConfigurationFactory::availableBuilds(const Target *parent) const
-{
- // Entries that are available in add build configuration dropdown
- return Utils::transform(createInfos(this, parent->kit(), parent->project()->projectFilePath()),
- [](BuildInfo info) {
- info.displayName.clear();
- return info;
- });
-}
-
-QList<BuildInfo> HaskellBuildConfigurationFactory::availableSetups(
- const Kit *k, const QString &projectPath) const
-{
- return createInfos(this, k, Utils::FilePath::fromString(projectPath));
-}
-
HaskellBuildConfiguration::HaskellBuildConfiguration(Target *target, Core::Id id)
: BuildConfiguration(target, id)
{}
@@ -106,12 +91,12 @@ void HaskellBuildConfiguration::setBuildType(BuildConfiguration::BuildType type)
m_buildType = type;
}
-void HaskellBuildConfiguration::initialize(const BuildInfo &info)
+void HaskellBuildConfiguration::initialize()
{
- BuildConfiguration::initialize(info);
- setBuildDirectory(info.buildDirectory);
- setBuildType(info.buildType);
- setDisplayName(info.displayName);
+ BuildConfiguration::initialize();
+ setBuildDirectory(initialBuildDirectory());
+ setBuildType(initialBuildType());
+ setDisplayName(initialDisplayName());
BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
auto stackBuildStep = new StackBuildStep(buildSteps);
diff --git a/plugins/haskell/haskellbuildconfiguration.h b/plugins/haskell/haskellbuildconfiguration.h
index c45c35f..5516626 100644
--- a/plugins/haskell/haskellbuildconfiguration.h
+++ b/plugins/haskell/haskellbuildconfiguration.h
@@ -38,10 +38,9 @@ class HaskellBuildConfigurationFactory : public ProjectExplorer::BuildConfigurat
public:
HaskellBuildConfigurationFactory();
- 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;
};
class HaskellBuildConfiguration : public ProjectExplorer::BuildConfiguration
@@ -54,7 +53,7 @@ public:
ProjectExplorer::NamedWidget *createConfigWidget() override;
BuildType buildType() const override;
void setBuildType(BuildType type);
- void initialize(const ProjectExplorer::BuildInfo &info) override;
+ void initialize() override;
private:
BuildType m_buildType = BuildType::Release;
diff --git a/plugins/haskell/haskellconstants.h b/plugins/haskell/haskellconstants.h
index 23463eb..9dd18a6 100644
--- a/plugins/haskell/haskellconstants.h
+++ b/plugins/haskell/haskellconstants.h
@@ -32,6 +32,7 @@ const char C_HASKELLEDITOR_ID[] = "Haskell.HaskellEditor";
const char C_HASKELLSNIPPETSGROUP_ID[] = "Haskell";
const char C_HASKELL_PROJECT_MIMETYPE[] = "text/x-haskell-project";
const char C_HASKELL_PROJECT_ID[] = "Haskell.Project";
+const char C_HASKELL_RUNCONFIG_ID[] = "Haskell.RunConfiguration";
const char OPTIONS_GENERAL[] = "Haskell.A.General";
} // namespace Haskell
diff --git a/plugins/haskell/haskellproject.cpp b/plugins/haskell/haskellproject.cpp
index 92b30e6..fdea603 100644
--- a/plugins/haskell/haskellproject.cpp
+++ b/plugins/haskell/haskellproject.cpp
@@ -70,12 +70,13 @@ HaskellProjectNode::HaskellProjectNode(const FilePath &projectFilePath)
{}
HaskellProject::HaskellProject(const Utils::FilePath &fileName)
- : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName, [this] { refresh(); })
+ : Project(Constants::C_HASKELL_PROJECT_MIMETYPE, fileName)
{
setId(Constants::C_HASKELL_PROJECT_ID);
setDisplayName(fileName.toFileInfo().completeBaseName());
updateFiles();
connect(this, &Project::activeTargetChanged, this, &HaskellProject::updateApplicationTargets);
+ connect(this, &Project::projectFileIsDirty, this, &HaskellProject::refresh);
}
bool HaskellProject::isHaskellProject(Project *project)
@@ -85,7 +86,7 @@ bool HaskellProject::isHaskellProject(Project *project)
void HaskellProject::updateFiles()
{
- emitParsingStarted();
+ m_parseGuard = guardParsingRun();
FilePath projectDir = projectDirectory();
QFuture<QList<FileNode *>> future = Utils::runAsync([this, projectDir] {
return FileNode::scanForFiles(projectDir, [this](const FilePath &fn) -> FileNode * {
@@ -104,7 +105,8 @@ void HaskellProject::updateFiles()
});
root->addNestedNodes(std::move(nodePtrs));
setRootProjectNode(std::unique_ptr<ProjectNode>(root));
- emitParsingFinished(true);
+ m_parseGuard.markAsSuccess();
+ m_parseGuard = {};
});
}
diff --git a/plugins/haskell/haskellproject.h b/plugins/haskell/haskellproject.h
index 0afb717..4f6e1e4 100644
--- a/plugins/haskell/haskellproject.h
+++ b/plugins/haskell/haskellproject.h
@@ -50,6 +50,8 @@ private:
void updateFiles();
void updateApplicationTargets(ProjectExplorer::Target *target);
void refresh();
+
+ ParseGuard m_parseGuard;
};
} // namespace Internal
diff --git a/plugins/haskell/haskellrunconfiguration.cpp b/plugins/haskell/haskellrunconfiguration.cpp
index 78ea231..f2f47c5 100644
--- a/plugins/haskell/haskellrunconfiguration.cpp
+++ b/plugins/haskell/haskellrunconfiguration.cpp
@@ -25,7 +25,6 @@
#include "haskellrunconfiguration.h"
-#include "haskellconstants.h"
#include "haskellmanager.h"
#include "haskellproject.h"
@@ -43,7 +42,7 @@ namespace Internal {
HaskellRunConfigurationFactory::HaskellRunConfigurationFactory()
{
- registerRunConfiguration<HaskellRunConfiguration>("Haskell.RunConfiguration");
+ registerRunConfiguration<HaskellRunConfiguration>(Constants::C_HASKELL_RUNCONFIG_ID);
addSupportedProjectType(Constants::C_HASKELL_PROJECT_ID);
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
}
@@ -96,7 +95,7 @@ Runnable HaskellRunConfiguration::runnable() const
r.commandLineArguments += " -- " + arguments;
r.workingDirectory = projectDirectory;
r.environment = aspect<LocalEnvironmentAspect>()->environment();
- r.executable = r.environment.searchInPath(HaskellManager::stackExecutable().toString()).toString();
+ r.executable = r.environment.searchInPath(HaskellManager::stackExecutable().toString());
return r;
}
diff --git a/plugins/haskell/haskellrunconfiguration.h b/plugins/haskell/haskellrunconfiguration.h
index 62bbd3d..529544e 100644
--- a/plugins/haskell/haskellrunconfiguration.h
+++ b/plugins/haskell/haskellrunconfiguration.h
@@ -25,6 +25,8 @@
#pragma once
+#include "haskellconstants.h"
+
#include <projectexplorer/runconfigurationaspects.h>
#include <projectexplorer/runcontrol.h>
@@ -49,9 +51,11 @@ public:
HaskellRunConfigurationFactory();
private:
- ProjectExplorer::SimpleRunWorkerFactory<ProjectExplorer::SimpleTargetRunner,
- HaskellRunConfiguration>
- runWorkerFactory;
+ ProjectExplorer::RunWorkerFactory runWorkerFactory{
+ ProjectExplorer::RunWorkerFactory::make<ProjectExplorer::SimpleTargetRunner>(),
+ {ProjectExplorer::Constants::NORMAL_RUN_MODE},
+ {Constants::C_HASKELL_RUNCONFIG_ID},
+ {ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE}};
};
class HaskellExecutableAspect : public ProjectExplorer::BaseStringAspect
diff --git a/plugins/haskell/stackbuildstep.cpp b/plugins/haskell/stackbuildstep.cpp
index 931fa32..25b6622 100644
--- a/plugins/haskell/stackbuildstep.cpp
+++ b/plugins/haskell/stackbuildstep.cpp
@@ -44,26 +44,28 @@ StackBuildStep::StackBuildStep(ProjectExplorer::BuildStepList *bsl)
{
setDefaultDisplayName(trDisplayName());
- const auto updateArguments = [this] {
+ const auto updateCommandLine = [this] {
const auto projectDir = QDir(project()->projectDirectory().toString());
- processParameters()->setArguments(
- "build --work-dir \""
- + projectDir.relativeFilePath(buildConfiguration()->buildDirectory().toString()) + "\"");
+ processParameters()->setCommandLine(
+ {HaskellManager::stackExecutable(),
+ {"build",
+ "--work-dir",
+ projectDir.relativeFilePath(buildConfiguration()->buildDirectory().toString())}});
};
const auto updateEnvironment = [this] {
processParameters()->setEnvironment(buildConfiguration()->environment());
};
- processParameters()->setCommand(HaskellManager::stackExecutable());
- updateArguments();
+ updateCommandLine();
processParameters()->setWorkingDirectory(project()->projectDirectory());
updateEnvironment();
connect(HaskellManager::instance(),
&HaskellManager::stackExecutableChanged,
this,
- [this](const Utils::FilePath &stackExe) {
- processParameters()->setCommand(stackExe);
- });
- connect(buildConfiguration(), &BuildConfiguration::buildDirectoryChanged, this, updateArguments);
+ updateCommandLine);
+ connect(buildConfiguration(),
+ &BuildConfiguration::buildDirectoryChanged,
+ this,
+ updateCommandLine);
connect(buildConfiguration(), &BuildConfiguration::environmentChanged, this, updateEnvironment);
}