diff options
| author | hjk <hjk@qt.io> | 2017-11-27 14:56:45 +0100 |
|---|---|---|
| committer | Eike Ziller <eike.ziller@qt.io> | 2018-03-19 09:35:42 +0000 |
| commit | 50e8ba6e959c533491fc8b8e64e155468b333552 (patch) | |
| tree | ad9241a4821649093ba0ecd1d90af22972461e3c /plugins/haskell/haskellproject.cpp | |
| parent | 53592d59133868de4d9e667f647fac126e9f930b (diff) | |
Adapt to upstream infrastructure changes
Change-Id: Ic3f470b1d3df47b90f054ef1e006927b9ee675ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Diffstat (limited to 'plugins/haskell/haskellproject.cpp')
| -rw-r--r-- | plugins/haskell/haskellproject.cpp | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/plugins/haskell/haskellproject.cpp b/plugins/haskell/haskellproject.cpp index 31af7b7..d87f6fc 100644 --- a/plugins/haskell/haskellproject.cpp +++ b/plugins/haskell/haskellproject.cpp @@ -29,8 +29,13 @@ #include <coreplugin/iversioncontrol.h> #include <coreplugin/vcsmanager.h> + +#include <projectexplorer/buildtargetinfo.h> +#include <projectexplorer/target.h> + #include <utils/algorithm.h> #include <utils/fileutils.h> +#include <utils/qtcassert.h> #include <utils/runextensions.h> #include <QFile> @@ -70,6 +75,7 @@ HaskellProject::HaskellProject(const Utils::FileName &fileName) setId(Constants::C_HASKELL_PROJECT_ID); setDisplayName(fileName.toFileInfo().completeBaseName()); updateFiles(); + connect(this, &Project::activeTargetChanged, this, &HaskellProject::updateApplicationTargets); } bool HaskellProject::isHaskellProject(Project *project) @@ -77,18 +83,6 @@ bool HaskellProject::isHaskellProject(Project *project) return project && project->id() == Constants::C_HASKELL_PROJECT_ID; } -HaskellProject *HaskellProject::toHaskellProject(Project *project) -{ - if (project && project->id() == Constants::C_HASKELL_PROJECT_ID) - return static_cast<HaskellProject *>(project); - return nullptr; -} - -QList<QString> HaskellProject::availableExecutables() const -{ - return parseExecutableNames(projectFilePath()).toList(); -} - void HaskellProject::updateFiles() { emitParsingStarted(); @@ -114,5 +108,27 @@ void HaskellProject::updateFiles() }); } +void HaskellProject::updateApplicationTargets(Target *target) +{ + QTC_ASSERT(target, return); + const QVector<QString> executables = parseExecutableNames(projectFilePath()); + const Utils::FileName projFilePath = projectFilePath(); + const QList<BuildTargetInfo> appTargets + = Utils::transform<QList>(executables, [projFilePath](const QString &executable) { + BuildTargetInfo bti; + bti.targetName = executable; + bti.displayName = executable; + bti.buildKey = executable; + bti.targetFilePath = FileName::fromString(executable); + bti.projectFilePath = projFilePath; + bti.isQtcRunnable = true; + return bti; + }); + BuildTargetInfoList list; + list.list = appTargets; + target->setApplicationTargets(list); + target->updateDefaultRunConfigurations(); +} + } // namespace Internal } // namespace Haskell |
