2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2019-09-16 22:43:27 +02:00
|
|
|
|
|
|
|
|
#include "nimblerunconfiguration.h"
|
2020-08-31 09:52:57 +02:00
|
|
|
|
2022-06-22 15:43:33 +02:00
|
|
|
#include "nimbuildsystem.h"
|
2019-09-16 22:43:27 +02:00
|
|
|
#include "nimconstants.h"
|
2022-10-10 09:58:54 +02:00
|
|
|
#include "nimtr.h"
|
2019-09-16 22:43:27 +02:00
|
|
|
|
2022-06-22 15:43:33 +02:00
|
|
|
#include <projectexplorer/projectexplorerconstants.h>
|
2019-09-16 22:43:27 +02:00
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
|
|
|
|
#include <projectexplorer/target.h>
|
|
|
|
|
|
|
|
|
|
#include <utils/algorithm.h>
|
|
|
|
|
#include <utils/environment.h>
|
|
|
|
|
|
|
|
|
|
using namespace ProjectExplorer;
|
|
|
|
|
|
2020-02-11 11:09:04 +01:00
|
|
|
namespace Nim {
|
|
|
|
|
|
|
|
|
|
// NimbleRunConfiguration
|
|
|
|
|
|
|
|
|
|
class NimbleRunConfiguration : public RunConfiguration
|
2019-09-16 22:43:27 +02:00
|
|
|
{
|
2020-02-11 11:09:04 +01:00
|
|
|
public:
|
2020-06-26 13:59:38 +02:00
|
|
|
NimbleRunConfiguration(Target *target, Utils::Id id)
|
2020-02-11 11:09:04 +01:00
|
|
|
: RunConfiguration(target, id)
|
|
|
|
|
{
|
2023-05-25 08:58:36 +02:00
|
|
|
auto envAspect = addAspect<EnvironmentAspect>();
|
|
|
|
|
envAspect->setSupportForBuildEnvironment(target);
|
|
|
|
|
|
2022-05-31 18:22:07 +02:00
|
|
|
addAspect<ExecutableAspect>(target, ExecutableAspect::RunDevice);
|
2022-05-11 16:51:46 +02:00
|
|
|
addAspect<ArgumentsAspect>(macroExpander());
|
2022-05-30 14:56:20 +02:00
|
|
|
addAspect<WorkingDirectoryAspect>(macroExpander(), envAspect);
|
2020-02-11 11:09:04 +01:00
|
|
|
addAspect<TerminalAspect>();
|
|
|
|
|
|
|
|
|
|
setUpdater([this] {
|
|
|
|
|
BuildTargetInfo bti = buildTargetInfo();
|
|
|
|
|
setDisplayName(bti.displayName);
|
|
|
|
|
setDefaultDisplayName(bti.displayName);
|
|
|
|
|
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
|
|
|
|
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
connect(target, &Target::buildSystemUpdated, this, &RunConfiguration::update);
|
|
|
|
|
update();
|
|
|
|
|
}
|
|
|
|
|
};
|
2019-09-16 22:43:27 +02:00
|
|
|
|
|
|
|
|
NimbleRunConfigurationFactory::NimbleRunConfigurationFactory()
|
|
|
|
|
: RunConfigurationFactory()
|
|
|
|
|
{
|
|
|
|
|
registerRunConfiguration<NimbleRunConfiguration>("Nim.NimbleRunConfiguration");
|
|
|
|
|
addSupportedProjectType(Constants::C_NIMBLEPROJECT_ID);
|
|
|
|
|
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
|
|
|
|
}
|
|
|
|
|
|
2019-11-05 18:51:28 +01:00
|
|
|
|
2020-02-11 11:09:04 +01:00
|
|
|
// NimbleTestConfiguration
|
|
|
|
|
|
|
|
|
|
class NimbleTestConfiguration : public RunConfiguration
|
2019-11-05 18:51:28 +01:00
|
|
|
{
|
2020-02-11 11:09:04 +01:00
|
|
|
public:
|
2020-06-26 13:59:38 +02:00
|
|
|
NimbleTestConfiguration(ProjectExplorer::Target *target, Utils::Id id)
|
2020-02-11 11:09:04 +01:00
|
|
|
: RunConfiguration(target, id)
|
|
|
|
|
{
|
2022-05-31 18:22:07 +02:00
|
|
|
addAspect<ExecutableAspect>(target, ExecutableAspect::BuildDevice)
|
|
|
|
|
->setExecutable(Nim::nimblePathFromKit(target->kit()));
|
2022-05-11 16:51:46 +02:00
|
|
|
addAspect<ArgumentsAspect>(macroExpander())->setArguments("test");
|
2022-05-30 14:56:20 +02:00
|
|
|
addAspect<WorkingDirectoryAspect>(macroExpander(), nullptr)
|
|
|
|
|
->setDefaultWorkingDirectory(project()->projectDirectory());
|
2020-02-11 11:09:04 +01:00
|
|
|
addAspect<TerminalAspect>();
|
|
|
|
|
|
2022-10-10 09:58:54 +02:00
|
|
|
setDisplayName(Tr::tr("Nimble Test"));
|
|
|
|
|
setDefaultDisplayName(Tr::tr("Nimble Test"));
|
2020-02-11 11:09:04 +01:00
|
|
|
}
|
|
|
|
|
};
|
2019-11-05 18:51:28 +01:00
|
|
|
|
|
|
|
|
NimbleTestConfigurationFactory::NimbleTestConfigurationFactory()
|
|
|
|
|
: FixedRunConfigurationFactory(QString())
|
|
|
|
|
{
|
|
|
|
|
registerRunConfiguration<NimbleTestConfiguration>("Nim.NimbleTestConfiguration");
|
|
|
|
|
addSupportedProjectType(Constants::C_NIMBLEPROJECT_ID);
|
|
|
|
|
}
|
2020-02-11 11:09:04 +01:00
|
|
|
|
|
|
|
|
} // Nim
|