forked from qt-creator/qt-creator
ProjectExplorer: Proliferate FilePath
DeployableFile and fallout. Change-Id: I9a9c56e4a4ebf8f68df70d65da2e699efedfe907 Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
This commit is contained in:
@@ -171,7 +171,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
|
|||||||
// deployment information should get taken into account, but it pretty much seems as if
|
// deployment information should get taken into account, but it pretty much seems as if
|
||||||
// each build system uses it differently
|
// each build system uses it differently
|
||||||
const DeploymentData &deployData = target->deploymentData();
|
const DeploymentData &deployData = target->deploymentData();
|
||||||
const DeployableFile deploy = deployData.deployableForLocalFile(localExecutable.toString());
|
const DeployableFile deploy = deployData.deployableForLocalFile(localExecutable);
|
||||||
// we might have a deployable executable
|
// we might have a deployable executable
|
||||||
const FilePath deployedExecutable = ensureExeEnding((deploy.isValid() && deploy.isExecutable())
|
const FilePath deployedExecutable = ensureExeEnding((deploy.isValid() && deploy.isExecutable())
|
||||||
? FilePath::fromString(QDir::cleanPath(deploy.remoteFilePath())) : localExecutable);
|
? FilePath::fromString(QDir::cleanPath(deploy.remoteFilePath())) : localExecutable);
|
||||||
|
@@ -112,12 +112,12 @@ ProjectExplorer::RunConfiguration::ConfigurationState QdbRunConfiguration::ensur
|
|||||||
|
|
||||||
void QdbRunConfiguration::updateTargetInformation()
|
void QdbRunConfiguration::updateTargetInformation()
|
||||||
{
|
{
|
||||||
BuildTargetInfo bti = buildTargetInfo();
|
const BuildTargetInfo bti = buildTargetInfo();
|
||||||
QString localExecutable = bti.targetFilePath.toString();
|
const FilePath localExecutable = bti.targetFilePath;
|
||||||
DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
const DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
||||||
|
|
||||||
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||||
aspect<SymbolFileAspect>()->setValue(localExecutable);
|
aspect<SymbolFileAspect>()->setFileName(localExecutable);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QdbRunConfiguration::defaultDisplayName() const
|
QString QdbRunConfiguration::defaultDisplayName() const
|
||||||
|
@@ -309,7 +309,7 @@ DeploymentData CMakeBuildConfiguration::deploymentData() const
|
|||||||
for (const CMakeBuildTarget &ct : m_buildTargets) {
|
for (const CMakeBuildTarget &ct : m_buildTargets) {
|
||||||
if (ct.targetType == ExecutableType || ct.targetType == DynamicLibraryType) {
|
if (ct.targetType == ExecutableType || ct.targetType == DynamicLibraryType) {
|
||||||
if (!ct.executable.isEmpty()
|
if (!ct.executable.isEmpty()
|
||||||
&& !result.deployableForLocalFile(ct.executable.toString()).isValid()) {
|
&& !result.deployableForLocalFile(ct.executable).isValid()) {
|
||||||
result.addFile(ct.executable.toString(),
|
result.addFile(ct.executable.toString(),
|
||||||
deploymentPrefix + buildDir.relativeFilePath(ct.executable.toFileInfo().dir().path()),
|
deploymentPrefix + buildDir.relativeFilePath(ct.executable.toFileInfo().dir().path()),
|
||||||
DeployableFile::TypeExecutable);
|
DeployableFile::TypeExecutable);
|
||||||
|
@@ -55,11 +55,10 @@ void DeploymentData::addFile(const QString &localFilePath, const QString &remote
|
|||||||
addFile(DeployableFile(localFilePath, remoteDirectory, type));
|
addFile(DeployableFile(localFilePath, remoteDirectory, type));
|
||||||
}
|
}
|
||||||
|
|
||||||
DeployableFile DeploymentData::deployableForLocalFile(const QString &localFilePath) const
|
DeployableFile DeploymentData::deployableForLocalFile(const Utils::FilePath &localFilePath) const
|
||||||
{
|
{
|
||||||
return Utils::findOrDefault(m_files, [&localFilePath](const DeployableFile &d) {
|
return Utils::findOrDefault(m_files,
|
||||||
return d.localFilePath().toString() == localFilePath;
|
Utils::equal(&DeployableFile::localFilePath, localFilePath));
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DeploymentData::operator==(const DeploymentData &other) const
|
bool DeploymentData::operator==(const DeploymentData &other) const
|
||||||
|
@@ -60,7 +60,7 @@ public:
|
|||||||
|
|
||||||
int fileCount() const { return m_files.count(); }
|
int fileCount() const { return m_files.count(); }
|
||||||
DeployableFile fileAt(int index) const { return m_files.at(index); }
|
DeployableFile fileAt(int index) const { return m_files.at(index); }
|
||||||
DeployableFile deployableForLocalFile(const QString &localFilePath) const;
|
DeployableFile deployableForLocalFile(const Utils::FilePath &localFilePath) const;
|
||||||
|
|
||||||
bool operator==(const DeploymentData &other) const;
|
bool operator==(const DeploymentData &other) const;
|
||||||
|
|
||||||
|
@@ -171,14 +171,16 @@ void DesktopRunConfiguration::doAdditionalSetup(const RunConfigurationCreationIn
|
|||||||
Utils::FilePath DesktopRunConfiguration::executableToRun(const BuildTargetInfo &targetInfo) const
|
Utils::FilePath DesktopRunConfiguration::executableToRun(const BuildTargetInfo &targetInfo) const
|
||||||
{
|
{
|
||||||
const FilePath appInBuildDir = targetInfo.targetFilePath;
|
const FilePath appInBuildDir = targetInfo.targetFilePath;
|
||||||
if (target()->deploymentData().localInstallRoot().isEmpty())
|
const DeploymentData deploymentData = target()->deploymentData();
|
||||||
|
if (deploymentData.localInstallRoot().isEmpty())
|
||||||
return appInBuildDir;
|
return appInBuildDir;
|
||||||
const QString deployedAppFilePath = target()->deploymentData()
|
|
||||||
.deployableForLocalFile(appInBuildDir.toString()).remoteFilePath();
|
const QString deployedAppFilePath = deploymentData
|
||||||
|
.deployableForLocalFile(appInBuildDir).remoteFilePath();
|
||||||
if (deployedAppFilePath.isEmpty())
|
if (deployedAppFilePath.isEmpty())
|
||||||
return appInBuildDir;
|
return appInBuildDir;
|
||||||
const FilePath appInLocalInstallDir = target()->deploymentData().localInstallRoot()
|
|
||||||
+ deployedAppFilePath;
|
const FilePath appInLocalInstallDir = deploymentData.localInstallRoot() + deployedAppFilePath;
|
||||||
return appInLocalInstallDir.exists() ? appInLocalInstallDir : appInBuildDir;
|
return appInLocalInstallDir.exists() ? appInLocalInstallDir : appInBuildDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -66,7 +66,7 @@ QString QmlPreviewFileOnTargetFinder::findPath(const QString &filePath, bool *su
|
|||||||
return filePath;
|
return filePath;
|
||||||
|
|
||||||
ProjectExplorer::DeployableFile file
|
ProjectExplorer::DeployableFile file
|
||||||
= m_target->deploymentData().deployableForLocalFile(filePath);
|
= m_target->deploymentData().deployableForLocalFile(Utils::FilePath::fromString(filePath));
|
||||||
if (file.isValid())
|
if (file.isValid())
|
||||||
return file.remoteFilePath();
|
return file.remoteFilePath();
|
||||||
|
|
||||||
|
@@ -70,12 +70,12 @@ QnxRunConfiguration::QnxRunConfiguration(Target *target, Core::Id id)
|
|||||||
|
|
||||||
auto updateTargetInformation = [this, target, exeAspect, symbolsAspect] {
|
auto updateTargetInformation = [this, target, exeAspect, symbolsAspect] {
|
||||||
|
|
||||||
BuildTargetInfo bti = buildTargetInfo();
|
const BuildTargetInfo bti = buildTargetInfo();
|
||||||
QString localExecutable = bti.targetFilePath.toString();
|
const FilePath localExecutable = bti.targetFilePath;
|
||||||
DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
const DeployableFile depFile = target->deploymentData().deployableForLocalFile(localExecutable);
|
||||||
|
|
||||||
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
exeAspect->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||||
symbolsAspect->setValue(localExecutable);
|
symbolsAspect->setFileName(localExecutable);
|
||||||
|
|
||||||
emit enabledChanged();
|
emit enabledChanged();
|
||||||
};
|
};
|
||||||
|
@@ -90,11 +90,11 @@ Runnable RemoteLinuxRunConfiguration::runnable() const
|
|||||||
void RemoteLinuxRunConfiguration::updateTargetInformation()
|
void RemoteLinuxRunConfiguration::updateTargetInformation()
|
||||||
{
|
{
|
||||||
BuildTargetInfo bti = buildTargetInfo();
|
BuildTargetInfo bti = buildTargetInfo();
|
||||||
QString localExecutable = bti.targetFilePath.toString();
|
const FilePath localExecutable = bti.targetFilePath;
|
||||||
DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
DeployableFile depFile = target()->deploymentData().deployableForLocalFile(localExecutable);
|
||||||
|
|
||||||
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
aspect<ExecutableAspect>()->setExecutable(FilePath::fromString(depFile.remoteFilePath()));
|
||||||
aspect<SymbolFileAspect>()->setValue(localExecutable);
|
aspect<SymbolFileAspect>()->setFileName(localExecutable);
|
||||||
|
|
||||||
emit enabledChanged();
|
emit enabledChanged();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user