2019-09-16 22:43:27 +02:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
|
|
|
|
** Copyright (C) Filippo Cucchetto <filippocucchetto@gmail.com>
|
|
|
|
|
** Contact: http://www.qt.io/licensing
|
|
|
|
|
**
|
|
|
|
|
** This file is part of Qt Creator.
|
|
|
|
|
**
|
|
|
|
|
** Commercial License Usage
|
|
|
|
|
** Licensees holding valid commercial Qt licenses may use this file in
|
|
|
|
|
** accordance with the commercial license agreement provided with the
|
|
|
|
|
** Software or, alternatively, in accordance with the terms contained in
|
|
|
|
|
** a written agreement between you and The Qt Company. For licensing terms
|
|
|
|
|
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
|
|
|
** information use the contact form at https://www.qt.io/contact-us.
|
|
|
|
|
**
|
|
|
|
|
** GNU General Public License Usage
|
|
|
|
|
** Alternatively, this file may be used under the terms of the GNU
|
|
|
|
|
** General Public License version 3 as published by the Free Software
|
|
|
|
|
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
|
|
|
** included in the packaging of this file. Please review the following
|
|
|
|
|
** information to ensure the GNU General Public License requirements will
|
|
|
|
|
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
|
|
|
|
#include "nimblerunconfiguration.h"
|
2020-08-31 09:52:57 +02:00
|
|
|
|
2020-08-31 14:28:10 +02:00
|
|
|
#include "nimblebuildsystem.h"
|
2019-09-16 22:43:27 +02:00
|
|
|
#include "nimconstants.h"
|
|
|
|
|
#include "nimbleproject.h"
|
|
|
|
|
|
|
|
|
|
#include <projectexplorer/localenvironmentaspect.h>
|
|
|
|
|
#include <projectexplorer/runconfigurationaspects.h>
|
|
|
|
|
#include <projectexplorer/runcontrol.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
|
|
|
Q_DECLARE_TR_FUNCTIONS(Nim::NimbleRunConfiguration)
|
|
|
|
|
|
|
|
|
|
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)
|
|
|
|
|
{
|
2022-04-13 16:14:03 +02:00
|
|
|
auto envAspect = addAspect<LocalEnvironmentAspect>(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
|
|
|
Q_DECLARE_TR_FUNCTIONS(Nim::NimbleTestConfiguration)
|
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>();
|
|
|
|
|
|
|
|
|
|
setDisplayName(tr("Nimble Test"));
|
|
|
|
|
setDefaultDisplayName(tr("Nimble Test"));
|
|
|
|
|
}
|
|
|
|
|
};
|
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
|