forked from qt-creator/qt-creator
Unification of desktop run configurations, step 1
First step, move {DesktopQt,Qbs,CMake}RunConfiguration{,Factory}
into the same new files.
This only moves down to QtSupport, not ProjectExplorer, as there
are in all three cases direct dependencies on QtSupport. Long term
I would expect them to move further down.
Change-Id: Ib16b19df7f3f642ed7f7db89a1f6904601d976ba
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -28,7 +28,6 @@ add_qtc_plugin(CMakeProjectManager
|
||||
cmakeprojectmanager.cpp cmakeprojectmanager.h
|
||||
cmakeprojectnodes.cpp cmakeprojectnodes.h
|
||||
cmakeprojectplugin.cpp cmakeprojectplugin.h
|
||||
cmakerunconfiguration.cpp cmakerunconfiguration.h
|
||||
cmakesettingspage.cpp cmakesettingspage.h
|
||||
cmakespecificsettings.cpp cmakespecificsettings.h
|
||||
cmakespecificsettingspage.cpp cmakespecificsettingspage.h cmakespecificsettingspage.ui
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
#include "cmakeparser.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakeproject.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmaketool.h"
|
||||
|
||||
#include <projectexplorer/buildsteplist.h>
|
||||
@@ -105,11 +104,6 @@ CMakeBuildConfiguration *CMakeBuildStep::cmakeBuildConfiguration() const
|
||||
return static_cast<CMakeBuildConfiguration *>(buildConfiguration());
|
||||
}
|
||||
|
||||
CMakeRunConfiguration *CMakeBuildStep::targetsActiveRunConfiguration() const
|
||||
{
|
||||
return qobject_cast<CMakeRunConfiguration *>(target()->activeRunConfiguration());
|
||||
}
|
||||
|
||||
void CMakeBuildStep::handleBuildTargetChanges(bool success)
|
||||
{
|
||||
if (!success)
|
||||
@@ -169,7 +163,7 @@ bool CMakeBuildStep::init()
|
||||
canInit = false;
|
||||
}
|
||||
|
||||
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
|
||||
RunConfiguration *rc = target()->activeRunConfiguration();
|
||||
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildKey().isEmpty())) {
|
||||
emit addTask(Task(Task::Error,
|
||||
QCoreApplication::translate("ProjectExplorer::Task",
|
||||
@@ -347,7 +341,7 @@ void CMakeBuildStep::setToolArguments(const QString &list)
|
||||
m_toolArguments = list;
|
||||
}
|
||||
|
||||
Utils::CommandLine CMakeBuildStep::cmakeCommand(CMakeRunConfiguration *rc) const
|
||||
Utils::CommandLine CMakeBuildStep::cmakeCommand(RunConfiguration *rc) const
|
||||
{
|
||||
CMakeTool *tool = CMakeKitAspect::cmakeTool(target()->kit());
|
||||
|
||||
|
||||
@@ -40,13 +40,15 @@ class CommandLine;
|
||||
class PathChooser;
|
||||
} // Utils
|
||||
|
||||
namespace ProjectExplorer { class ToolChain; }
|
||||
namespace ProjectExplorer {
|
||||
class RunConfiguration;
|
||||
class ToolChain;
|
||||
} // ProjectManager
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeBuildConfiguration;
|
||||
class CMakeRunConfiguration;
|
||||
class CMakeBuildStepFactory;
|
||||
|
||||
class CMakeBuildStep : public ProjectExplorer::AbstractProcessStep
|
||||
@@ -67,7 +69,7 @@ public:
|
||||
QString toolArguments() const;
|
||||
void setToolArguments(const QString &list);
|
||||
|
||||
Utils::CommandLine cmakeCommand(CMakeRunConfiguration *rc) const;
|
||||
Utils::CommandLine cmakeCommand(ProjectExplorer::RunConfiguration *rc) const;
|
||||
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
@@ -104,7 +106,6 @@ private:
|
||||
void handleProjectWasParsed(bool success);
|
||||
|
||||
void handleBuildTargetChanges(bool success);
|
||||
CMakeRunConfiguration *targetsActiveRunConfiguration() const;
|
||||
|
||||
QMetaObject::Connection m_runTrigger;
|
||||
|
||||
|
||||
@@ -14,7 +14,6 @@ HEADERS = builddirmanager.h \
|
||||
cmakeprojectmanager.h \
|
||||
cmakeprojectconstants.h \
|
||||
cmakeprojectnodes.h \
|
||||
cmakerunconfiguration.h \
|
||||
cmakebuildconfiguration.h \
|
||||
cmakeeditor.h \
|
||||
cmakelocatorfilter.h \
|
||||
@@ -53,7 +52,6 @@ SOURCES = builddirmanager.cpp \
|
||||
cmakeprojectplugin.cpp \
|
||||
cmakeprojectmanager.cpp \
|
||||
cmakeprojectnodes.cpp \
|
||||
cmakerunconfiguration.cpp \
|
||||
cmakebuildconfiguration.cpp \
|
||||
cmakeeditor.cpp \
|
||||
cmakelocatorfilter.cpp \
|
||||
|
||||
@@ -61,8 +61,6 @@ QtcPlugin {
|
||||
"cmakeprojectnodes.h",
|
||||
"cmakeprojectplugin.cpp",
|
||||
"cmakeprojectplugin.h",
|
||||
"cmakerunconfiguration.cpp",
|
||||
"cmakerunconfiguration.h",
|
||||
"cmaketool.cpp",
|
||||
"cmaketool.h",
|
||||
"cmaketoolmanager.cpp",
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "cmakeprojectmanager.h"
|
||||
#include "cmakeprojectnodes.h"
|
||||
#include "cmakebuildconfiguration.h"
|
||||
#include "cmakerunconfiguration.h"
|
||||
#include "cmakeprojectconstants.h"
|
||||
#include "cmakelocatorfilter.h"
|
||||
#include "cmakesettingspage.h"
|
||||
@@ -71,8 +70,6 @@ public:
|
||||
static const std::unique_ptr<CMakeSpecificSettings> projectTypeSpecificSettings;
|
||||
CMakeManager manager;
|
||||
CMakeBuildStepFactory buildStepFactory;
|
||||
CMakeRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration> runWorkerFactory;
|
||||
CMakeBuildConfigurationFactory buildConfigFactory;
|
||||
CMakeEditorFactory editorFactor;
|
||||
BuildCMakeTargetLocatorFilter buildCMakeTargetLocatorFilter;
|
||||
|
||||
@@ -1,121 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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 "cmakerunconfiguration.h"
|
||||
|
||||
#include "cmakeprojectconstants.h"
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtoutputformatter.h>
|
||||
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
|
||||
// Workaround for QTCREATORBUG-19354:
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
envAspect->addModifier([target](Environment &env) {
|
||||
const Kit *k = target->kit();
|
||||
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k)) {
|
||||
const QString installBinPath = qt->qmakeProperty("QT_INSTALL_BINS");
|
||||
env.prependOrSetPath(installBinPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &CMakeRunConfiguration::updateTargetInformation);
|
||||
|
||||
if (QtSupport::QtKitAspect::qtVersion(target->kit()))
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||
{
|
||||
Q_UNUSED(info)
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
bool CMakeRunConfiguration::isBuildTargetValid() const
|
||||
{
|
||||
return Utils::anyOf(target()->applicationTargets(), [this](const BuildTargetInfo &bti) {
|
||||
return bti.buildKey == buildKey();
|
||||
});
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::updateEnabledState()
|
||||
{
|
||||
if (!isBuildTargetValid())
|
||||
setEnabled(false);
|
||||
else
|
||||
RunConfiguration::updateEnabledState();
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::disabledReason() const
|
||||
{
|
||||
if (!isBuildTargetValid())
|
||||
return tr("The project no longer builds the target associated with this run configuration.");
|
||||
return RunConfiguration::disabledReason();
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||
aspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
}
|
||||
|
||||
// Factory
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<CMakeRunConfiguration>("CMakeProjectManager.CMakeRunConfiguration.");
|
||||
addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
} // Internal
|
||||
} // CMakeProjectManager
|
||||
@@ -1,57 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
namespace CMakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class CMakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
private:
|
||||
QString disabledReason() const override;
|
||||
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||
bool isBuildTargetValid() const;
|
||||
void updateTargetInformation();
|
||||
|
||||
void updateEnabledState() final;
|
||||
};
|
||||
|
||||
class CMakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
CMakeRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace CMakeProjectManager
|
||||
@@ -32,5 +32,4 @@ add_qtc_plugin(QbsProjectManager
|
||||
qbsprojectmanagerplugin.cpp qbsprojectmanagerplugin.h
|
||||
qbsprojectmanagersettings.cpp qbsprojectmanagersettings.h
|
||||
qbsprojectparser.cpp qbsprojectparser.h
|
||||
qbsrunconfiguration.cpp qbsrunconfiguration.h
|
||||
)
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
#include "qbsproject.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
#include "qbsprojectmanagerplugin.h"
|
||||
#include "qbsrunconfiguration.h"
|
||||
|
||||
#include <android/androidconstants.h>
|
||||
#include <coreplugin/fileiconprovider.h>
|
||||
|
||||
@@ -37,8 +37,7 @@ HEADERS = \
|
||||
qbsprojectmanagerconstants.h \
|
||||
qbsprojectmanagerplugin.h \
|
||||
qbsprojectmanagersettings.h \
|
||||
qbsprojectparser.h \
|
||||
qbsrunconfiguration.h
|
||||
qbsprojectparser.h
|
||||
|
||||
SOURCES = \
|
||||
customqbspropertiesdialog.cpp \
|
||||
@@ -59,8 +58,7 @@ SOURCES = \
|
||||
qbsprojectmanager.cpp \
|
||||
qbsprojectmanagerplugin.cpp \
|
||||
qbsprojectmanagersettings.cpp \
|
||||
qbsprojectparser.cpp \
|
||||
qbsrunconfiguration.cpp
|
||||
qbsprojectparser.cpp
|
||||
|
||||
FORMS = \
|
||||
customqbspropertiesdialog.ui \
|
||||
|
||||
@@ -103,8 +103,6 @@ QtcPlugin {
|
||||
"qbsprojectmanagersettings.h",
|
||||
"qbsprojectparser.cpp",
|
||||
"qbsprojectparser.h",
|
||||
"qbsrunconfiguration.cpp",
|
||||
"qbsrunconfiguration.h",
|
||||
]
|
||||
|
||||
// QML typeinfo stuff
|
||||
|
||||
@@ -35,7 +35,6 @@
|
||||
#include "qbsproject.h"
|
||||
#include "qbsprojectmanager.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
#include "qbsrunconfiguration.h"
|
||||
|
||||
#include <coreplugin/actionmanager/actioncontainer.h>
|
||||
#include <coreplugin/actionmanager/actionmanager.h>
|
||||
@@ -91,8 +90,6 @@ public:
|
||||
QbsBuildStepFactory buildStepFactory;
|
||||
QbsCleanStepFactory cleanStepFactory;
|
||||
QbsInstallStepFactory installStepFactory;
|
||||
QbsRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, QbsRunConfiguration> runWorkerFactory;
|
||||
QbsProfilesSettingsPage profilesSetttingsPage;
|
||||
QbsKitAspect qbsKitAspect;
|
||||
};
|
||||
|
||||
@@ -1,170 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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 "qbsrunconfiguration.h"
|
||||
|
||||
#include "qbsnodes.h"
|
||||
#include "qbspmlogging.h"
|
||||
#include "qbsprojectmanagerconstants.h"
|
||||
#include "qbsproject.h"
|
||||
|
||||
#include <projectexplorer/buildmanager.h>
|
||||
#include <projectexplorer/deploymentdata.h>
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtoutputformatter.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsRunConfiguration:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsRunConfiguration::QbsRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
envAspect->addModifier([this](Environment &env) {
|
||||
bool usingLibraryPaths = aspect<UseLibraryPathsAspect>()->value();
|
||||
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, usingLibraryPaths);
|
||||
});
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = addAspect<UseDyldSuffixAspect>();
|
||||
connect(dyldAspect, &UseDyldSuffixAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
envAspect->addModifier([dyldAspect](Environment &env) {
|
||||
if (dyldAspect->value())
|
||||
env.set("DYLD_IMAGE_SUFFIX", "_debug");
|
||||
});
|
||||
}
|
||||
|
||||
connect(project(), &Project::parsingFinished,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
connect(target, &Target::deploymentDataChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
connect(target, &Target::applicationTargetsChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
// Handles device changes, etc.
|
||||
connect(target, &Target::kitChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
|
||||
auto qbsProject = static_cast<QbsProject *>(target->project());
|
||||
connect(qbsProject, &Project::parsingFinished,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
}
|
||||
|
||||
QVariantMap QbsRunConfiguration::toMap() const
|
||||
{
|
||||
return RunConfiguration::toMap();
|
||||
}
|
||||
|
||||
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||
{
|
||||
setDefaultDisplayName(info.displayName);
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
Utils::FilePath QbsRunConfiguration::executableToRun(const BuildTargetInfo &targetInfo) const
|
||||
{
|
||||
const FilePath appInBuildDir = targetInfo.targetFilePath;
|
||||
if (target()->deploymentData().localInstallRoot().isEmpty())
|
||||
return appInBuildDir;
|
||||
const QString deployedAppFilePath = target()->deploymentData()
|
||||
.deployableForLocalFile(appInBuildDir.toString()).remoteFilePath();
|
||||
if (deployedAppFilePath.isEmpty())
|
||||
return appInBuildDir;
|
||||
const FilePath appInLocalInstallDir = target()->deploymentData().localInstallRoot()
|
||||
+ deployedAppFilePath;
|
||||
return appInLocalInstallDir.exists() ? appInLocalInstallDir : appInBuildDir;
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
setDefaultDisplayName(bti.displayName);
|
||||
const FilePath executable = executableToRun(bti);
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(executable);
|
||||
|
||||
if (!executable.isEmpty()) {
|
||||
QString defaultWorkingDir = QFileInfo(executable.toString()).absolutePath();
|
||||
if (!defaultWorkingDir.isEmpty()) {
|
||||
auto wdAspect = aspect<WorkingDirectoryAspect>();
|
||||
wdAspect->setDefaultWorkingDirectory(FilePath::fromString(defaultWorkingDir));
|
||||
}
|
||||
}
|
||||
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
// --------------------------------------------------------------------
|
||||
// QbsRunConfigurationFactory:
|
||||
// --------------------------------------------------------------------
|
||||
|
||||
QbsRunConfigurationFactory::QbsRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<QbsRunConfiguration>("Qbs.RunConfiguration:");
|
||||
addSupportedProjectType(Constants::PROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
@@ -14,7 +14,6 @@ add_qtc_plugin(QmakeProjectManager
|
||||
customwidgetwizard/filenamingparameters.h
|
||||
customwidgetwizard/plugingenerator.cpp customwidgetwizard/plugingenerator.h
|
||||
customwidgetwizard/pluginoptions.h
|
||||
desktopqmakerunconfiguration.cpp desktopqmakerunconfiguration.h
|
||||
externaleditors.cpp externaleditors.h
|
||||
librarydetailscontroller.cpp librarydetailscontroller.h
|
||||
librarydetailswidget.ui
|
||||
|
||||
@@ -1,153 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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 "desktopqmakerunconfiguration.h"
|
||||
|
||||
#include "qmakeprojectmanagerconstants.h"
|
||||
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projectnodes.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <qtsupport/qtkitinformation.h>
|
||||
#include <qtsupport/qtoutputformatter.h>
|
||||
#include <qtsupport/qtsupportconstants.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/persistentsettings.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/qtcprocess.h>
|
||||
#include <utils/stringutils.h>
|
||||
#include <utils/utilsicons.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
//
|
||||
// DesktopQmakeRunConfiguration
|
||||
//
|
||||
|
||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
envAspect->addModifier([this](Environment &env) {
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, aspect<UseLibraryPathsAspect>()->value());
|
||||
});
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = addAspect<UseDyldSuffixAspect>();
|
||||
connect(dyldAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
envAspect->addModifier([dyldAspect](Environment &env) {
|
||||
if (dyldAspect->value())
|
||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||
});
|
||||
}
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
aspect<EnvironmentAspect>()->environmentChanged();
|
||||
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
|
||||
auto wda = aspect<WorkingDirectoryAspect>();
|
||||
wda->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||
if (wda->pathChooser())
|
||||
wda->pathChooser()->setBaseFileName(target()->project()->projectDirectory());
|
||||
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
}
|
||||
|
||||
bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
FilePath DesktopQmakeRunConfiguration::proFilePath() const
|
||||
{
|
||||
return FilePath::fromString(buildKey());
|
||||
}
|
||||
|
||||
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
||||
{
|
||||
FilePath profile = proFilePath();
|
||||
if (!profile.isEmpty())
|
||||
return profile.toFileInfo().completeBaseName();
|
||||
return tr("Qt Run Configuration");
|
||||
}
|
||||
|
||||
//
|
||||
// DesktopQmakeRunConfigurationFactory
|
||||
//
|
||||
|
||||
DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<DesktopQmakeRunConfiguration>("Qt4ProjectManager.Qt4RunConfiguration:");
|
||||
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
@@ -1,58 +0,0 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2016 The Qt Company Ltd.
|
||||
** Contact: https://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.
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
|
||||
namespace QmakeProjectManager {
|
||||
namespace Internal {
|
||||
|
||||
class DesktopQmakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DesktopQmakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
private:
|
||||
void updateTargetInformation();
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
||||
|
||||
QString defaultDisplayName();
|
||||
Utils::FilePath proFilePath() const;
|
||||
};
|
||||
|
||||
class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
DesktopQmakeRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QmakeProjectManager
|
||||
@@ -35,7 +35,6 @@ HEADERS += \
|
||||
addlibrarywizard.h \
|
||||
librarydetailscontroller.h \
|
||||
qmakeprojectmanager_global.h \
|
||||
desktopqmakerunconfiguration.h \
|
||||
profilecompletionassist.h \
|
||||
makefileparse.h \
|
||||
qmakemakestep.h
|
||||
@@ -68,7 +67,6 @@ SOURCES += \
|
||||
qmakeparser.cpp \
|
||||
addlibrarywizard.cpp \
|
||||
librarydetailscontroller.cpp \
|
||||
desktopqmakerunconfiguration.cpp \
|
||||
profilecompletionassist.cpp \
|
||||
makefileparse.cpp \
|
||||
qmakemakestep.cpp
|
||||
|
||||
@@ -26,7 +26,6 @@ Project {
|
||||
name: "General"
|
||||
files: [
|
||||
"addlibrarywizard.cpp", "addlibrarywizard.h",
|
||||
"desktopqmakerunconfiguration.cpp", "desktopqmakerunconfiguration.h",
|
||||
"externaleditors.cpp", "externaleditors.h",
|
||||
"librarydetailscontroller.cpp", "librarydetailscontroller.h",
|
||||
"librarydetailswidget.ui",
|
||||
|
||||
@@ -32,7 +32,6 @@
|
||||
#include "qmakestep.h"
|
||||
#include "qmakemakestep.h"
|
||||
#include "qmakebuildconfiguration.h"
|
||||
#include "desktopqmakerunconfiguration.h"
|
||||
#include "wizards/simpleprojectwizard.h"
|
||||
#include "wizards/subdirsprojectwizard.h"
|
||||
#include "customwidgetwizard/customwidgetwizard.h"
|
||||
@@ -98,9 +97,6 @@ public:
|
||||
QmakeMakeStepFactory makeStepFactory;
|
||||
|
||||
QmakeBuildConfigurationFactory buildConfigFactory;
|
||||
DesktopQmakeRunConfigurationFactory runConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, DesktopQmakeRunConfiguration>
|
||||
runWorkerFactory;
|
||||
|
||||
ProFileEditorFactory profileEditorFactory;
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ add_qtc_plugin(QtSupport
|
||||
codegensettingspage.cpp codegensettingspage.h
|
||||
codegensettingspagewidget.ui
|
||||
desktopqtversion.cpp desktopqtversion.h
|
||||
desktoprunconfiguration.cpp desktoprunconfiguration.h
|
||||
exampleslistmodel.cpp exampleslistmodel.h
|
||||
gettingstartedwelcomepage.cpp gettingstartedwelcomepage.h
|
||||
profilereader.cpp profilereader.h
|
||||
|
||||
332
src/plugins/qtsupport/desktoprunconfiguration.cpp
Normal file
332
src/plugins/qtsupport/desktoprunconfiguration.cpp
Normal file
@@ -0,0 +1,332 @@
|
||||
/****************************************************************************
|
||||
**
|
||||
** Copyright (C) 2019 The Qt Company Ltd.
|
||||
** Contact: https://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 "desktoprunconfiguration.h"
|
||||
|
||||
#include "qtkitinformation.h"
|
||||
#include "qtoutputformatter.h"
|
||||
|
||||
#include <projectexplorer/localenvironmentaspect.h>
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <cmakeprojectmanager/cmakeprojectconstants.h>
|
||||
#include <qbsprojectmanager/qbsprojectmanagerconstants.h>
|
||||
#include <qmakeprojectmanager/qmakeprojectmanagerconstants.h>
|
||||
|
||||
#include <utils/fileutils.h>
|
||||
#include <utils/pathchooser.h>
|
||||
#include <utils/qtcassert.h>
|
||||
#include <utils/stringutils.h>
|
||||
|
||||
#include <QFileInfo>
|
||||
|
||||
using namespace ProjectExplorer;
|
||||
using namespace Utils;
|
||||
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
// DesktopQmakeRunConfiguration
|
||||
|
||||
DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
envAspect->addModifier([this](Environment &env) {
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, aspect<UseLibraryPathsAspect>()->value());
|
||||
});
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = addAspect<UseDyldSuffixAspect>();
|
||||
connect(dyldAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
envAspect->addModifier([dyldAspect](Environment &env) {
|
||||
if (dyldAspect->value())
|
||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||
});
|
||||
}
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
setDefaultDisplayName(defaultDisplayName());
|
||||
aspect<EnvironmentAspect>()->environmentChanged();
|
||||
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
|
||||
auto wda = aspect<WorkingDirectoryAspect>();
|
||||
wda->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||
if (wda->pathChooser())
|
||||
wda->pathChooser()->setBaseFileName(target()->project()->projectDirectory());
|
||||
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
}
|
||||
|
||||
bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
|
||||
void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||
{
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
FilePath DesktopQmakeRunConfiguration::proFilePath() const
|
||||
{
|
||||
return FilePath::fromString(buildKey());
|
||||
}
|
||||
|
||||
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
||||
{
|
||||
FilePath profile = proFilePath();
|
||||
if (!profile.isEmpty())
|
||||
return profile.toFileInfo().completeBaseName();
|
||||
return tr("Qt Run Configuration");
|
||||
}
|
||||
|
||||
|
||||
// Qbs
|
||||
|
||||
QbsRunConfiguration::QbsRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
envAspect->addModifier([this](Environment &env) {
|
||||
bool usingLibraryPaths = aspect<UseLibraryPathsAspect>()->value();
|
||||
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
if (bti.runEnvModifier)
|
||||
bti.runEnvModifier(env, usingLibraryPaths);
|
||||
});
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
auto libAspect = addAspect<UseLibraryPathsAspect>();
|
||||
connect(libAspect, &UseLibraryPathsAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
if (HostOsInfo::isMacHost()) {
|
||||
auto dyldAspect = addAspect<UseDyldSuffixAspect>();
|
||||
connect(dyldAspect, &UseDyldSuffixAspect::changed,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
envAspect->addModifier([dyldAspect](Environment &env) {
|
||||
if (dyldAspect->value())
|
||||
env.set("DYLD_IMAGE_SUFFIX", "_debug");
|
||||
});
|
||||
}
|
||||
|
||||
connect(project(), &Project::parsingFinished,
|
||||
envAspect, &EnvironmentAspect::environmentChanged);
|
||||
|
||||
connect(target, &Target::deploymentDataChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
connect(target, &Target::applicationTargetsChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
// Handles device changes, etc.
|
||||
connect(target, &Target::kitChanged,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &QbsRunConfiguration::updateTargetInformation);
|
||||
}
|
||||
|
||||
QVariantMap QbsRunConfiguration::toMap() const
|
||||
{
|
||||
return RunConfiguration::toMap();
|
||||
}
|
||||
|
||||
bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
||||
{
|
||||
if (!RunConfiguration::fromMap(map))
|
||||
return false;
|
||||
|
||||
updateTargetInformation();
|
||||
return true;
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||
{
|
||||
setDefaultDisplayName(info.displayName);
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
Utils::FilePath QbsRunConfiguration::executableToRun(const BuildTargetInfo &targetInfo) const
|
||||
{
|
||||
const FilePath appInBuildDir = targetInfo.targetFilePath;
|
||||
if (target()->deploymentData().localInstallRoot().isEmpty())
|
||||
return appInBuildDir;
|
||||
const QString deployedAppFilePath = target()->deploymentData()
|
||||
.deployableForLocalFile(appInBuildDir.toString()).remoteFilePath();
|
||||
if (deployedAppFilePath.isEmpty())
|
||||
return appInBuildDir;
|
||||
const FilePath appInLocalInstallDir = target()->deploymentData().localInstallRoot()
|
||||
+ deployedAppFilePath;
|
||||
return appInLocalInstallDir.exists() ? appInLocalInstallDir : appInBuildDir;
|
||||
}
|
||||
|
||||
void QbsRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
setDefaultDisplayName(bti.displayName);
|
||||
const FilePath executable = executableToRun(bti);
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
|
||||
aspect<ExecutableAspect>()->setExecutable(executable);
|
||||
|
||||
if (!executable.isEmpty()) {
|
||||
QString defaultWorkingDir = QFileInfo(executable.toString()).absolutePath();
|
||||
if (!defaultWorkingDir.isEmpty()) {
|
||||
auto wdAspect = aspect<WorkingDirectoryAspect>();
|
||||
wdAspect->setDefaultWorkingDirectory(FilePath::fromString(defaultWorkingDir));
|
||||
}
|
||||
}
|
||||
|
||||
emit enabledChanged();
|
||||
}
|
||||
|
||||
// CMakeRunConfiguration
|
||||
|
||||
CMakeRunConfiguration::CMakeRunConfiguration(Target *target, Core::Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
auto envAspect = addAspect<LocalEnvironmentAspect>(target);
|
||||
|
||||
// Workaround for QTCREATORBUG-19354:
|
||||
if (HostOsInfo::isWindowsHost()) {
|
||||
envAspect->addModifier([target](Environment &env) {
|
||||
const Kit *k = target->kit();
|
||||
if (const QtSupport::BaseQtVersion *qt = QtSupport::QtKitAspect::qtVersion(k)) {
|
||||
const QString installBinPath = qt->qmakeProperty("QT_INSTALL_BINS");
|
||||
env.prependOrSetPath(installBinPath);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
addAspect<ExecutableAspect>();
|
||||
addAspect<ArgumentsAspect>();
|
||||
addAspect<WorkingDirectoryAspect>();
|
||||
addAspect<TerminalAspect>();
|
||||
|
||||
connect(target->project(), &Project::parsingFinished,
|
||||
this, &CMakeRunConfiguration::updateTargetInformation);
|
||||
|
||||
if (QtSupport::QtKitAspect::qtVersion(target->kit()))
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||
{
|
||||
Q_UNUSED(info)
|
||||
updateTargetInformation();
|
||||
}
|
||||
|
||||
bool CMakeRunConfiguration::isBuildTargetValid() const
|
||||
{
|
||||
return Utils::anyOf(target()->applicationTargets(), [this](const BuildTargetInfo &bti) {
|
||||
return bti.buildKey == buildKey();
|
||||
});
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::updateEnabledState()
|
||||
{
|
||||
if (!isBuildTargetValid())
|
||||
setEnabled(false);
|
||||
else
|
||||
RunConfiguration::updateEnabledState();
|
||||
}
|
||||
|
||||
QString CMakeRunConfiguration::disabledReason() const
|
||||
{
|
||||
if (!isBuildTargetValid())
|
||||
return tr("The project no longer builds the target associated with this run configuration.");
|
||||
return RunConfiguration::disabledReason();
|
||||
}
|
||||
|
||||
void CMakeRunConfiguration::updateTargetInformation()
|
||||
{
|
||||
BuildTargetInfo bti = buildTargetInfo();
|
||||
aspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||
aspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||
aspect<LocalEnvironmentAspect>()->environmentChanged();
|
||||
|
||||
auto terminalAspect = aspect<TerminalAspect>();
|
||||
terminalAspect->setUseTerminalHint(bti.usesTerminal);
|
||||
}
|
||||
|
||||
// Factory
|
||||
|
||||
CMakeRunConfigurationFactory::CMakeRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<CMakeRunConfiguration>("CMakeProjectManager.CMakeRunConfiguration.");
|
||||
addSupportedProjectType(CMakeProjectManager::Constants::CMAKEPROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
QbsRunConfigurationFactory::QbsRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<QbsRunConfiguration>("Qbs.RunConfiguration:");
|
||||
addSupportedProjectType(QbsProjectManager::Constants::PROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
DesktopQmakeRunConfigurationFactory::DesktopQmakeRunConfigurationFactory()
|
||||
{
|
||||
registerRunConfiguration<DesktopQmakeRunConfiguration>("Qt4ProjectManager.Qt4RunConfiguration:");
|
||||
addSupportedProjectType(QmakeProjectManager::Constants::QMAKEPROJECT_ID);
|
||||
addSupportedTargetDeviceType(ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE);
|
||||
}
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace ProjectExplorer
|
||||
@@ -25,15 +25,29 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include "qtsupport_global.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QPair>
|
||||
#include <QStringList>
|
||||
#include "projectexplorer/runconfigurationaspects.h"
|
||||
|
||||
namespace QbsProjectManager {
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
|
||||
class DesktopQmakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
DesktopQmakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
private:
|
||||
void updateTargetInformation();
|
||||
bool fromMap(const QVariantMap &map) final;
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
||||
|
||||
QString defaultDisplayName();
|
||||
Utils::FilePath proFilePath() const;
|
||||
};
|
||||
|
||||
class QbsRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
@@ -50,11 +64,40 @@ private:
|
||||
void updateTargetInformation();
|
||||
};
|
||||
|
||||
class CMakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
CMakeRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||
|
||||
private:
|
||||
QString disabledReason() const override;
|
||||
|
||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
||||
bool isBuildTargetValid() const;
|
||||
void updateTargetInformation();
|
||||
|
||||
void updateEnabledState() final;
|
||||
};
|
||||
|
||||
class DesktopQmakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
DesktopQmakeRunConfigurationFactory();
|
||||
};
|
||||
|
||||
class QbsRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
QbsRunConfigurationFactory();
|
||||
};
|
||||
|
||||
class CMakeRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||
{
|
||||
public:
|
||||
CMakeRunConfigurationFactory();
|
||||
};
|
||||
|
||||
} // namespace Internal
|
||||
} // namespace QbsProjectManager
|
||||
} // namespace QtSupport
|
||||
@@ -31,7 +31,8 @@ HEADERS += \
|
||||
qtconfigwidget.h \
|
||||
desktopqtversion.h \
|
||||
uicgenerator.h \
|
||||
qscxmlcgenerator.h
|
||||
qscxmlcgenerator.h \
|
||||
desktoprunconfiguration.h
|
||||
|
||||
SOURCES += \
|
||||
codegenerator.cpp \
|
||||
@@ -56,7 +57,8 @@ SOURCES += \
|
||||
qtconfigwidget.cpp \
|
||||
desktopqtversion.cpp \
|
||||
uicgenerator.cpp \
|
||||
qscxmlcgenerator.cpp
|
||||
qscxmlcgenerator.cpp \
|
||||
desktoprunconfiguration.cpp
|
||||
|
||||
FORMS += \
|
||||
codegensettingspagewidget.ui \
|
||||
|
||||
@@ -67,6 +67,8 @@ Project {
|
||||
"codegensettingspage.cpp",
|
||||
"codegensettingspage.h",
|
||||
"codegensettingspagewidget.ui",
|
||||
"desktoprunconfiguration.cpp",
|
||||
"desktoprunconfiguration.h",
|
||||
"qtconfigwidget.cpp",
|
||||
"qtconfigwidget.h",
|
||||
"qtcppkitinfo.cpp",
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
#include "qscxmlcgenerator.h"
|
||||
|
||||
#include "desktopqtversion.h"
|
||||
#include "desktoprunconfiguration.h"
|
||||
#include "profilereader.h"
|
||||
|
||||
#include <coreplugin/icore.h>
|
||||
@@ -45,6 +46,7 @@
|
||||
|
||||
#include <projectexplorer/project.h>
|
||||
#include <projectexplorer/projecttree.h>
|
||||
#include <projectexplorer/runcontrol.h>
|
||||
#include <projectexplorer/target.h>
|
||||
|
||||
#include <utils/macroexpander.h>
|
||||
@@ -53,6 +55,7 @@ const char kHostBins[] = "CurrentProject:QT_HOST_BINS";
|
||||
const char kInstallBins[] = "CurrentProject:QT_INSTALL_BINS";
|
||||
|
||||
using namespace Core;
|
||||
using namespace ProjectExplorer;
|
||||
|
||||
namespace QtSupport {
|
||||
namespace Internal {
|
||||
@@ -66,6 +69,18 @@ public:
|
||||
CodeGenSettingsPage codeGenSettingsPage;
|
||||
QtOptionsPage qtOptionsPage;
|
||||
|
||||
DesktopQmakeRunConfigurationFactory desktopQmakeRunConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, DesktopQmakeRunConfiguration>
|
||||
desktopQmakeRunWorkerFactory;
|
||||
|
||||
QbsRunConfigurationFactory desktopQbsRunConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, QbsRunConfiguration>
|
||||
desktopQbsRunWorkerFactory;
|
||||
|
||||
CMakeRunConfigurationFactory desktopCMakeRunConfigFactory;
|
||||
SimpleRunWorkerFactory<SimpleTargetRunner, CMakeRunConfiguration>
|
||||
desktopCMakeRunWorkerFactory;
|
||||
|
||||
ExamplesWelcomePage examplesPage{true};
|
||||
ExamplesWelcomePage tutorialPage{false};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user