aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2019-12-19 15:12:08 +0100
committerEike Ziller <eike.ziller@qt.io>2019-12-20 09:29:24 +0000
commit9dd2477c2a9f7383e9eaa0b6f6b1f7691baae1f1 (patch)
tree721f3301b09693c5475f6fd2efbf4e6ab64c4a94 /plugins
parentb7fd81f7ad7d4b5df8f3934708ab6bc0b3acb14e (diff)
Adapt to changes in upstream
Change-Id: Ib541f1cedacf4472223d11ae545a3d444190180c Reviewed-by: hjk <hjk@qt.io>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/haskell/haskellbuildconfiguration.cpp26
-rw-r--r--plugins/haskell/haskellbuildconfiguration.h1
-rw-r--r--plugins/haskell/haskellproject.cpp63
-rw-r--r--plugins/haskell/haskellproject.h21
-rw-r--r--plugins/haskell/haskellrunconfiguration.cpp14
-rw-r--r--plugins/haskell/haskellrunconfiguration.h1
6 files changed, 58 insertions, 68 deletions
diff --git a/plugins/haskell/haskellbuildconfiguration.cpp b/plugins/haskell/haskellbuildconfiguration.cpp
index ebf5960..dcd582a 100644
--- a/plugins/haskell/haskellbuildconfiguration.cpp
+++ b/plugins/haskell/haskellbuildconfiguration.cpp
@@ -74,7 +74,16 @@ QList<BuildInfo> HaskellBuildConfigurationFactory::availableBuilds(
HaskellBuildConfiguration::HaskellBuildConfiguration(Target *target, Core::Id id)
: BuildConfiguration(target, id)
-{}
+{
+ setInitializer([this](const BuildInfo &info) {
+ setBuildDirectory(info.buildDirectory);
+ setBuildType(info.buildType);
+ setDisplayName(info.displayName);
+
+ auto stackBuildStep = new StackBuildStep(buildSteps());
+ buildSteps()->appendStep(stackBuildStep);
+ });
+}
NamedWidget *HaskellBuildConfiguration::createConfigWidget()
{
@@ -91,23 +100,10 @@ void HaskellBuildConfiguration::setBuildType(BuildConfiguration::BuildType type)
m_buildType = type;
}
-void HaskellBuildConfiguration::initialize()
-{
- BuildConfiguration::initialize();
- setBuildDirectory(initialBuildDirectory());
- setBuildType(initialBuildType());
- setDisplayName(initialDisplayName());
-
- BuildStepList *buildSteps = stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD);
- auto stackBuildStep = new StackBuildStep(buildSteps);
- buildSteps->appendStep(stackBuildStep);
-}
-
HaskellBuildConfigurationWidget::HaskellBuildConfigurationWidget(HaskellBuildConfiguration *bc)
- : NamedWidget()
+ : NamedWidget(tr("General"))
, m_buildConfiguration(bc)
{
- setDisplayName(tr("General"));
setLayout(new QVBoxLayout);
layout()->setMargin(0);
auto box = new Utils::DetailsWidget;
diff --git a/plugins/haskell/haskellbuildconfiguration.h b/plugins/haskell/haskellbuildconfiguration.h
index 5516626..f07f918 100644
--- a/plugins/haskell/haskellbuildconfiguration.h
+++ b/plugins/haskell/haskellbuildconfiguration.h
@@ -53,7 +53,6 @@ public:
ProjectExplorer::NamedWidget *createConfigWidget() override;
BuildType buildType() const override;
void setBuildType(BuildType type);
- void initialize() override;
private:
BuildType m_buildType = BuildType::Release;
diff --git a/plugins/haskell/haskellproject.cpp b/plugins/haskell/haskellproject.cpp
index fdea603..c4d4318 100644
--- a/plugins/haskell/haskellproject.cpp
+++ b/plugins/haskell/haskellproject.cpp
@@ -65,18 +65,12 @@ static QVector<QString> parseExecutableNames(const FilePath &projectFilePath)
return result;
}
-HaskellProjectNode::HaskellProjectNode(const FilePath &projectFilePath)
- : ProjectNode(projectFilePath)
-{}
-
HaskellProject::HaskellProject(const Utils::FilePath &fileName)
: 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);
+ setBuildSystemCreator([](Target *t) { return new HaskellBuildSystem(t); });
}
bool HaskellProject::isHaskellProject(Project *project)
@@ -84,35 +78,43 @@ bool HaskellProject::isHaskellProject(Project *project)
return project && project->id() == Constants::C_HASKELL_PROJECT_ID;
}
-void HaskellProject::updateFiles()
+HaskellBuildSystem::HaskellBuildSystem(Target *t)
+ : BuildSystem(t)
{
- m_parseGuard = guardParsingRun();
- FilePath projectDir = projectDirectory();
- QFuture<QList<FileNode *>> future = Utils::runAsync([this, projectDir] {
- return FileNode::scanForFiles(projectDir, [this](const FilePath &fn) -> FileNode * {
- if (fn != FilePath::fromString(projectFilePath().toString() + ".user"))
- return new FileNode(fn, FileType::Source);
- else
- return nullptr;
- });
- });
- Utils::onResultReady(future, this, [this](const QList<FileNode *> &nodes) {
- auto root = new HaskellProjectNode(projectDirectory());
- root->setDisplayName(displayName());
+ connect(&m_scanner, &TreeScanner::finished, this, [this] {
+ auto root = std::make_unique<ProjectNode>(projectDirectory());
+ root->setDisplayName(target()->project()->displayName());
std::vector<std::unique_ptr<FileNode>> nodePtrs
- = Utils::transform<std::vector>(nodes, [](FileNode *fn) {
+ = Utils::transform<std::vector>(m_scanner.release(), [](FileNode *fn) {
return std::unique_ptr<FileNode>(fn);
});
root->addNestedNodes(std::move(nodePtrs));
- setRootProjectNode(std::unique_ptr<ProjectNode>(root));
+ setRootProjectNode(std::move(root));
+
+ updateApplicationTargets();
+
m_parseGuard.markAsSuccess();
m_parseGuard = {};
+
+ emitBuildSystemUpdated();
});
+
+ connect(target()->project(),
+ &Project::projectFileIsDirty,
+ this,
+ &BuildSystem::requestDelayedParse);
+
+ requestDelayedParse();
}
-void HaskellProject::updateApplicationTargets(Target *target)
+void HaskellBuildSystem::triggerParsing()
+{
+ m_parseGuard = guardParsingRun();
+ m_scanner.asyncScanForFiles(target()->project()->projectDirectory());
+}
+
+void HaskellBuildSystem::updateApplicationTargets()
{
- QTC_ASSERT(target, return);
const QVector<QString> executables = parseExecutableNames(projectFilePath());
const Utils::FilePath projFilePath = projectFilePath();
const QList<BuildTargetInfo> appTargets
@@ -125,15 +127,8 @@ void HaskellProject::updateApplicationTargets(Target *target)
bti.isQtcRunnable = true;
return bti;
});
- target->setApplicationTargets(appTargets);
- target->updateDefaultRunConfigurations();
-}
-
-void HaskellProject::refresh()
-{
- updateFiles();
- if (activeTarget())
- updateApplicationTargets(activeTarget());
+ setApplicationTargets(appTargets);
+ target()->updateDefaultRunConfigurations();
}
} // namespace Internal
diff --git a/plugins/haskell/haskellproject.h b/plugins/haskell/haskellproject.h
index 4f6e1e4..af78e54 100644
--- a/plugins/haskell/haskellproject.h
+++ b/plugins/haskell/haskellproject.h
@@ -25,33 +25,40 @@
#pragma once
+#include <projectexplorer/buildsystem.h>
#include <projectexplorer/project.h>
#include <projectexplorer/projectnodes.h>
+#include <projectexplorer/treescanner.h>
namespace Haskell {
namespace Internal {
-class HaskellProjectNode : public ProjectExplorer::ProjectNode
+class HaskellProject : public ProjectExplorer::Project
{
+ Q_OBJECT
+
public:
- HaskellProjectNode(const Utils::FilePath &projectFilePath);
+ explicit HaskellProject(const Utils::FilePath &fileName);
+
+ static bool isHaskellProject(Project *project);
};
-class HaskellProject : public ProjectExplorer::Project
+class HaskellBuildSystem : public ProjectExplorer::BuildSystem
{
Q_OBJECT
public:
- explicit HaskellProject(const Utils::FilePath &fileName);
+ HaskellBuildSystem(ProjectExplorer::Target *t);
- static bool isHaskellProject(Project *project);
+ void triggerParsing() override;
private:
- void updateFiles();
- void updateApplicationTargets(ProjectExplorer::Target *target);
+ void updateApplicationTargets();
void refresh();
+private:
ParseGuard m_parseGuard;
+ ProjectExplorer::TreeScanner m_scanner;
};
} // namespace Internal
diff --git a/plugins/haskell/haskellrunconfiguration.cpp b/plugins/haskell/haskellrunconfiguration.cpp
index f2f47c5..c421571 100644
--- a/plugins/haskell/haskellrunconfiguration.cpp
+++ b/plugins/haskell/haskellrunconfiguration.cpp
@@ -58,12 +58,7 @@ HaskellRunConfiguration::HaskellRunConfiguration(Target *target, Core::Id id)
{
addAspect<LocalEnvironmentAspect>(target);
- auto executableAspect = addAspect<HaskellExecutableAspect>();
- connect(target, &Target::applicationTargetsChanged, this, [this, target, executableAspect] {
- BuildTargetInfo bti = target->buildTarget(buildKey());
- executableAspect->setValue(bti.targetFilePath.toString());
- });
-
+ addAspect<HaskellExecutableAspect>();
addAspect<ArgumentsAspect>();
auto workingDirAspect = addAspect<WorkingDirectoryAspect>();
@@ -71,11 +66,10 @@ HaskellRunConfiguration::HaskellRunConfiguration(Target *target, Core::Id id)
workingDirAspect->setVisible(false);
addAspect<TerminalAspect>();
-}
-void HaskellRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
-{
- aspect<HaskellExecutableAspect>()->setValue(info.buildKey);
+ setUpdater([this] { aspect<HaskellExecutableAspect>()->setValue(buildTargetInfo().buildKey); });
+ connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
+ update();
}
Runnable HaskellRunConfiguration::runnable() const
diff --git a/plugins/haskell/haskellrunconfiguration.h b/plugins/haskell/haskellrunconfiguration.h
index 529544e..6ff8331 100644
--- a/plugins/haskell/haskellrunconfiguration.h
+++ b/plugins/haskell/haskellrunconfiguration.h
@@ -41,7 +41,6 @@ public:
HaskellRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
private:
- void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
ProjectExplorer::Runnable runnable() const final;
};