forked from qt-creator/qt-creator
ProjectExplorer: Consolidate RunConfiguration identifications
The previously per-Project/RunConfiguration changing meanings of
BuildTargetInfo::buildTarget have by now been split
into separate values in BuildTargetInfo:
- buildKey a handle to one item in Target::applicationTargetList
- displayName a user-visible string in the run settings page
The buildKey was tweaked to coincide with the previous 'extraId',
i.e. the non-RunConfiguration-type part of the project configuration
id that (still) use id mangling.
This allows replacing the cases of locally stored seven different
versions of buildKey(-ish) data by one RunConfiguration::m_buildKey,
and do all remaining extraId handling in RC::{from,to}Map only,
i.e. remove the base ProjectConfiguration::extraId() virtual and
remove the "re-try fromMap with mangled id" hack entirely.
The id mangling is still used to temporarily maintain .user file
compatibility in some cases for now, but should be replaced by
storing the build key and the RunConfiguration type soon. Qbs
already changes in here to only use the uniqueProductName as
buildKey, without the previously added display name which is
stored as part of the ProjectConfiguration already.
It turns out that RunConfiguration::buildSystemTarget was intended
and used to retrieve an item from the Target::applicationTargetList
for some configurations, coinciding with what buildKey does always.
So use that insteand and drop RunConfiguration::buildSystemTarget.
There is clearly is further consolidation potential left.
handling of (default)displayNames is still a per-runconfiguration
mess and there is further consolidation potential left.
Change-Id: I448ed30f1b562fb91b970e328a42fa5f6fb2e43e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This commit is contained in:
@@ -100,12 +100,8 @@ void TestConfiguration::completeTestInformation(ProjectExplorer::RunConfiguratio
|
|||||||
m_displayName = rc->displayName();
|
m_displayName = rc->displayName();
|
||||||
m_project = rc->project();
|
m_project = rc->project();
|
||||||
|
|
||||||
const QString buildSystemTarget = rc->buildSystemTarget();
|
const QString buildKey = rc->buildKey();
|
||||||
BuildTargetInfo targetInfo
|
BuildTargetInfo targetInfo = target->applicationTargets().buildTargetInfo(buildKey);
|
||||||
= Utils::findOrDefault(target->applicationTargets().list,
|
|
||||||
[&buildSystemTarget] (const BuildTargetInfo &bti) {
|
|
||||||
return bti.targetName == buildSystemTarget;
|
|
||||||
});
|
|
||||||
if (!targetInfo.targetFilePath.isEmpty())
|
if (!targetInfo.targetFilePath.isEmpty())
|
||||||
m_runnable.executable = ensureExeEnding(targetInfo.targetFilePath.toString());
|
m_runnable.executable = ensureExeEnding(targetInfo.targetFilePath.toString());
|
||||||
|
|
||||||
@@ -156,7 +152,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
|
|||||||
const QStringList targWithProjectFile = b.split('|');
|
const QStringList targWithProjectFile = b.split('|');
|
||||||
if (targWithProjectFile.size() != 2) // some build targets might miss the project file
|
if (targWithProjectFile.size() != 2) // some build targets might miss the project file
|
||||||
return false;
|
return false;
|
||||||
return !bti.targetFilePath.isEmpty() && targWithProjectFile.at(0) == bti.targetName
|
return !bti.targetFilePath.isEmpty() && targWithProjectFile.at(0) == bti.buildKey
|
||||||
&& targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString());
|
&& targWithProjectFile.at(1).startsWith(bti.projectFilePath.toString());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@@ -169,7 +165,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
|
|||||||
if (buildTargets.size() == 1) {
|
if (buildTargets.size() == 1) {
|
||||||
targetInfo = buildTargets.first();
|
targetInfo = buildTargets.first();
|
||||||
m_guessedConfiguration = true;
|
m_guessedConfiguration = true;
|
||||||
m_guessedFrom = targetInfo.targetName;
|
m_guessedFrom = targetInfo.buildKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -212,7 +208,7 @@ void TestConfiguration::completeTestInformation(TestRunMode runMode)
|
|||||||
// not the best approach - but depending on the build system and whether the executables
|
// not the best approach - but depending on the build system and whether the executables
|
||||||
// are going to get installed or not we have to soften the condition...
|
// are going to get installed or not we have to soften the condition...
|
||||||
const QString ¤tExecutable = ensureExeEnding(stdRunnable.executable);
|
const QString ¤tExecutable = ensureExeEnding(stdRunnable.executable);
|
||||||
const QString currentBST = runConfig->buildSystemTarget() + '|';
|
const QString currentBST = runConfig->buildKey() + '|';
|
||||||
qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
|
qCDebug(LOG) << " CurrentExecutable" << currentExecutable;
|
||||||
qCDebug(LOG) << " BST of RunConfig" << currentBST;
|
qCDebug(LOG) << " BST of RunConfig" << currentBST;
|
||||||
const bool isQbs = runConfig->id().toString().startsWith("Qbs.RunConfiguration:"); // BAD!
|
const bool isQbs = runConfig->id().toString().startsWith("Qbs.RunConfiguration:"); // BAD!
|
||||||
|
|||||||
@@ -98,17 +98,6 @@ BareMetalRunConfiguration::BareMetalRunConfiguration(Target *target)
|
|||||||
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
this, &BareMetalRunConfiguration::handleBuildSystemDataUpdated); // Handles device changes, etc.
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BareMetalRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_buildKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BareMetalRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
|
||||||
{
|
|
||||||
m_buildKey = info.buildKey;
|
|
||||||
setDefaultDisplayName(info.displayName);
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
QWidget *BareMetalRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return wrapWidget(new BareMetalRunConfigurationWidget(this));
|
return wrapWidget(new BareMetalRunConfigurationWidget(this));
|
||||||
@@ -124,23 +113,15 @@ bool BareMetalRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!RunConfiguration::fromMap(map))
|
if (!RunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_buildKey = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BareMetalRunConfiguration::localExecutableFilePath() const
|
QString BareMetalRunConfiguration::localExecutableFilePath() const
|
||||||
{
|
{
|
||||||
const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(m_buildKey);
|
const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||||
return bti.targetFilePath.toString();
|
return bti.targetFilePath.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString BareMetalRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
const BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(m_buildKey);
|
|
||||||
return bti.targetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
void BareMetalRunConfiguration::handleBuildSystemDataUpdated()
|
void BareMetalRunConfiguration::handleBuildSystemDataUpdated()
|
||||||
{
|
{
|
||||||
emit targetInformationChanged();
|
emit targetInformationChanged();
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ public:
|
|||||||
|
|
||||||
virtual QString localExecutableFilePath() const;
|
virtual QString localExecutableFilePath() const;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
|
|
||||||
static const char *IdPrefix;
|
static const char *IdPrefix;
|
||||||
|
|
||||||
@@ -52,13 +51,9 @@ signals:
|
|||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString extraId() const final;
|
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) final;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void handleBuildSystemDataUpdated();
|
void handleBuildSystemDataUpdated();
|
||||||
|
|
||||||
QString m_buildKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class BareMetalRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
class BareMetalRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||||
|
|||||||
@@ -179,7 +179,7 @@ bool CMakeBuildStep::init(QList<const BuildStep *> &earlierSteps)
|
|||||||
}
|
}
|
||||||
|
|
||||||
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
|
CMakeRunConfiguration *rc = targetsActiveRunConfiguration();
|
||||||
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildSystemTarget().isEmpty())) {
|
if (isCurrentExecutableTarget(m_buildTarget) && (!rc || rc->buildKey().isEmpty())) {
|
||||||
emit addTask(Task(Task::Error,
|
emit addTask(Task(Task::Error,
|
||||||
QCoreApplication::translate("ProjectExplorer::Task",
|
QCoreApplication::translate("ProjectExplorer::Task",
|
||||||
"You asked to build the current Run Configuration's build target only, "
|
"You asked to build the current Run Configuration's build target only, "
|
||||||
@@ -365,7 +365,7 @@ QString CMakeBuildStep::allArguments(const CMakeRunConfiguration *rc) const
|
|||||||
|
|
||||||
if (isCurrentExecutableTarget(m_buildTarget)) {
|
if (isCurrentExecutableTarget(m_buildTarget)) {
|
||||||
if (rc)
|
if (rc)
|
||||||
target = rc->buildSystemTarget();
|
target = rc->buildKey();
|
||||||
else
|
else
|
||||||
target = "<i><" + tr(ADD_RUNCONFIGURATION_TEXT) + "></i>";
|
target = "<i><" + tr(ADD_RUNCONFIGURATION_TEXT) + "></i>";
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -627,7 +627,6 @@ void CMakeProject::updateApplicationAndDeploymentTargets()
|
|||||||
}
|
}
|
||||||
if (ct.targetType == ExecutableType) {
|
if (ct.targetType == ExecutableType) {
|
||||||
BuildTargetInfo bti;
|
BuildTargetInfo bti;
|
||||||
bti.targetName = ct.title;
|
|
||||||
bti.displayName = ct.title;
|
bti.displayName = ct.title;
|
||||||
bti.targetFilePath = ct.executable;
|
bti.targetFilePath = ct.executable;
|
||||||
bti.projectFilePath = ct.sourceDirectory;
|
bti.projectFilePath = ct.sourceDirectory;
|
||||||
|
|||||||
@@ -85,11 +85,6 @@ CMakeRunConfiguration::CMakeRunConfiguration(Target *target)
|
|||||||
this, &CMakeRunConfiguration::updateTargetInformation);
|
this, &CMakeRunConfiguration::updateTargetInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString CMakeRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_buildSystemTarget;
|
|
||||||
}
|
|
||||||
|
|
||||||
Runnable CMakeRunConfiguration::runnable() const
|
Runnable CMakeRunConfiguration::runnable() const
|
||||||
{
|
{
|
||||||
StandardRunnable r;
|
StandardRunnable r;
|
||||||
@@ -112,13 +107,11 @@ bool CMakeRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
{
|
{
|
||||||
RunConfiguration::fromMap(map);
|
RunConfiguration::fromMap(map);
|
||||||
m_title = map.value(QLatin1String(TITLE_KEY)).toString();
|
m_title = map.value(QLatin1String(TITLE_KEY)).toString();
|
||||||
m_buildSystemTarget = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||||
{
|
{
|
||||||
m_buildSystemTarget = info.buildKey;
|
|
||||||
m_title = info.displayName;
|
m_title = info.displayName;
|
||||||
updateTargetInformation();
|
updateTargetInformation();
|
||||||
}
|
}
|
||||||
@@ -126,7 +119,7 @@ void CMakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo
|
|||||||
bool CMakeRunConfiguration::isBuildTargetValid() const
|
bool CMakeRunConfiguration::isBuildTargetValid() const
|
||||||
{
|
{
|
||||||
return Utils::anyOf(target()->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
return Utils::anyOf(target()->applicationTargets().list, [this](const BuildTargetInfo &bti) {
|
||||||
return bti.buildKey == m_buildSystemTarget;
|
return bti.buildKey == buildKey();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -161,7 +154,7 @@ void CMakeRunConfiguration::updateTargetInformation()
|
|||||||
{
|
{
|
||||||
setDefaultDisplayName(m_title);
|
setDefaultDisplayName(m_title);
|
||||||
|
|
||||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(m_buildSystemTarget);
|
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||||
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
extraAspect<ExecutableAspect>()->setExecutable(bti.targetFilePath);
|
||||||
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
extraAspect<WorkingDirectoryAspect>()->setDefaultWorkingDirectory(bti.workingDirectory);
|
||||||
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
|
extraAspect<LocalEnvironmentAspect>()->buildEnvironmentHasChanged();
|
||||||
|
|||||||
@@ -37,8 +37,6 @@ class CMakeRunConfiguration : public ProjectExplorer::RunConfiguration
|
|||||||
public:
|
public:
|
||||||
explicit CMakeRunConfiguration(ProjectExplorer::Target *target);
|
explicit CMakeRunConfiguration(ProjectExplorer::Target *target);
|
||||||
|
|
||||||
QString buildSystemTarget() const final { return m_buildSystemTarget; }
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
QWidget *createConfigurationWidget() override;
|
QWidget *createConfigurationWidget() override;
|
||||||
@@ -54,9 +52,7 @@ private:
|
|||||||
void updateTargetInformation();
|
void updateTargetInformation();
|
||||||
|
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
QString extraId() const final;
|
|
||||||
|
|
||||||
QString m_buildSystemTarget;
|
|
||||||
QString m_title;
|
QString m_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -358,7 +358,7 @@ void ServerModeReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
|||||||
|
|
||||||
CppTools::RawProjectPart rpp;
|
CppTools::RawProjectPart rpp;
|
||||||
rpp.setProjectFileLocation(fg->target->sourceDirectory.toString() + "/CMakeLists.txt");
|
rpp.setProjectFileLocation(fg->target->sourceDirectory.toString() + "/CMakeLists.txt");
|
||||||
rpp.setBuildSystemTarget(fg->target->name);
|
rpp.setBuildSystemTarget(fg->target->name + QChar('\n') + fg->target->sourceDirectory.toString() + QChar('/'));
|
||||||
rpp.setDisplayName(fg->target->name + QString::number(counter));
|
rpp.setDisplayName(fg->target->name + QString::number(counter));
|
||||||
rpp.setMacros(fg->macros);
|
rpp.setMacros(fg->macros);
|
||||||
rpp.setIncludePaths(includes);
|
rpp.setIncludePaths(includes);
|
||||||
|
|||||||
@@ -369,7 +369,7 @@ void TeaLeafReader::updateCodeModel(CppTools::RawProjectParts &rpps)
|
|||||||
includePaths += m_parameters.workDirectory.toString();
|
includePaths += m_parameters.workDirectory.toString();
|
||||||
CppTools::RawProjectPart rpp;
|
CppTools::RawProjectPart rpp;
|
||||||
rpp.setProjectFileLocation(cbt.sourceDirectory.toString() + "/CMakeLists.txt");
|
rpp.setProjectFileLocation(cbt.sourceDirectory.toString() + "/CMakeLists.txt");
|
||||||
rpp.setBuildSystemTarget(cbt.title);
|
rpp.setBuildSystemTarget(cbt.title + QChar('\n') + cbt.sourceDirectory.toString() + QChar('/'));
|
||||||
rpp.setIncludePaths(includePaths);
|
rpp.setIncludePaths(includePaths);
|
||||||
|
|
||||||
CppTools::RawProjectPartFlags cProjectFlags;
|
CppTools::RawProjectPartFlags cProjectFlags;
|
||||||
|
|||||||
@@ -104,11 +104,6 @@ IosRunConfiguration::IosRunConfiguration(Target *target)
|
|||||||
this, &IosRunConfiguration::deviceChanges);
|
this, &IosRunConfiguration::deviceChanges);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_profilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void IosRunConfiguration::deviceChanges()
|
void IosRunConfiguration::deviceChanges()
|
||||||
{
|
{
|
||||||
updateDisplayNames();
|
updateDisplayNames();
|
||||||
@@ -159,7 +154,7 @@ void IosRunConfiguration::updateEnabledState()
|
|||||||
|
|
||||||
bool IosRunConfiguration::canRunForNode(const Node *node) const
|
bool IosRunConfiguration::canRunForNode(const Node *node) const
|
||||||
{
|
{
|
||||||
return node->filePath() == m_profilePath;
|
return node->filePath() == profilePath();
|
||||||
}
|
}
|
||||||
|
|
||||||
IosDeployStep *IosRunConfiguration::deployStep() const
|
IosDeployStep *IosRunConfiguration::deployStep() const
|
||||||
@@ -170,7 +165,7 @@ IosDeployStep *IosRunConfiguration::deployStep() const
|
|||||||
|
|
||||||
FileName IosRunConfiguration::profilePath() const
|
FileName IosRunConfiguration::profilePath() const
|
||||||
{
|
{
|
||||||
return m_profilePath;
|
return FileName::fromString(buildKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
static QmakeProFile *proFile(const IosRunConfiguration *rc)
|
static QmakeProFile *proFile(const IosRunConfiguration *rc)
|
||||||
@@ -247,9 +242,6 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!RunConfiguration::fromMap(map))
|
if (!RunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QString extraId = idFromMap(map).suffixAfter(id());
|
|
||||||
m_profilePath = Utils::FileName::fromString(extraId);
|
|
||||||
|
|
||||||
bool deviceTypeIsInt;
|
bool deviceTypeIsInt;
|
||||||
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
map.value(deviceTypeKey).toInt(&deviceTypeIsInt);
|
||||||
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
|
if (deviceTypeIsInt || !m_deviceType.fromMap(map.value(deviceTypeKey).toMap())) {
|
||||||
@@ -263,11 +255,6 @@ bool IosRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IosRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
|
||||||
{
|
|
||||||
m_profilePath = Utils::FileName::fromString(info.buildKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
QVariantMap IosRunConfiguration::toMap() const
|
QVariantMap IosRunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap res = RunConfiguration::toMap();
|
QVariantMap res = RunConfiguration::toMap();
|
||||||
@@ -275,11 +262,6 @@ QVariantMap IosRunConfiguration::toMap() const
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString IosRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return m_profilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString IosRunConfiguration::disabledReason() const
|
QString IosRunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
Core::Id devType = DeviceTypeKitInformation::deviceTypeId(target()->kit());
|
||||||
|
|||||||
@@ -62,22 +62,16 @@ public:
|
|||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void localExecutableChanged();
|
void localExecutableChanged();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString extraId() const final;
|
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
|
||||||
|
|
||||||
void deviceChanges();
|
void deviceChanges();
|
||||||
friend class IosRunConfigurationWidget;
|
friend class IosRunConfigurationWidget;
|
||||||
void updateDisplayNames();
|
void updateDisplayNames();
|
||||||
void updateEnabledState() final;
|
void updateEnabledState() final;
|
||||||
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
||||||
|
|
||||||
Utils::FileName m_profilePath;
|
|
||||||
IosDeviceType m_deviceType;
|
IosDeviceType m_deviceType;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -39,18 +39,8 @@ namespace ProjectExplorer {
|
|||||||
class PROJECTEXPLORER_EXPORT BuildTargetInfo
|
class PROJECTEXPLORER_EXPORT BuildTargetInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
BuildTargetInfo() = default;
|
|
||||||
BuildTargetInfo(const QString &targetName, const Utils::FileName &targetFilePath,
|
|
||||||
const Utils::FileName &projectFilePath, bool isQtcRunnable = true) :
|
|
||||||
targetName(targetName),
|
|
||||||
targetFilePath(targetFilePath),
|
|
||||||
projectFilePath(projectFilePath),
|
|
||||||
isQtcRunnable(isQtcRunnable)
|
|
||||||
{ }
|
|
||||||
|
|
||||||
QString targetName;
|
|
||||||
QString displayName;
|
|
||||||
QString buildKey; // Used to identify this BuildTargetInfo object in its list.
|
QString buildKey; // Used to identify this BuildTargetInfo object in its list.
|
||||||
|
QString displayName;
|
||||||
|
|
||||||
Utils::FileName targetFilePath;
|
Utils::FileName targetFilePath;
|
||||||
Utils::FileName projectFilePath;
|
Utils::FileName projectFilePath;
|
||||||
@@ -63,9 +53,8 @@ public:
|
|||||||
|
|
||||||
inline bool operator==(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
|
inline bool operator==(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
|
||||||
{
|
{
|
||||||
return ti1.targetName == ti2.targetName
|
return ti1.buildKey == ti2.buildKey
|
||||||
&& ti1.displayName == ti2.displayName
|
&& ti1.displayName == ti2.displayName
|
||||||
&& ti1.buildKey == ti2.buildKey
|
|
||||||
&& ti1.targetFilePath == ti2.targetFilePath
|
&& ti1.targetFilePath == ti2.targetFilePath
|
||||||
&& ti1.projectFilePath == ti2.projectFilePath;
|
&& ti1.projectFilePath == ti2.projectFilePath;
|
||||||
}
|
}
|
||||||
@@ -77,7 +66,7 @@ inline bool operator!=(const BuildTargetInfo &ti1, const BuildTargetInfo &ti2)
|
|||||||
|
|
||||||
inline uint qHash(const BuildTargetInfo &ti)
|
inline uint qHash(const BuildTargetInfo &ti)
|
||||||
{
|
{
|
||||||
return qHash(ti.targetName) ^ qHash(ti.displayName) ^ qHash(ti.buildKey);
|
return qHash(ti.displayName) ^ qHash(ti.buildKey);
|
||||||
}
|
}
|
||||||
|
|
||||||
class PROJECTEXPLORER_EXPORT BuildTargetInfoList
|
class PROJECTEXPLORER_EXPORT BuildTargetInfoList
|
||||||
@@ -97,16 +86,10 @@ public:
|
|||||||
return Utils::FileName();
|
return Utils::FileName();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool hasTarget(const QString &targetName) {
|
Utils::FileName targetFilePath(const QString &buildKey) {
|
||||||
return Utils::anyOf(list, [&targetName](const BuildTargetInfo &ti) {
|
return Utils::findOrDefault(list, [&buildKey](const BuildTargetInfo &ti) {
|
||||||
return ti.targetName == targetName;
|
return ti.buildKey == buildKey
|
||||||
});
|
|| ti.projectFilePath.toString() == buildKey;
|
||||||
}
|
|
||||||
|
|
||||||
Utils::FileName targetFilePath(const QString &targetName) {
|
|
||||||
return Utils::findOrDefault(list, [&targetName](const BuildTargetInfo &ti) {
|
|
||||||
return ti.targetName == targetName
|
|
||||||
|| ti.projectFilePath.toString() == targetName;
|
|
||||||
}).targetFilePath;
|
}).targetFilePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,11 +45,6 @@ Core::Id ProjectConfiguration::id() const
|
|||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ProjectConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return QString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ProjectConfiguration::settingsIdKey()
|
QString ProjectConfiguration::settingsIdKey()
|
||||||
{
|
{
|
||||||
return QString(CONFIGURATION_ID_KEY);
|
return QString(CONFIGURATION_ID_KEY);
|
||||||
@@ -105,7 +100,7 @@ QVariantMap ProjectConfiguration::toMap() const
|
|||||||
{
|
{
|
||||||
QTC_CHECK(m_id.isValid());
|
QTC_CHECK(m_id.isValid());
|
||||||
QVariantMap map;
|
QVariantMap map;
|
||||||
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.withSuffix(extraId()).toSetting());
|
map.insert(QLatin1String(CONFIGURATION_ID_KEY), m_id.toSetting());
|
||||||
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
|
map.insert(QLatin1String(DISPLAY_NAME_KEY), m_displayName);
|
||||||
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
|
map.insert(QLatin1String(DEFAULT_DISPLAY_NAME_KEY), m_defaultDisplayName);
|
||||||
return map;
|
return map;
|
||||||
@@ -114,6 +109,8 @@ QVariantMap ProjectConfiguration::toMap() const
|
|||||||
bool ProjectConfiguration::fromMap(const QVariantMap &map)
|
bool ProjectConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
Core::Id id = Core::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY)));
|
Core::Id id = Core::Id::fromSetting(map.value(QLatin1String(CONFIGURATION_ID_KEY)));
|
||||||
|
// Note: This is only "startsWith", not ==, as RunConfigurations currently still
|
||||||
|
// mangle in their build keys.
|
||||||
QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false);
|
QTC_ASSERT(id.toString().startsWith(m_id.toString()), return false);
|
||||||
|
|
||||||
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
|
m_displayName = map.value(QLatin1String(DISPLAY_NAME_KEY), QString()).toString();
|
||||||
|
|||||||
@@ -72,9 +72,6 @@ public:
|
|||||||
|
|
||||||
virtual bool isActive() const = 0;
|
virtual bool isActive() const = 0;
|
||||||
|
|
||||||
// Used in settings to mangle in build targets in RunConfigurations.
|
|
||||||
virtual QString extraId() const;
|
|
||||||
|
|
||||||
static QString settingsIdKey();
|
static QString settingsIdKey();
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|||||||
@@ -326,6 +326,11 @@ QVariantMap RunConfiguration::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map = ProjectConfiguration::toMap();
|
QVariantMap map = ProjectConfiguration::toMap();
|
||||||
|
|
||||||
|
// FIXME: Remove this id mangling, e.g. by using a separate entry for the build key.
|
||||||
|
if (!m_buildKey.isEmpty()) {
|
||||||
|
const Core::Id mangled = id().withSuffix(m_buildKey);
|
||||||
|
map.insert(settingsIdKey(), mangled.toSetting());
|
||||||
|
}
|
||||||
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
||||||
aspect->toMap(map);
|
aspect->toMap(map);
|
||||||
|
|
||||||
@@ -345,10 +350,17 @@ Abi RunConfiguration::abi() const
|
|||||||
|
|
||||||
bool RunConfiguration::fromMap(const QVariantMap &map)
|
bool RunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
|
if (!ProjectConfiguration::fromMap(map))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// FIXME: Remove this id mangling, e.g. by using a separate entry for the build key.
|
||||||
|
const Core::Id mangledId = Core::Id::fromSetting(map.value(settingsIdKey()));
|
||||||
|
m_buildKey = mangledId.suffixAfter(id());
|
||||||
|
|
||||||
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
foreach (IRunConfigurationAspect *aspect, m_aspects)
|
||||||
aspect->fromMap(map);
|
aspect->fromMap(map);
|
||||||
|
|
||||||
return ProjectConfiguration::fromMap(map);
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@@ -485,10 +497,10 @@ RunConfigurationFactory::availableCreators(Target *parent) const
|
|||||||
return Utils::transform(buildTargets, [&](const BuildTargetInfo &ti) {
|
return Utils::transform(buildTargets, [&](const BuildTargetInfo &ti) {
|
||||||
QString displayName = ti.displayName;
|
QString displayName = ti.displayName;
|
||||||
if (displayName.isEmpty())
|
if (displayName.isEmpty())
|
||||||
displayName = decoratedTargetName(ti.targetName, parent);
|
displayName = decoratedTargetName(ti.buildKey, parent);
|
||||||
else if (m_decorateDisplayNames)
|
else if (m_decorateDisplayNames)
|
||||||
displayName = decoratedTargetName(displayName, parent);
|
displayName = decoratedTargetName(displayName, parent);
|
||||||
RunConfigurationCreationInfo rci(this, m_runConfigBaseId, ti.targetName, displayName);
|
RunConfigurationCreationInfo rci(this, m_runConfigBaseId, ti.buildKey, displayName);
|
||||||
rci.creationMode = ti.isQtcRunnable || !hasAnyQtcRunnable
|
rci.creationMode = ti.isQtcRunnable || !hasAnyQtcRunnable
|
||||||
? RunConfigurationCreationInfo::AlwaysCreate
|
? RunConfigurationCreationInfo::AlwaysCreate
|
||||||
: RunConfigurationCreationInfo::ManualCreationOnly;
|
: RunConfigurationCreationInfo::ManualCreationOnly;
|
||||||
@@ -551,15 +563,9 @@ RunConfiguration *RunConfigurationCreationInfo::create(Target *target) const
|
|||||||
if (!rc)
|
if (!rc)
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
|
||||||
// "FIX" ids by mangling in the extra data (build system target etc)
|
rc->m_buildKey = buildKey;
|
||||||
// for compatibility for the current format used in settings.
|
|
||||||
if (!targetName.isEmpty()) {
|
|
||||||
QVariantMap data = rc->toMap();
|
|
||||||
data[ProjectConfiguration::settingsIdKey()] = id.withSuffix(targetName).toString();
|
|
||||||
rc->fromMap(data);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc->doAdditionalSetup(*this);
|
rc->doAdditionalSetup(*this);
|
||||||
|
rc->setDefaultDisplayName(displayName);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -245,9 +245,9 @@ public:
|
|||||||
virtual Runnable runnable() const;
|
virtual Runnable runnable() const;
|
||||||
virtual Abi abi() const;
|
virtual Abi abi() const;
|
||||||
|
|
||||||
// Return the name of the build system target that created this run configuration.
|
// Return a handle to the build system target that created this run configuration.
|
||||||
// May return an empty string if no target built the executable!
|
// May return an empty string if no target built the executable!
|
||||||
virtual QString buildSystemTarget() const { return QString(); }
|
QString buildKey() const { return m_buildKey; }
|
||||||
|
|
||||||
void addExtraAspect(IRunConfigurationAspect *aspect);
|
void addExtraAspect(IRunConfigurationAspect *aspect);
|
||||||
|
|
||||||
@@ -280,6 +280,7 @@ private:
|
|||||||
friend class RunConfigurationCreationInfo;
|
friend class RunConfigurationCreationInfo;
|
||||||
|
|
||||||
QList<IRunConfigurationAspect *> m_aspects;
|
QList<IRunConfigurationAspect *> m_aspects;
|
||||||
|
QString m_buildKey;
|
||||||
};
|
};
|
||||||
|
|
||||||
class RunConfigurationCreationInfo
|
class RunConfigurationCreationInfo
|
||||||
@@ -289,11 +290,11 @@ public:
|
|||||||
RunConfigurationCreationInfo() = default;
|
RunConfigurationCreationInfo() = default;
|
||||||
RunConfigurationCreationInfo(const RunConfigurationFactory *factory,
|
RunConfigurationCreationInfo(const RunConfigurationFactory *factory,
|
||||||
Core::Id id,
|
Core::Id id,
|
||||||
QString extra, QString displayName,
|
QString buildKey, QString displayName,
|
||||||
CreationMode creationMode = AlwaysCreate,
|
CreationMode creationMode = AlwaysCreate,
|
||||||
bool useTerminal = false)
|
bool useTerminal = false)
|
||||||
: factory(factory), id(id),
|
: factory(factory), id(id),
|
||||||
targetName(extra),
|
buildKey(buildKey),
|
||||||
displayName(displayName),
|
displayName(displayName),
|
||||||
creationMode(creationMode),
|
creationMode(creationMode),
|
||||||
useTerminal(useTerminal)
|
useTerminal(useTerminal)
|
||||||
@@ -303,9 +304,8 @@ public:
|
|||||||
|
|
||||||
const RunConfigurationFactory *factory = nullptr;
|
const RunConfigurationFactory *factory = nullptr;
|
||||||
Core::Id id;
|
Core::Id id;
|
||||||
QString targetName;
|
|
||||||
QString displayName;
|
|
||||||
QString buildKey;
|
QString buildKey;
|
||||||
|
QString displayName;
|
||||||
CreationMode creationMode = AlwaysCreate;
|
CreationMode creationMode = AlwaysCreate;
|
||||||
bool useTerminal = false;
|
bool useTerminal = false;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -564,8 +564,8 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
foreach (RunConfiguration *rc, existingConfigured) {
|
foreach (RunConfiguration *rc, existingConfigured) {
|
||||||
bool present = false;
|
bool present = false;
|
||||||
for (const RunConfigurationCreationInfo &item : creators) {
|
for (const RunConfigurationCreationInfo &item : creators) {
|
||||||
QString rcExtraId = rc->extraId();
|
QString buildKey = rc->buildKey();
|
||||||
if (item.id == rc->id() && (item.targetName == rcExtraId || item.buildKey == rcExtraId)) {
|
if (item.id == rc->id() && item.buildKey == buildKey) {
|
||||||
existing.append(item);
|
existing.append(item);
|
||||||
present = true;
|
present = true;
|
||||||
}
|
}
|
||||||
@@ -581,7 +581,7 @@ void Target::updateDefaultRunConfigurations()
|
|||||||
continue;
|
continue;
|
||||||
bool exists = false;
|
bool exists = false;
|
||||||
for (const RunConfigurationCreationInfo &ex : existing) {
|
for (const RunConfigurationCreationInfo &ex : existing) {
|
||||||
if (ex.id == item.id && ex.targetName == item.targetName)
|
if (ex.id == item.id && ex.buildKey == item.buildKey)
|
||||||
exists = true;
|
exists = true;
|
||||||
}
|
}
|
||||||
if (exists)
|
if (exists)
|
||||||
@@ -776,7 +776,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
id.isValid() ? qPrintable(id.toString()) : "UNKNOWN");
|
id.isValid() ? qPrintable(id.toString()) : "UNKNOWN");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
QTC_CHECK(dc->id().withSuffix(dc->extraId()) == ProjectExplorer::idFromMap(valueMap));
|
QTC_CHECK(dc->id() == ProjectExplorer::idFromMap(valueMap));
|
||||||
addDeployConfiguration(dc);
|
addDeployConfiguration(dc);
|
||||||
if (i == activeConfiguration)
|
if (i == activeConfiguration)
|
||||||
setActiveDeployConfiguration(dc);
|
setActiveDeployConfiguration(dc);
|
||||||
@@ -801,7 +801,7 @@ bool Target::fromMap(const QVariantMap &map)
|
|||||||
RunConfiguration *rc = RunConfigurationFactory::restore(this, valueMap);
|
RunConfiguration *rc = RunConfigurationFactory::restore(this, valueMap);
|
||||||
if (!rc)
|
if (!rc)
|
||||||
continue;
|
continue;
|
||||||
QTC_CHECK(rc->id().withSuffix(rc->extraId()) == ProjectExplorer::idFromMap(valueMap));
|
QTC_CHECK(rc->id().withSuffix(rc->buildKey()) == ProjectExplorer::idFromMap(valueMap));
|
||||||
addRunConfiguration(rc);
|
addRunConfiguration(rc);
|
||||||
if (i == activeConfiguration)
|
if (i == activeConfiguration)
|
||||||
setActiveRunConfiguration(rc);
|
setActiveRunConfiguration(rc);
|
||||||
|
|||||||
@@ -290,7 +290,7 @@ void PythonRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInf
|
|||||||
Environment sysEnv = Environment::systemEnvironment();
|
Environment sysEnv = Environment::systemEnvironment();
|
||||||
const QString exec = sysEnv.searchInPath("python").toString();
|
const QString exec = sysEnv.searchInPath("python").toString();
|
||||||
m_interpreter = exec.isEmpty() ? "python" : exec;
|
m_interpreter = exec.isEmpty() ? "python" : exec;
|
||||||
m_mainScript = info.targetName;
|
m_mainScript = info.buildKey;
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -510,7 +510,7 @@ void PythonProject::refresh(Target *target)
|
|||||||
newRoot->addNestedNode(new PythonFileNode(FileName::fromString(f), displayName, fileType));
|
newRoot->addNestedNode(new PythonFileNode(FileName::fromString(f), displayName, fileType));
|
||||||
if (fileType == FileType::Source) {
|
if (fileType == FileType::Source) {
|
||||||
BuildTargetInfo bti;
|
BuildTargetInfo bti;
|
||||||
bti.targetName = f;
|
bti.buildKey = f;
|
||||||
bti.targetFilePath = FileName::fromString(f);
|
bti.targetFilePath = FileName::fromString(f);
|
||||||
bti.projectFilePath = projectFilePath();
|
bti.projectFilePath = projectFilePath();
|
||||||
appTargets.list.append(bti);
|
appTargets.list.append(bti);
|
||||||
|
|||||||
@@ -94,8 +94,6 @@ static const char CONFIG_SYSTEM_INCLUDEPATHS[] = "systemIncludePaths";
|
|||||||
static const char CONFIG_FRAMEWORKPATHS[] = "frameworkPaths";
|
static const char CONFIG_FRAMEWORKPATHS[] = "frameworkPaths";
|
||||||
static const char CONFIG_SYSTEM_FRAMEWORKPATHS[] = "systemFrameworkPaths";
|
static const char CONFIG_SYSTEM_FRAMEWORKPATHS[] = "systemFrameworkPaths";
|
||||||
|
|
||||||
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
|
||||||
|
|
||||||
class OpTimer
|
class OpTimer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -959,7 +957,7 @@ void QbsProject::updateCppCodeModel()
|
|||||||
rpp.setDisplayName(grp.name());
|
rpp.setDisplayName(grp.name());
|
||||||
rpp.setProjectFileLocation(grp.location().filePath(),
|
rpp.setProjectFileLocation(grp.location().filePath(),
|
||||||
grp.location().line(), grp.location().column());
|
grp.location().line(), grp.location().column());
|
||||||
rpp.setBuildSystemTarget(prd.name());
|
rpp.setBuildSystemTarget(uniqueProductName(prd));
|
||||||
rpp.setBuildTargetType(prd.isRunnable() ? CppTools::ProjectPart::Executable
|
rpp.setBuildTargetType(prd.isRunnable() ? CppTools::ProjectPart::Executable
|
||||||
: CppTools::ProjectPart::Library);
|
: CppTools::ProjectPart::Library);
|
||||||
|
|
||||||
@@ -1126,10 +1124,7 @@ void QbsProject::updateApplicationTargets()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
BuildTargetInfo bti;
|
BuildTargetInfo bti;
|
||||||
bti.targetName = productData.fullDisplayName();
|
bti.buildKey = QbsProject::uniqueProductName(productData);
|
||||||
bti.buildKey = QbsProject::uniqueProductName(productData)
|
|
||||||
+ rcNameSeparator()
|
|
||||||
+ productData.fullDisplayName();
|
|
||||||
bti.targetFilePath = FileName::fromString(targetFile);
|
bti.targetFilePath = FileName::fromString(targetFile);
|
||||||
bti.projectFilePath = FileName::fromString(projectFile);
|
bti.projectFilePath = FileName::fromString(projectFile);
|
||||||
bti.isQtcRunnable = isQtcRunnable; // Fixed up below.
|
bti.isQtcRunnable = isQtcRunnable; // Fixed up below.
|
||||||
|
|||||||
@@ -52,8 +52,6 @@ namespace Internal {
|
|||||||
|
|
||||||
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
const char QBS_RC_PREFIX[] = "Qbs.RunConfiguration:";
|
||||||
|
|
||||||
static QString rcNameSeparator() { return QLatin1String("---Qbs.RC.NameSeparator---"); }
|
|
||||||
|
|
||||||
static QString usingLibraryPathsKey() { return QString("Qbs.RunConfiguration.UsingLibraryPaths"); }
|
static QString usingLibraryPathsKey() { return QString("Qbs.RunConfiguration.UsingLibraryPaths"); }
|
||||||
|
|
||||||
// --------------------------------------------------------------------
|
// --------------------------------------------------------------------
|
||||||
@@ -107,15 +105,15 @@ QbsRunConfiguration::QbsRunConfiguration(Target *target)
|
|||||||
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
[envAspect]() { envAspect->buildEnvironmentHasChanged(); });
|
||||||
|
|
||||||
connect(target, &Target::deploymentDataChanged,
|
connect(target, &Target::deploymentDataChanged,
|
||||||
this, &QbsRunConfiguration::handleBuildSystemDataUpdated);
|
this, &QbsRunConfiguration::updateTargetInformation);
|
||||||
connect(target, &Target::applicationTargetsChanged,
|
connect(target, &Target::applicationTargetsChanged,
|
||||||
this, &QbsRunConfiguration::handleBuildSystemDataUpdated);
|
this, &QbsRunConfiguration::updateTargetInformation);
|
||||||
// Handles device changes, etc.
|
// Handles device changes, etc.
|
||||||
connect(target, &Target::kitChanged,
|
connect(target, &Target::kitChanged,
|
||||||
this, &QbsRunConfiguration::handleBuildSystemDataUpdated);
|
this, &QbsRunConfiguration::updateTargetInformation);
|
||||||
|
|
||||||
connect(target->project(), &Project::parsingFinished,
|
connect(target->project(), &Project::parsingFinished,
|
||||||
this, &QbsRunConfiguration::handleBuildSystemDataUpdated);
|
this, &QbsRunConfiguration::updateTargetInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap QbsRunConfiguration::toMap() const
|
QVariantMap QbsRunConfiguration::toMap() const
|
||||||
@@ -130,23 +128,16 @@ bool QbsRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!RunConfiguration::fromMap(map))
|
if (!RunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m_buildKey = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
m_usingLibraryPaths = map.value(usingLibraryPathsKey(), true).toBool();
|
m_usingLibraryPaths = map.value(usingLibraryPathsKey(), true).toBool();
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
updateTargetInformation();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsRunConfiguration::extraId() const
|
void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
||||||
{
|
{
|
||||||
return m_buildKey;
|
setDefaultDisplayName(info.displayName);
|
||||||
}
|
updateTargetInformation();
|
||||||
|
|
||||||
void QbsRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &rci)
|
|
||||||
{
|
|
||||||
m_buildKey = rci.buildKey;
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
QWidget *QbsRunConfiguration::createConfigurationWidget()
|
QWidget *QbsRunConfiguration::createConfigurationWidget()
|
||||||
@@ -173,32 +164,19 @@ void QbsRunConfiguration::setUsingLibraryPaths(bool useLibPaths)
|
|||||||
|
|
||||||
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
void QbsRunConfiguration::addToBaseEnvironment(Utils::Environment &env) const
|
||||||
{
|
{
|
||||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(m_buildKey);
|
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||||
if (bti.runEnvModifier)
|
if (bti.runEnvModifier)
|
||||||
bti.runEnvModifier(env, m_usingLibraryPaths);
|
bti.runEnvModifier(env, m_usingLibraryPaths);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QbsRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return m_buildKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QbsRunConfiguration::defaultDisplayName()
|
|
||||||
{
|
|
||||||
const int sepPos = m_buildKey.indexOf(rcNameSeparator());
|
|
||||||
if (sepPos == -1)
|
|
||||||
return tr("Qbs Run Configuration");
|
|
||||||
return m_buildKey.mid(sepPos + rcNameSeparator().size());
|
|
||||||
}
|
|
||||||
|
|
||||||
Utils::OutputFormatter *QbsRunConfiguration::createOutputFormatter() const
|
Utils::OutputFormatter *QbsRunConfiguration::createOutputFormatter() const
|
||||||
{
|
{
|
||||||
return new QtSupport::QtOutputFormatter(target()->project());
|
return new QtSupport::QtOutputFormatter(target()->project());
|
||||||
}
|
}
|
||||||
|
|
||||||
void QbsRunConfiguration::handleBuildSystemDataUpdated()
|
void QbsRunConfiguration::updateTargetInformation()
|
||||||
{
|
{
|
||||||
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(m_buildKey);
|
BuildTargetInfo bti = target()->applicationTargets().buildTargetInfo(buildKey());
|
||||||
FileName executable = bti.targetFilePath;
|
FileName executable = bti.targetFilePath;
|
||||||
|
|
||||||
auto terminalAspect = extraAspect<TerminalAspect>();
|
auto terminalAspect = extraAspect<TerminalAspect>();
|
||||||
@@ -221,8 +199,7 @@ void QbsRunConfiguration::handleBuildSystemDataUpdated()
|
|||||||
bool QbsRunConfiguration::canRunForNode(const Node *node) const
|
bool QbsRunConfiguration::canRunForNode(const Node *node) const
|
||||||
{
|
{
|
||||||
if (auto pn = dynamic_cast<const QbsProductNode *>(node)) {
|
if (auto pn = dynamic_cast<const QbsProductNode *>(node)) {
|
||||||
const int sepPos = m_buildKey.indexOf(rcNameSeparator());
|
const QString uniqueProductName = buildKey();
|
||||||
const QString uniqueProductName = m_buildKey.left(sepPos);
|
|
||||||
return uniqueProductName == QbsProject::uniqueProductName(pn->qbsProductData());
|
return uniqueProductName == QbsProject::uniqueProductName(pn->qbsProductData());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -51,22 +51,18 @@ public:
|
|||||||
|
|
||||||
void addToBaseEnvironment(Utils::Environment &env) const;
|
void addToBaseEnvironment(Utils::Environment &env) const;
|
||||||
|
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
bool usingLibraryPaths() const { return m_usingLibraryPaths; }
|
bool usingLibraryPaths() const { return m_usingLibraryPaths; }
|
||||||
void setUsingLibraryPaths(bool useLibPaths);
|
void setUsingLibraryPaths(bool useLibPaths);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QVariantMap toMap() const final;
|
QVariantMap toMap() const final;
|
||||||
bool fromMap(const QVariantMap &map) final;
|
bool fromMap(const QVariantMap &map) final;
|
||||||
QString extraId() const final;
|
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &rci) final;
|
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &rci) final;
|
||||||
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
||||||
|
|
||||||
QString defaultDisplayName();
|
void updateTargetInformation();
|
||||||
void handleBuildSystemDataUpdated();
|
|
||||||
|
|
||||||
bool m_usingLibraryPaths = true;
|
bool m_usingLibraryPaths = true;
|
||||||
QString m_buildKey;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class QbsRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
class QbsRunConfigurationFactory : public ProjectExplorer::RunConfigurationFactory
|
||||||
|
|||||||
@@ -57,24 +57,11 @@ QmakeAndroidRunConfiguration::QmakeAndroidRunConfiguration(Target *target)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeAndroidRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_proFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
|
bool QmakeAndroidRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!AndroidRunConfiguration::fromMap(map))
|
if (!AndroidRunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
QTC_ASSERT(project(), return false);
|
|
||||||
const QDir projectDir = QDir(project()->projectDirectory().toString());
|
|
||||||
m_proFilePath = Utils::FileName::fromUserInput(projectDir.filePath(map.value(PRO_FILE_KEY).toString()));
|
|
||||||
|
|
||||||
QString extraId = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
if (!extraId.isEmpty())
|
|
||||||
m_proFilePath = Utils::FileName::fromString(extraId);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,8 +69,9 @@ QVariantMap QmakeAndroidRunConfiguration::toMap() const
|
|||||||
{
|
{
|
||||||
QVariantMap map(AndroidRunConfiguration::toMap());
|
QVariantMap map(AndroidRunConfiguration::toMap());
|
||||||
|
|
||||||
|
// FIXME: Remove, only left for compatibility in 4.7 development cycle.
|
||||||
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
||||||
map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(m_proFilePath.toString()));
|
map.insert(PRO_FILE_KEY, projectDir.relativeFilePath(proFilePath().toString()));
|
||||||
|
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
@@ -93,48 +81,38 @@ void QmakeAndroidRunConfiguration::updateDisplayName()
|
|||||||
QmakeProject *project = qmakeProject();
|
QmakeProject *project = qmakeProject();
|
||||||
const QmakeProjectManager::QmakeProFileNode *root = project->rootProjectNode();
|
const QmakeProjectManager::QmakeProFileNode *root = project->rootProjectNode();
|
||||||
if (root) {
|
if (root) {
|
||||||
const QmakeProjectManager::QmakeProFileNode *node = root->findProFileFor(m_proFilePath);
|
const QmakeProjectManager::QmakeProFileNode *node = root->findProFileFor(proFilePath());
|
||||||
if (node) // should always be found
|
if (node) // should always be found
|
||||||
setDefaultDisplayName(node->displayName());
|
setDefaultDisplayName(node->displayName());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakeAndroidRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
|
||||||
{
|
|
||||||
m_proFilePath = Utils::FileName::fromString(info.buildKey);
|
|
||||||
}
|
|
||||||
|
|
||||||
QString QmakeAndroidRunConfiguration::disabledReason() const
|
QString QmakeAndroidRunConfiguration::disabledReason() const
|
||||||
{
|
{
|
||||||
if (qmakeProject()->isParsing())
|
if (qmakeProject()->isParsing())
|
||||||
return tr("The .pro file \"%1\" is currently being parsed.")
|
return tr("The .pro file \"%1\" is currently being parsed.")
|
||||||
.arg(m_proFilePath.fileName());
|
.arg(proFilePath().fileName());
|
||||||
|
|
||||||
if (!qmakeProject()->hasParsingData()) {
|
if (!qmakeProject()->hasParsingData()) {
|
||||||
if (!m_proFilePath.exists())
|
if (!proFilePath().exists())
|
||||||
return tr("The .pro file \"%1\" does not exist.")
|
return tr("The .pro file \"%1\" does not exist.")
|
||||||
.arg(m_proFilePath.fileName());
|
.arg(proFilePath().fileName());
|
||||||
|
|
||||||
QmakeProjectManager::QmakeProFileNode *rootProjectNode = qmakeProject()->rootProjectNode();
|
QmakeProjectManager::QmakeProFileNode *rootProjectNode = qmakeProject()->rootProjectNode();
|
||||||
if (!rootProjectNode) // Shutting down
|
if (!rootProjectNode) // Shutting down
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
if (!rootProjectNode->findProFileFor(m_proFilePath))
|
if (!rootProjectNode->findProFileFor(proFilePath()))
|
||||||
return tr("The .pro file \"%1\" is not part of the project.")
|
return tr("The .pro file \"%1\" is not part of the project.")
|
||||||
.arg(m_proFilePath.fileName());
|
.arg(proFilePath().fileName());
|
||||||
|
|
||||||
return tr("The .pro file \"%1\" could not be parsed.")
|
return tr("The .pro file \"%1\" could not be parsed.")
|
||||||
.arg(m_proFilePath.fileName());
|
.arg(proFilePath().fileName());
|
||||||
}
|
}
|
||||||
|
|
||||||
return QString();
|
return QString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeAndroidRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return m_proFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QmakeProject *QmakeAndroidRunConfiguration::qmakeProject() const
|
QmakeProject *QmakeAndroidRunConfiguration::qmakeProject() const
|
||||||
{
|
{
|
||||||
Target *t = target();
|
Target *t = target();
|
||||||
@@ -144,7 +122,7 @@ QmakeProject *QmakeAndroidRunConfiguration::qmakeProject() const
|
|||||||
|
|
||||||
Utils::FileName QmakeAndroidRunConfiguration::proFilePath() const
|
Utils::FileName QmakeAndroidRunConfiguration::proFilePath() const
|
||||||
{
|
{
|
||||||
return m_proFilePath;
|
return Utils::FileName::fromString(buildKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -45,16 +45,11 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
QString disabledReason() const override;
|
QString disabledReason() const override;
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
QString extraId() const final;
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
void updateDisplayName();
|
void updateDisplayName();
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
|
||||||
|
|
||||||
QmakeProjectManager::QmakeProject *qmakeProject() const;
|
QmakeProjectManager::QmakeProject *qmakeProject() const;
|
||||||
|
|
||||||
mutable Utils::FileName m_proFilePath;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
@@ -86,11 +86,6 @@ DesktopQmakeRunConfiguration::DesktopQmakeRunConfiguration(Target *target)
|
|||||||
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
this, &DesktopQmakeRunConfiguration::updateTargetInformation);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_proFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void DesktopQmakeRunConfiguration::updateTargetInformation()
|
void DesktopQmakeRunConfiguration::updateTargetInformation()
|
||||||
{
|
{
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
@@ -206,9 +201,10 @@ Runnable DesktopQmakeRunConfiguration::runnable() const
|
|||||||
|
|
||||||
QVariantMap DesktopQmakeRunConfiguration::toMap() const
|
QVariantMap DesktopQmakeRunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
|
// FIXME: For compatibility purposes in the 4.7 dev cycle only.
|
||||||
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
||||||
QVariantMap map(RunConfiguration::toMap());
|
QVariantMap map(RunConfiguration::toMap());
|
||||||
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(m_proFilePath.toString()));
|
map.insert(QLatin1String(PRO_FILE_KEY), projectDir.relativeFilePath(proFilePath().toString()));
|
||||||
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
|
map.insert(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), m_isUsingDyldImageSuffix);
|
||||||
map.insert(QLatin1String(USE_LIBRARY_SEARCH_PATH), m_isUsingLibrarySearchPath);
|
map.insert(QLatin1String(USE_LIBRARY_SEARCH_PATH), m_isUsingLibrarySearchPath);
|
||||||
return map;
|
return map;
|
||||||
@@ -220,8 +216,6 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
if (!res)
|
if (!res)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QDir projectDir = QDir(target()->project()->projectDirectory().toString());
|
|
||||||
m_proFilePath = Utils::FileName::fromUserInput(projectDir.filePath(map.value(QLatin1String(PRO_FILE_KEY)).toString()));
|
|
||||||
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
m_isUsingDyldImageSuffix = map.value(QLatin1String(USE_DYLD_IMAGE_SUFFIX_KEY), false).toBool();
|
||||||
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
|
m_isUsingLibrarySearchPath = map.value(QLatin1String(USE_LIBRARY_SEARCH_PATH), true).toBool();
|
||||||
|
|
||||||
@@ -229,9 +223,8 @@ bool DesktopQmakeRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &info)
|
void DesktopQmakeRunConfiguration::doAdditionalSetup(const RunConfigurationCreationInfo &)
|
||||||
{
|
{
|
||||||
m_proFilePath = FileName::fromString(info.buildKey);
|
|
||||||
updateTargetInformation();
|
updateTargetInformation();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -270,25 +263,21 @@ void DesktopQmakeRunConfiguration::addToBaseEnvironment(Environment &env) const
|
|||||||
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
env.set(QLatin1String("DYLD_IMAGE_SUFFIX"), QLatin1String("_debug"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return m_proFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::buildKey() const
|
|
||||||
{
|
|
||||||
return m_proFilePath.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DesktopQmakeRunConfiguration::canRunForNode(const Node *node) const
|
bool DesktopQmakeRunConfiguration::canRunForNode(const Node *node) const
|
||||||
{
|
{
|
||||||
return node->filePath() == m_proFilePath;
|
return node->filePath() == proFilePath();
|
||||||
|
}
|
||||||
|
|
||||||
|
FileName DesktopQmakeRunConfiguration::proFilePath() const
|
||||||
|
{
|
||||||
|
return FileName::fromString(buildKey());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
QString DesktopQmakeRunConfiguration::defaultDisplayName()
|
||||||
{
|
{
|
||||||
if (!m_proFilePath.isEmpty())
|
FileName profile = proFilePath();
|
||||||
return m_proFilePath.toFileInfo().completeBaseName();
|
if (!profile.isEmpty())
|
||||||
|
return profile.toFileInfo().completeBaseName();
|
||||||
return tr("Qt Run Configuration");
|
return tr("Qt Run Configuration");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -64,8 +64,6 @@ public:
|
|||||||
|
|
||||||
void addToBaseEnvironment(Utils::Environment &env) const;
|
void addToBaseEnvironment(Utils::Environment &env) const;
|
||||||
|
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
void baseWorkingDirectoryChanged(const QString&);
|
void baseWorkingDirectoryChanged(const QString&);
|
||||||
void usingDyldImageSuffixChanged(bool);
|
void usingDyldImageSuffixChanged(bool);
|
||||||
@@ -76,16 +74,14 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString extraId() const override;
|
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &) override;
|
|
||||||
|
|
||||||
void updateTargetInformation();
|
void updateTargetInformation();
|
||||||
|
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
||||||
|
|
||||||
QString defaultDisplayName();
|
QString defaultDisplayName();
|
||||||
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
bool canRunForNode(const ProjectExplorer::Node *node) const final;
|
||||||
QString buildKey() const;
|
|
||||||
|
|
||||||
Utils::FileName m_proFilePath; // Full path to the Application Pro File
|
Utils::FileName proFilePath() const;
|
||||||
bool m_isUsingDyldImageSuffix = false;
|
bool m_isUsingDyldImageSuffix = false;
|
||||||
bool m_isUsingLibrarySearchPath = true;
|
bool m_isUsingLibrarySearchPath = true;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -294,7 +294,7 @@ void QmakeProject::updateCppCodeModel()
|
|||||||
CppTools::RawProjectPart rpp;
|
CppTools::RawProjectPart rpp;
|
||||||
rpp.setDisplayName(pro->displayName());
|
rpp.setDisplayName(pro->displayName());
|
||||||
rpp.setProjectFileLocation(pro->filePath().toString());
|
rpp.setProjectFileLocation(pro->filePath().toString());
|
||||||
rpp.setBuildSystemTarget(pro->targetInformation().target);
|
rpp.setBuildSystemTarget(pro->filePath().toString());
|
||||||
const bool isExecutable = pro->projectType() == ProjectType::ApplicationTemplate;
|
const bool isExecutable = pro->projectType() == ProjectType::ApplicationTemplate;
|
||||||
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
|
rpp.setBuildTargetType(isExecutable ? CppTools::ProjectPart::Executable
|
||||||
: CppTools::ProjectPart::Library);
|
: CppTools::ProjectPart::Library);
|
||||||
@@ -1065,7 +1065,6 @@ void QmakeProject::updateBuildSystemData()
|
|||||||
}
|
}
|
||||||
|
|
||||||
BuildTargetInfo bti;
|
BuildTargetInfo bti;
|
||||||
bti.targetName = proFile->targetInformation().target;
|
|
||||||
bti.targetFilePath = FileName::fromString(executableFor(proFile));
|
bti.targetFilePath = FileName::fromString(executableFor(proFile));
|
||||||
bti.projectFilePath = proFile->filePath();
|
bti.projectFilePath = proFile->filePath();
|
||||||
bti.workingDirectory = FileName::fromString(workingDir);
|
bti.workingDirectory = FileName::fromString(workingDir);
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ namespace RemoteLinux {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
namespace {
|
namespace {
|
||||||
const char ArgumentsKey[] = "Qt4ProjectManager.MaemoRunConfiguration.Arguments";
|
const char ArgumentsKey[] = "Qt4ProjectManager.MaemoRunConfiguration.Arguments";
|
||||||
const char TargetNameKey[] = "Qt4ProjectManager.MaemoRunConfiguration.TargetName";
|
|
||||||
const char UseAlternateExeKey[] = "RemoteLinux.RunConfig.UseAlternateRemoteExecutable";
|
const char UseAlternateExeKey[] = "RemoteLinux.RunConfig.UseAlternateRemoteExecutable";
|
||||||
const char AlternateExeKey[] = "RemoteLinux.RunConfig.AlternateRemoteExecutable";
|
const char AlternateExeKey[] = "RemoteLinux.RunConfig.AlternateRemoteExecutable";
|
||||||
const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
|
const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
|
||||||
@@ -56,7 +55,6 @@ const char WorkingDirectoryKey[] = "RemoteLinux.RunConfig.WorkingDirectory";
|
|||||||
class RemoteLinuxRunConfigurationPrivate
|
class RemoteLinuxRunConfigurationPrivate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
QString targetName;
|
|
||||||
bool useAlternateRemoteExecutable = false;
|
bool useAlternateRemoteExecutable = false;
|
||||||
QString alternateRemoteExecutable;
|
QString alternateRemoteExecutable;
|
||||||
};
|
};
|
||||||
@@ -87,11 +85,6 @@ RemoteLinuxRunConfiguration::RemoteLinuxRunConfiguration(Target *target, Core::I
|
|||||||
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
this, &RemoteLinuxRunConfiguration::handleBuildSystemDataUpdated);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteLinuxRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return d->targetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
RemoteLinuxRunConfiguration::~RemoteLinuxRunConfiguration()
|
||||||
{
|
{
|
||||||
delete d;
|
delete d;
|
||||||
@@ -120,44 +113,31 @@ Runnable RemoteLinuxRunConfiguration::runnable() const
|
|||||||
QVariantMap RemoteLinuxRunConfiguration::toMap() const
|
QVariantMap RemoteLinuxRunConfiguration::toMap() const
|
||||||
{
|
{
|
||||||
QVariantMap map = RunConfiguration::toMap();
|
QVariantMap map = RunConfiguration::toMap();
|
||||||
map.insert(QLatin1String(TargetNameKey), d->targetName);
|
|
||||||
map.insert(QLatin1String(UseAlternateExeKey), d->useAlternateRemoteExecutable);
|
map.insert(QLatin1String(UseAlternateExeKey), d->useAlternateRemoteExecutable);
|
||||||
map.insert(QLatin1String(AlternateExeKey), d->alternateRemoteExecutable);
|
map.insert(QLatin1String(AlternateExeKey), d->alternateRemoteExecutable);
|
||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteLinuxRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return d->targetName;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
|
bool RemoteLinuxRunConfiguration::fromMap(const QVariantMap &map)
|
||||||
{
|
{
|
||||||
if (!RunConfiguration::fromMap(map))
|
if (!RunConfiguration::fromMap(map))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
d->targetName = map.value(QLatin1String(TargetNameKey)).toString();
|
|
||||||
d->useAlternateRemoteExecutable = map.value(QLatin1String(UseAlternateExeKey), false).toBool();
|
d->useAlternateRemoteExecutable = map.value(QLatin1String(UseAlternateExeKey), false).toBool();
|
||||||
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
|
d->alternateRemoteExecutable = map.value(QLatin1String(AlternateExeKey)).toString();
|
||||||
|
|
||||||
// Hack for old-style mangled ids. FIXME: Remove.
|
|
||||||
if (d->targetName.isEmpty()) {
|
|
||||||
QString extra = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
d->targetName = extra;
|
|
||||||
}
|
|
||||||
|
|
||||||
setDefaultDisplayName(defaultDisplayName());
|
setDefaultDisplayName(defaultDisplayName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteLinuxRunConfiguration::defaultDisplayName() const
|
QString RemoteLinuxRunConfiguration::defaultDisplayName() const
|
||||||
{
|
{
|
||||||
return RunConfigurationFactory::decoratedTargetName(d->targetName, target());
|
return RunConfigurationFactory::decoratedTargetName(buildKey(), target());
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
|
QString RemoteLinuxRunConfiguration::localExecutableFilePath() const
|
||||||
{
|
{
|
||||||
return target()->applicationTargets().targetFilePath(d->targetName).toString();
|
return target()->applicationTargets().targetFilePath(buildKey()).toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const
|
QString RemoteLinuxRunConfiguration::defaultRemoteExecutableFilePath() const
|
||||||
|
|||||||
@@ -60,8 +60,6 @@ public:
|
|||||||
|
|
||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
|
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
|
|
||||||
static const char *IdPrefix;
|
static const char *IdPrefix;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -73,7 +71,6 @@ protected:
|
|||||||
RemoteLinuxRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
RemoteLinuxRunConfiguration(ProjectExplorer::Target *target, Core::Id id);
|
||||||
|
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
QString extraId() const override;
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString defaultDisplayName() const;
|
QString defaultDisplayName() const;
|
||||||
|
|||||||
@@ -48,11 +48,6 @@ WinRtRunConfiguration::WinRtRunConfiguration(ProjectExplorer::Target *target)
|
|||||||
addExtraAspect(new ProjectExplorer::ArgumentsAspect(this, "WinRtRunConfigurationArgumentsId"));
|
addExtraAspect(new ProjectExplorer::ArgumentsAspect(this, "WinRtRunConfigurationArgumentsId"));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WinRtRunConfiguration::extraId() const
|
|
||||||
{
|
|
||||||
return m_proFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
QWidget *WinRtRunConfiguration::createConfigurationWidget()
|
||||||
{
|
{
|
||||||
return new WinRtRunConfigurationWidget(this);
|
return new WinRtRunConfigurationWidget(this);
|
||||||
@@ -71,13 +66,12 @@ bool WinRtRunConfiguration::fromMap(const QVariantMap &map)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
setUninstallAfterStop(map.value(QLatin1String(uninstallAfterStopIdC)).toBool());
|
setUninstallAfterStop(map.value(QLatin1String(uninstallAfterStopIdC)).toBool());
|
||||||
m_proFilePath = ProjectExplorer::idFromMap(map).suffixAfter(id());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WinRtRunConfiguration::doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info)
|
QString WinRtRunConfiguration::proFilePath() const
|
||||||
{
|
{
|
||||||
m_proFilePath = info.buildKey;
|
return buildKey();
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WinRtRunConfiguration::arguments() const
|
QString WinRtRunConfiguration::arguments() const
|
||||||
@@ -91,11 +85,6 @@ void WinRtRunConfiguration::setUninstallAfterStop(bool b)
|
|||||||
emit uninstallAfterStopChanged(m_uninstallAfterStop);
|
emit uninstallAfterStopChanged(m_uninstallAfterStop);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString WinRtRunConfiguration::buildSystemTarget() const
|
|
||||||
{
|
|
||||||
return m_proFilePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
ProjectExplorer::Runnable WinRtRunConfiguration::runnable() const
|
ProjectExplorer::Runnable WinRtRunConfiguration::runnable() const
|
||||||
{
|
{
|
||||||
ProjectExplorer::StandardRunnable r;
|
ProjectExplorer::StandardRunnable r;
|
||||||
@@ -116,7 +105,7 @@ QString WinRtRunConfiguration::executable() const
|
|||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
const QmakeProjectManager::QmakeProFile *pro
|
const QmakeProjectManager::QmakeProFile *pro
|
||||||
= rootProFile->findProFile(Utils::FileName::fromString(m_proFilePath));
|
= rootProFile->findProFile(Utils::FileName::fromString(proFilePath()));
|
||||||
if (!pro)
|
if (!pro)
|
||||||
return QString();
|
return QString();
|
||||||
|
|
||||||
|
|||||||
@@ -41,13 +41,11 @@ public:
|
|||||||
QVariantMap toMap() const override;
|
QVariantMap toMap() const override;
|
||||||
bool fromMap(const QVariantMap &map) override;
|
bool fromMap(const QVariantMap &map) override;
|
||||||
|
|
||||||
const QString &proFilePath() const { return m_proFilePath; }
|
QString proFilePath() const;
|
||||||
QString arguments() const;
|
QString arguments() const;
|
||||||
bool uninstallAfterStop() const { return m_uninstallAfterStop; }
|
bool uninstallAfterStop() const { return m_uninstallAfterStop; }
|
||||||
void setUninstallAfterStop(bool b);
|
void setUninstallAfterStop(bool b);
|
||||||
|
|
||||||
QString buildSystemTarget() const final;
|
|
||||||
|
|
||||||
ProjectExplorer::Runnable runnable() const override;
|
ProjectExplorer::Runnable runnable() const override;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
@@ -55,13 +53,9 @@ signals:
|
|||||||
void uninstallAfterStopChanged(bool);
|
void uninstallAfterStopChanged(bool);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QString extraId() const final;
|
|
||||||
|
|
||||||
QString m_proFilePath;
|
|
||||||
bool m_uninstallAfterStop = false;
|
bool m_uninstallAfterStop = false;
|
||||||
|
|
||||||
QString executable() const;
|
QString executable() const;
|
||||||
void doAdditionalSetup(const ProjectExplorer::RunConfigurationCreationInfo &info) final;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
|||||||
Reference in New Issue
Block a user