TaskTree: Get rid of registration macros

Alias task types manually.
Don't require the alias to be inside the Tasking namespace.
Addresses the 22th point of the jira ticket below.

Task-number: QTCREATORBUG-28741
Change-Id: I1bdda7fe5a01e4bcb5052ec328f4e0eace878651
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Jarek Kobus
2023-08-17 11:08:21 +02:00
parent 36e0ea27b9
commit 98026b29c6
28 changed files with 56 additions and 100 deletions

View File

@@ -41,11 +41,7 @@ public:
void start() final { task()->start(); }
};
} // namespace Tasking
TASKING_DECLARE_TASK(BarrierTask, Tasking::BarrierTaskAdapter);
namespace Tasking {
using BarrierTask = CustomTask<BarrierTaskAdapter>;
template <int Limit = 1>
class SharedBarrier

View File

@@ -95,6 +95,7 @@ private:
std::unique_ptr<QFutureWatcher<ResultType>> m_watcher;
};
} // namespace Tasking
template <typename T>
using ConcurrentCallTask = CustomTask<ConcurrentCallTaskAdapter<T>>;
TASKING_DECLARE_TEMPLATE_TASK(ConcurrentCallTask, Tasking::ConcurrentCallTaskAdapter);
} // namespace Tasking

View File

@@ -50,6 +50,6 @@ public:
void start() final { task()->start(); }
};
} // namespace Tasking
using NetworkQueryTask = CustomTask<NetworkQueryTaskAdapter>;
TASKING_DECLARE_TASK(NetworkQueryTask, Tasking::NetworkQueryTaskAdapter);
} // namespace Tasking

View File

@@ -460,16 +460,7 @@ private:
std::optional<int> m_timerId;
};
using TaskTreeTask = CustomTask<TaskTreeTaskAdapter>;
using TimeoutTask = CustomTask<TimeoutTaskAdapter>;
} // namespace Tasking
#define TASKING_DECLARE_TASK(CustomTaskName, TaskAdapterClass)\
namespace Tasking { using CustomTaskName = CustomTask<TaskAdapterClass>; }
#define TASKING_DECLARE_TEMPLATE_TASK(CustomTaskName, TaskAdapterClass)\
namespace Tasking {\
template <typename ...Args>\
using CustomTaskName = CustomTask<TaskAdapterClass<Args...>>;\
} // namespace Tasking
TASKING_DECLARE_TASK(TaskTreeTask, TaskTreeTaskAdapter);
TASKING_DECLARE_TASK(TimeoutTask, TimeoutTaskAdapter);

View File

@@ -210,6 +210,7 @@ public:
void start() final { this->task()->start(); }
};
} // namespace Utils
template <typename T>
using AsyncTask = Tasking::CustomTask<AsyncTaskAdapter<T>>;
TASKING_DECLARE_TEMPLATE_TASK(AsyncTask, Utils::AsyncTaskAdapter);
} // namespace Utils

View File

@@ -304,12 +304,8 @@ public:
void start() override { task()->start(); }
};
} // namespace Utils
TASKING_DECLARE_TASK(FileStreamReaderTask, Utils::FileStreamReaderAdapter);
TASKING_DECLARE_TASK(FileStreamWriterTask, Utils::FileStreamWriterAdapter);
namespace Utils {
using FileStreamReaderTask = CustomTask<FileStreamReaderAdapter>;
using FileStreamWriterTask = CustomTask<FileStreamWriterAdapter>;
static Group sameRemoteDeviceTransferTask(const FilePath &source, const FilePath &destination)
{

View File

@@ -58,6 +58,6 @@ public:
void start() override { task()->start(); }
};
} // namespace Utils
using FileStreamerTask = Tasking::CustomTask<FileStreamerTaskAdapter>;
TASKING_DECLARE_TASK(FileStreamerTask, Utils::FileStreamerTaskAdapter);
} // namespace Utils

View File

