diff options
26 files changed, 412 insertions, 606 deletions
diff --git a/src/plugins/cmakeprojectmanager/CMakeLists.txt b/src/plugins/cmakeprojectmanager/CMakeLists.txt index 93113b643bb..245698b5c29 100644 --- a/src/plugins/cmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/cmakeprojectmanager/CMakeLists.txt @@ -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 diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp index 014d52995c4..830a3fb57fa 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.cpp @@ -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()); diff --git a/src/plugins/cmakeprojectmanager/cmakebuildstep.h b/src/plugins/cmakeprojectmanager/cmakebuildstep.h index 51f621abc79..5f2b9336b24 100644 --- a/src/plugins/cmakeprojectmanager/cmakebuildstep.h +++ b/src/plugins/cmakeprojectmanager/cmakebuildstep.h @@ -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; diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro index 6407308ad99..4a3cde818af 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.pro @@ -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 \ diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs index 68f8fc47d29..3edac535604 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs +++ b/src/plugins/cmakeprojectmanager/cmakeprojectmanager.qbs @@ -61,8 +61,6 @@ QtcPlugin { "cmakeprojectnodes.h", "cmakeprojectplugin.cpp", "cmakeprojectplugin.h", - "cmakerunconfiguration.cpp", - "cmakerunconfiguration.h", "cmaketool.cpp", "cmaketool.h", "cmaketoolmanager.cpp", diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp index d8d2164395e..5418a1994ee 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectplugin.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectplugin.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; diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp deleted file mode 100644 index 495f5df4ecc..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h b/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h deleted file mode 100644 index e9d0e18827c..00000000000 --- a/src/plugins/cmakeprojectmanager/cmakerunconfiguration.h +++ /dev/null @@ -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 diff --git a/src/plugins/qbsprojectmanager/CMakeLists.txt b/src/plugins/qbsprojectmanager/CMakeLists.txt index 3b20c283f4e..997e710a83e 100644 --- a/src/plugins/qbsprojectmanager/CMakeLists.txt +++ b/src/plugins/qbsprojectmanager/CMakeLists.txt @@ -32,5 +32,4 @@ add_qtc_plugin(QbsProjectManager qbsprojectmanagerplugin.cpp qbsprojectmanagerplugin.h qbsprojectmanagersettings.cpp qbsprojectmanagersettings.h qbsprojectparser.cpp qbsprojectparser.h - qbsrunconfiguration.cpp qbsrunconfiguration.h ) diff --git a/src/plugins/qbsprojectmanager/qbsnodes.cpp b/src/plugins/qbsprojectmanager/qbsnodes.cpp index 697d610aa7e..719897ec78a 100644 --- a/src/plugins/qbsprojectmanager/qbsnodes.cpp +++ b/src/plugins/qbsprojectmanager/qbsnodes.cpp @@ -29,7 +29,6 @@ #include "qbsproject.h" #include "qbsprojectmanagerconstants.h" #include "qbsprojectmanagerplugin.h" -#include "qbsrunconfiguration.h" #include <android/androidconstants.h> #include <coreplugin/fileiconprovider.h> diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro index fd22ac238e3..1b8896b33c9 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.pro +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.pro @@ -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 \ diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs index aa4f5a8a2c3..5c933991af8 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs +++ b/src/plugins/qbsprojectmanager/qbsprojectmanager.qbs @@ -103,8 +103,6 @@ QtcPlugin { "qbsprojectmanagersettings.h", "qbsprojectparser.cpp", "qbsprojectparser.h", - "qbsrunconfiguration.cpp", - "qbsrunconfiguration.h", ] // QML typeinfo stuff diff --git a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp index 037437959d7..93bbd892b76 100644 --- a/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp +++ b/src/plugins/qbsprojectmanager/qbsprojectmanagerplugin.cpp @@ -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; }; diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp b/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp deleted file mode 100644 index 5a778aea9fb..00000000000 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qmakeprojectmanager/CMakeLists.txt b/src/plugins/qmakeprojectmanager/CMakeLists.txt index 5cd7b6cc194..23c1c76abe2 100644 --- a/src/plugins/qmakeprojectmanager/CMakeLists.txt +++ b/src/plugins/qmakeprojectmanager/CMakeLists.txt @@ -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 diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp deleted file mode 100644 index c055e9bc030..00000000000 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ /dev/null @@ -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 diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h deleted file mode 100644 index 27bfb430b17..00000000000 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.h +++ /dev/null @@ -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 diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro index ccc64eda006..f4db2d95f5d 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.pro @@ -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 diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs index e045f60663e..53958109b38 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanager.qbs @@ -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", diff --git a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp index bf21949215b..74077eefac9 100644 --- a/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeprojectmanagerplugin.cpp @@ -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; diff --git a/src/plugins/qtsupport/CMakeLists.txt b/src/plugins/qtsupport/CMakeLists.txt index 125e949b35a..c2b46010b04 100644 --- a/src/plugins/qtsupport/CMakeLists.txt +++ b/src/plugins/qtsupport/CMakeLists.txt @@ -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 diff --git a/src/plugins/qtsupport/desktoprunconfiguration.cpp b/src/plugins/qtsupport/desktoprunconfiguration.cpp new file mode 100644 index 00000000000..a7d9f4452af --- /dev/null +++ b/src/plugins/qtsupport/desktoprunconfiguration.cpp @@ -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 diff --git a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h b/src/plugins/qtsupport/desktoprunconfiguration.h index 934f676624b..52960045a38 100644 --- a/src/plugins/qbsprojectmanager/qbsrunconfiguration.h +++ b/src/plugins/qtsupport/desktoprunconfiguration.h @@ -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 diff --git a/src/plugins/qtsupport/qtsupport.pro b/src/plugins/qtsupport/qtsupport.pro index 4c5900027fd..fb7cbc20e28 100644 --- a/src/plugins/qtsupport/qtsupport.pro +++ b/src/plugins/qtsupport/qtsupport.pro @@ -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 \ diff --git a/src/plugins/qtsupport/qtsupport.qbs b/src/plugins/qtsupport/qtsupport.qbs index 7e2aa71e328..1087304be68 100644 --- a/src/plugins/qtsupport/qtsupport.qbs +++ b/src/plugins/qtsupport/qtsupport.qbs @@ -67,6 +67,8 @@ Project { "codegensettingspage.cpp", "codegensettingspage.h", "codegensettingspagewidget.ui", + "desktoprunconfiguration.cpp", + "desktoprunconfiguration.h", "qtconfigwidget.cpp", "qtconfigwidget.h", "qtcppkitinfo.cpp", diff --git a/src/plugins/qtsupport/qtsupportplugin.cpp b/src/plugins/qtsupport/qtsupportplugin.cpp index a143db76b3a..d1d4ca75f53 100644 --- a/src/plugins/qtsupport/qtsupportplugin.cpp +++ b/src/plugins/qtsupport/qtsupportplugin.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}; |