diff options
author | hjk <[email protected]> | 2016-01-25 15:00:20 +0100 |
---|---|---|
committer | hjk <[email protected]> | 2016-01-26 10:09:29 +0000 |
commit | 9ae2ce76297ef899e9c4444f736ede4706c7ece4 (patch) | |
tree | 660cd2d30ad4e0d4393e68e66cb738d2e2afd38c /src/plugins/autotest/testconfiguration.cpp | |
parent | 4ea8caccf24451ab70db3bc4aa5ee36859e41684 (diff) |
ProjectExplorer: Drop LocalApplicationRunConfiguration
The functionality can be provided by producing a suitable Runnable
in the derived classes directly.
Change-Id: I7b8e8fe33fffd2b00176b6cf6633eca4e152e466
Reviewed-by: Tobias Hunger <[email protected]>
Diffstat (limited to 'src/plugins/autotest/testconfiguration.cpp')
-rw-r--r-- | src/plugins/autotest/testconfiguration.cpp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/src/plugins/autotest/testconfiguration.cpp b/src/plugins/autotest/testconfiguration.cpp index 063aa5980ea..e770b238f00 100644 --- a/src/plugins/autotest/testconfiguration.cpp +++ b/src/plugins/autotest/testconfiguration.cpp @@ -30,8 +30,9 @@ #include <projectexplorer/buildtargetinfo.h> #include <projectexplorer/environmentaspect.h> -#include <projectexplorer/localapplicationrunconfiguration.h> +#include <projectexplorer/kitinformation.h> #include <projectexplorer/project.h> +#include <projectexplorer/runnables.h> #include <projectexplorer/runconfiguration.h> #include <projectexplorer/session.h> #include <projectexplorer/target.h> @@ -94,20 +95,17 @@ void basicProjectInformation(Project *project, const QString &proFile, QString * } } -void extractEnvironmentInformation(LocalApplicationRunConfiguration *localRunConfiguration, - QString *workDir, Utils::Environment *env) +static bool isLocal(RunConfiguration *runConfiguration) { - *workDir = Utils::FileUtils::normalizePathName(localRunConfiguration->workingDirectory()); - if (auto environmentAspect = localRunConfiguration->extraAspect<EnvironmentAspect>()) - *env = environmentAspect->environment(); + Target *target = runConfiguration ? runConfiguration->target() : 0; + Kit *kit = target ? target->kit() : 0; + return DeviceTypeKitInformation::deviceTypeId(kit) == ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE; } void TestConfiguration::completeTestInformation() { QTC_ASSERT(!m_mainFilePath.isEmpty() || !m_proFile.isEmpty(), return); - typedef LocalApplicationRunConfiguration LocalRunConfig; - Project *project = SessionManager::startupProject(); if (!project) return; @@ -144,21 +142,30 @@ void TestConfiguration::completeTestInformation() QList<RunConfiguration *> rcs = target->runConfigurations(); foreach (RunConfiguration *rc, rcs) { - auto config = qobject_cast<LocalRunConfig *>(rc); - if (config && config->executable() == targetFile) { - extractEnvironmentInformation(config, &workDir, &env); - hasDesktopTarget = true; - break; + Runnable runnable = rc->runnable(); + if (isLocal(rc) && runnable.is<StandardRunnable>()) { + StandardRunnable stdRunnable = runnable.as<StandardRunnable>(); + if (stdRunnable.executable == targetFile) { + workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory); + env = stdRunnable.environment; + hasDesktopTarget = true; + break; + } } } // if we could not figure out the run configuration // try to use the run configuration of the parent project if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { - if (auto config = qobject_cast<LocalRunConfig *>(target->activeRunConfiguration())) { - extractEnvironmentInformation(config, &workDir, &env); - hasDesktopTarget = true; - guessedRunConfiguration = true; + if (auto rc = target->activeRunConfiguration()) { + Runnable runnable = rc->runnable(); + if (isLocal(rc) && runnable.is<StandardRunnable>()) { + StandardRunnable stdRunnable = runnable.as<StandardRunnable>(); + workDir = Utils::FileUtils::normalizePathName(stdRunnable.workingDirectory); + env = stdRunnable.environment; + hasDesktopTarget = true; + guessedRunConfiguration = true; + } } } |