@@ -222,8 +222,8 @@ public:
void start() final;
};
using ProcessTask = Tasking::CustomTask<ProcessTaskAdapter>;
} // namespace Utils
TASKING_DECLARE_TASK(ProcessTask, Utils::ProcessTaskAdapter);
#endif // UTILS_PROCESS_H

View File

@@ -52,6 +52,6 @@ public:
void start() final;
};
} // namespace Utils
using UnarchiverTask = Tasking::CustomTask<UnarchiverTaskAdapter>;
TASKING_DECLARE_TASK(UnarchiverTask, Utils::UnarchiverTaskAdapter);
} // namespace Utils

View File

@@ -565,7 +565,7 @@ Tasking::GroupItem AndroidDeployQtStep::runRecipe()
async.setConcurrentCallData(&AndroidDeployQtStep::runImpl, this);
async.setFutureSynchronizer(&m_synchronizer);
};
return Tasking::AsyncTask<void>(onSetup);
return AsyncTask<void>(onSetup);
}
void AndroidDeployQtStep::runCommand(const CommandLine &command)

View File

@@ -63,13 +63,14 @@ using namespace Core;
using namespace CppEditor;
using namespace Debugger;
using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils;
static Q_LOGGING_CATEGORY(LOG, "qtc.clangtools.runcontrol", QtWarningMsg)
namespace ClangTools::Internal {
class ProjectBuilderTaskAdapter : public Tasking::TaskAdapter<QPointer<Target>>
class ProjectBuilderTaskAdapter : public TaskAdapter<QPointer<Target>>
{
public:
void start() final {
@@ -82,11 +83,7 @@ public:
}
};
} // namespace ClangTools::Internal
TASKING_DECLARE_TASK(ProjectBuilderTask, ClangTools::Internal::ProjectBuilderTaskAdapter);
namespace ClangTools::Internal {
using ProjectBuilderTask = CustomTask<ProjectBuilderTaskAdapter>;
static QDebug operator<<(QDebug debug, const Environment &environment)
{
@@ -640,14 +637,13 @@ static bool continueDespiteReleaseBuild(const QString &toolName)
== QMessageBox::Yes;
}
Tasking::Group ClangTool::runRecipe(const RunSettings &runSettings,
const ClangDiagnosticConfig &diagnosticConfig,
const FileInfos &fileInfos, bool buildBeforeAnalysis)
Group ClangTool::runRecipe(const RunSettings &runSettings,
const ClangDiagnosticConfig &diagnosticConfig,
const FileInfos &fileInfos,
bool buildBeforeAnalysis)
{
m_filesCount = int(fileInfos.size());
using namespace Tasking;
struct ClangStorage {
ClangStorage() { m_timer.start(); }
~ClangStorage() {

View File

@@ -44,6 +44,7 @@
using namespace Core;
using namespace ProjectExplorer;
using namespace Tasking;
using namespace Utils;
namespace CMakeProjectManager::Internal {
@@ -59,7 +60,7 @@ const char CLEAR_SYSTEM_ENVIRONMENT_KEY[] = "CMakeProjectManager.MakeStep.ClearS
const char USER_ENVIRONMENT_CHANGES_KEY[] = "CMakeProjectManager.MakeStep.UserEnvironmentChanges";
const char BUILD_PRESET_KEY[] = "CMakeProjectManager.MakeStep.BuildPreset";
class ProjectParserTaskAdapter : public Tasking::TaskAdapter<QPointer<Target>>
class ProjectParserTaskAdapter : public TaskAdapter<QPointer<Target>>
{
public:
void start() final {
@@ -72,11 +73,7 @@ public:
}
};
} // namespace CMakeProjectManager::Internal
TASKING_DECLARE_TASK(ProjectParserTask, CMakeProjectManager::Internal::ProjectParserTaskAdapter);
namespace CMakeProjectManager::Internal {
using ProjectParserTask = CustomTask<ProjectParserTaskAdapter>;
class CmakeProgressParser : public Utils::OutputLineParser
{
@@ -345,10 +342,8 @@ void CMakeBuildStep::setupOutputFormatter(Utils::OutputFormatter *formatter)
CMakeAbstractProcessStep::setupOutputFormatter(formatter);
}
Tasking::GroupItem CMakeBuildStep::runRecipe()
GroupItem CMakeBuildStep::runRecipe()
{
using namespace Tasking;
const auto onParserSetup = [this](QPointer<Target> &parseTarget) {
// Make sure CMake state was written to disk before trying to build:
auto bs = qobject_cast<CMakeBuildSystem *>(buildSystem());

View File

@@ -327,11 +327,7 @@ public:
void start() final { task()->start(); }
};
} // namespace Core
TASKING_DECLARE_TASK(ResultsCollectorTask, Core::ResultsCollectorTaskAdapter);
namespace Core {
using ResultsCollectorTask = CustomTask<ResultsCollectorTaskAdapter>;
class LocatorStoragePrivate
{

View File

@@ -349,7 +349,7 @@ public:
void start() final { task()->start(); }
};
TASKING_DECLARE_TASK(JavaScriptRequestTask, JavaScriptRequestAdapter);
using JavaScriptRequestTask = CustomTask<JavaScriptRequestAdapter>;
namespace Core::Internal {

View File

@@ -236,8 +236,6 @@ GitDiffEditorController::GitDiffEditorController(IDocument *document,
const QStringList &extraArgs)
: GitBaseDiffEditorController(document)
{
using namespace Tasking;
const TreeStorage<QString> diffInputStorage;
const auto setupDiff = [=](Process &process) {
@@ -296,8 +294,6 @@ FileListDiffController::FileListDiffController(IDocument *document, const QStrin
const QStringList &unstagedFiles)
: GitBaseDiffEditorController(document)
{
using namespace Tasking;
struct DiffStorage {
QString m_stagedOutput;
QString m_unstagedOutput;
@@ -363,7 +359,6 @@ ShowController::ShowController(IDocument *document, const QString &id)
{
setDisplayName("Git Show");
static const QString busyMessage = Tr::tr("<resolving>");
using namespace Tasking;
struct ReloadStorage {
bool m_postProcessDescription = false;

View File

@@ -245,7 +245,7 @@ public:
QString synchronousTopic(const Utils::FilePath &workingDirectory) const;
bool synchronousRevParseCmd(const Utils::FilePath &workingDirectory, const QString &ref,
QString *output, QString *errorMessage = nullptr) const;
Tasking::ProcessTask topRevision(const Utils::FilePath &workingDirectory,
Utils::ProcessTask topRevision(const Utils::FilePath &workingDirectory,
const std::function<void(const QString &, const QDateTime &)> &callback);
bool isRemoteCommit(const Utils::FilePath &workingDirectory, const QString &commit);

View File

@@ -97,11 +97,7 @@ private:
void start() final { task()->start(); }
};
} // Ios::Internal
TASKING_DECLARE_TASK(IosTransferTask, Ios::Internal::IosTransferTaskAdapter);
namespace Ios::Internal {
using IosTransferTask = CustomTask<IosTransferTaskAdapter>;
class IosDeployStep final : public BuildStep
{

View File

@@ -75,6 +75,6 @@ public:
void start() final;
};
} // namespace LanguageClient
using SymbolRequest = Tasking::CustomTask<WorkspaceSymbolRequestTaskAdapter>;
TASKING_DECLARE_TASK(SymbolRequest, LanguageClient::WorkspaceSymbolRequestTaskAdapter);
} // namespace LanguageClient

View File

@@ -47,7 +47,7 @@ public:
void start() final;
};
} // namespace LanguageClient
using CurrentDocumentSymbolsRequestTask
= Tasking::CustomTask<CurrentDocumentSymbolsRequestTaskAdapter>;
TASKING_DECLARE_TASK(CurrentDocumentSymbolsRequestTask,
LanguageClient::CurrentDocumentSymbolsRequestTaskAdapter);
} // namespace LanguageClient

View File

@@ -78,11 +78,7 @@ private:
}
};
} // ProjectExplorer
TASKING_DECLARE_TASK(ParserAwaiterTask, ProjectExplorer::ParserAwaiterTaskAdapter);
namespace ProjectExplorer {
using ParserAwaiterTask = CustomTask<ParserAwaiterTaskAdapter>;
static QString msgProgress(int progress, int total)
{

View File

@@ -87,7 +87,6 @@ private:
QVector<Internal::SubChannelProvider *> m_channelProviders;
};
} // namespace ProjectExplorer
using DeviceUsedPortsGathererTask = Tasking::CustomTask<DeviceUsedPortsGathererTaskAdapter>;
TASKING_DECLARE_TASK(DeviceUsedPortsGathererTask,
ProjectExplorer::DeviceUsedPortsGathererTaskAdapter);
} // namespace ProjectExplorer

View File

@@ -59,7 +59,7 @@ public:
void start() final { task()->test(); }
};
} // namespace ProjectExplorer
using FileTransferTask = Tasking::CustomTask<FileTransferTaskAdapter>;
using FileTransferTestTask = Tasking::CustomTask<FileTransferTestTaskAdapter>;
TASKING_DECLARE_TASK(FileTransferTask, ProjectExplorer::FileTransferTaskAdapter);
TASKING_DECLARE_TASK(FileTransferTestTask, ProjectExplorer::FileTransferTestTaskAdapter);
} // namespace ProjectExplorer

View File

@@ -282,6 +282,6 @@ public:
void start() final;
};
} // namespace ProjectExplorer
using DeviceProcessKillerTask = Tasking::CustomTask<DeviceProcessKillerTaskAdapter>;
TASKING_DECLARE_TASK(DeviceProcessKillerTask, ProjectExplorer::DeviceProcessKillerTaskAdapter);
} // namespace ProjectExplorer

View File

@@ -49,6 +49,6 @@ private:
void start() final { task()->start(); }
};
} // namespace QbsProjectManager::Internal
using QbsRequestTask = Tasking::CustomTask<QbsRequestTaskAdapter>;
TASKING_DECLARE_TASK(QbsRequestTask, QbsProjectManager::Internal::QbsRequestTaskAdapter);
} // namespace QbsProjectManager::Internal

View File

@@ -118,8 +118,6 @@ void UpdateInfoPlugin::startCheckForUpdates()
emit checkForUpdatesRunningChanged(true);
using namespace Tasking;
const auto doSetup = [this](Process &process, const QStringList &args) {
process.setCommand({d->m_maintenanceTool, args});
process.setLowPriority();

View File

@@ -70,6 +70,6 @@ public:
void start() final { task()->start(); }
};
} // namespace Valgrind
using ValgrindProcessTask = Tasking::CustomTask<ValgrindProcessTaskAdapter>;
TASKING_DECLARE_TASK(ValgrindProcessTask, Valgrind::ValgrindProcessTaskAdapter);
} // namespace Valgrind

View File

@@ -58,6 +58,6 @@ public:
void start() final { task()->start(); }
};
} // Valgrind::XmlProtocol
using ParserTask = Tasking::CustomTask<ParserTaskAdapter>;
TASKING_DECLARE_TASK(ParserTask, Valgrind::XmlProtocol::ParserTaskAdapter);
} // Valgrind::XmlProtocol

View File

@@ -194,7 +194,7 @@ public:
void start() final { task()->start(); }
};
TASKING_DECLARE_TASK(TickAndDoneTask, TickAndDoneTaskAdapter);
using TickAndDoneTask = CustomTask<TickAndDoneTaskAdapter>;
template <typename SharedBarrierType>
GroupItem createBarrierAdvance(const TreeStorage<CustomStorage> &storage,